write_flash_memory.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 #include <fstream>
3 #include <string>
4 
5 #include "depthai/depthai.hpp"
6 
7 int main(int argc, char** argv) {
8  if(argc < 2) {
9  std::cout << "Usage: " << argv[0] << " offset filename" << std::endl;
10  return 0;
11  }
12  size_t offset = std::stoi(argv[1]);
13  std::string filename{argv[2]};
14 
15  // Find device and read memory
16  bool res = false;
19 
20  if(res) {
21  std::cout << "Found device with name: " << info.name << std::endl;
23 
24  auto progress = [](float p) { std::cout << "Flashing progress..." << p * 100 << "%" << std::endl; };
25  bl.flashCustom(dai::DeviceBootloader::Memory::FLASH, offset, filename, progress);
26 
27  } else {
28  std::cout << "No devices found" << std::endl;
29  }
30 
31  return 0;
32 }
main
int main(int argc, char **argv)
Definition: write_flash_memory.cpp:7
dai::DeviceBootloader
Definition: DeviceBootloader.hpp:29
dai::DeviceInfo
Definition: XLinkConnection.hpp:27
dai::logger::info
void info(const FormatString &fmt, Args &&...args)
Definition: Logging.hpp:78
depthai.hpp
dai::DeviceBootloader::getFirstAvailableDevice
static std::tuple< bool, DeviceInfo > getFirstAvailableDevice()
Definition: DeviceBootloader.cpp:48
dai::DeviceBootloader::flashCustom
std::tuple< bool, std::string > flashCustom(Memory memory, size_t offset, const std::vector< uint8_t > &data, std::function< void(float)> progressCb=nullptr)
Definition: DeviceBootloader.cpp:1112


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19