Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
b
c
d
e
h
i
l
m
n
p
r
s
u
x
Typedefs
b
c
d
e
f
g
i
m
p
r
u
v
Enumerations
Enumerator
a
b
f
g
i
m
n
r
s
u
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
m
n
p
q
r
s
t
u
v
x
Enumerations
a
c
d
e
f
k
l
m
p
r
s
t
v
w
Enumerator
a
b
d
f
g
h
i
l
m
n
o
p
r
s
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
b
c
d
e
f
g
m
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Macros
_
d
f
i
m
n
p
s
t
u
examples
bootloader
read_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 < 3) {
9
std::cout <<
"Usage: "
<< argv[0] <<
" offset size [filename]"
<< std::endl;
10
return
0;
11
}
12
size_t
offset = std::stoi(argv[1]);
13
size_t
size
= std::stoi(argv[2]);
14
std::string filename =
""
;
15
if
(argc == 4) {
16
filename = std::string{argv[3]};
17
}
18
19
// Find device and read memory
20
bool
res =
false
;
21
dai::DeviceInfo
info
;
22
std::tie(res,
info
) =
dai::DeviceBootloader::getFirstAvailableDevice
();
23
24
if
(res) {
25
std::cout <<
"Found device with name: "
<<
info
.name << std::endl;
26
dai::DeviceBootloader
bl(
info
);
27
28
auto
progress = [](
float
p) { std::cout <<
"Reading progress..."
<< p * 100 <<
"%"
<< std::endl; };
29
30
if
(filename.empty()) {
31
std::vector<uint8_t>
data
;
32
bl.
readCustom
(dai::DeviceBootloader::Memory::FLASH, offset,
size
,
data
, progress);
33
34
size_t
offset = 0;
35
36
while
(offset <
data
.size()) {
37
// Print as hex, 32B aligned
38
for
(
int
i = 0; i < 32; i++) {
39
if
(offset >=
data
.size()) {
40
break
;
41
}
42
printf(
"%02X "
,
data
[offset]);
43
offset++;
44
}
45
printf(
"\n"
);
46
}
47
48
}
else
{
49
bl.
readCustom
(dai::DeviceBootloader::Memory::FLASH, offset,
size
, filename, progress);
50
}
51
52
}
else
{
53
std::cout <<
"No devices found"
<< std::endl;
54
}
55
56
return
0;
57
}
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
main
int main(int argc, char **argv)
Definition:
read_flash_memory.cpp:7
DAI_SPAN_NAMESPACE_NAME::detail::data
constexpr auto data(C &c) -> decltype(c.data())
Definition:
span.hpp:177
depthai.hpp
DAI_SPAN_NAMESPACE_NAME::detail::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition:
span.hpp:167
dai::DeviceBootloader::getFirstAvailableDevice
static std::tuple< bool, DeviceInfo > getFirstAvailableDevice()
Definition:
DeviceBootloader.cpp:48
dai::DeviceBootloader::readCustom
std::tuple< bool, std::string > readCustom(Memory memory, size_t offset, size_t size, std::vector< uint8_t > &data, std::function< void(float)> progressCb=nullptr)
Definition:
DeviceBootloader.cpp:1190
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19