Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OwnTech
Bootloader
Commits
e3ff1753
Commit
e3ff1753
authored
May 03, 2021
by
Wouter Cappelle
Committed by
David Brown
Feb 22, 2022
Browse files
Add support for the mcumgr echo command in serial boot mode
Signed-off-by:
Wouter Cappelle
<
wouter.cappelle@crodeon.com
>
parent
d8eff810
Changes
4
Hide whitespace changes
Inline
Side-by-side
boot/boot_serial/src/boot_serial.c
View file @
e3ff1753
...
...
@@ -470,6 +470,38 @@ out:
#endif //#ifdef MCUBOOT_ENC_IMAGES
}
#ifdef MCUBOOT_BOOT_MGMT_ECHO
static
bool
decode_echo
(
cbor_state_t
*
state
,
cbor_string_type_t
*
result
)
{
size_t
bsstrdecoded
;
int
ret
;
if
(
!
map_start_decode
(
state
))
{
return
false
;
}
ret
=
multi_decode
(
2
,
2
,
&
bsstrdecoded
,
(
void
*
)
tstrx_decode
,
state
,
result
,
sizeof
(
cbor_string_type_t
));
map_end_decode
(
state
);
return
ret
;
}
static
void
bs_echo
(
char
*
buf
,
int
len
)
{
size_t
bsstrdecoded
;
cbor_string_type_t
str
[
2
];
if
(
entry_function
((
const
uint8_t
*
)
buf
,
len
,
str
,
&
bsstrdecoded
,
(
void
*
)
decode_echo
,
1
,
2
))
{
map_start_encode
(
&
cbor_state
,
10
);
tstrx_put
(
&
cbor_state
,
"r"
);
tstrx_encode
(
&
cbor_state
,
&
str
[
1
]);
map_end_encode
(
&
cbor_state
,
10
);
boot_serial_output
();
}
}
#endif
/*
* Send rc code only.
*/
...
...
@@ -547,6 +579,11 @@ boot_serial_input(char *buf, int len)
}
}
else
if
(
hdr
->
nh_group
==
MGMT_GROUP_ID_DEFAULT
)
{
switch
(
hdr
->
nh_id
)
{
case
NMGR_ID_ECHO
:
#ifdef MCUBOOT_BOOT_MGMT_ECHO
bs_echo
(
buf
,
len
);
#endif
break
;
case
NMGR_ID_CONS_ECHO_CTRL
:
bs_rc_rsp
(
0
);
break
;
...
...
boot/boot_serial/src/boot_serial_priv.h
View file @
e3ff1753
...
...
@@ -48,6 +48,7 @@ extern "C" {
#define MGMT_GROUP_ID_IMAGE 1
#define MGMT_GROUP_ID_PERUSER 64
#define NMGR_ID_ECHO 0
#define NMGR_ID_CONS_ECHO_CTRL 1
#define NMGR_ID_RESET 5
...
...
boot/zephyr/Kconfig
View file @
e3ff1753
...
...
@@ -583,6 +583,11 @@ config BOOT_ERASE_PROGRESSIVELY
on some hardware that has long erase times, to prevent long wait
times at the beginning of the DFU process.
config BOOT_MGMT_ECHO
bool "Enable echo command"
help
if enabled, support for the mcumgr echo command is being added.
menuconfig ENABLE_MGMT_PERUSER
bool "Enable system specific mcumgr commands"
help
...
...
boot/zephyr/include/mcuboot_config/mcuboot_config.h
View file @
e3ff1753
...
...
@@ -173,6 +173,10 @@
#define MCUBOOT_MGMT_CUSTOM_IMG_LIST
#endif
#ifdef CONFIG_BOOT_MGMT_ECHO
#define MCUBOOT_BOOT_MGMT_ECHO
#endif
#ifdef CONFIG_BOOT_IMAGE_ACCESS_HOOKS
#define MCUBOOT_IMAGE_ACCESS_HOOKS
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment