Loading boot/boot_serial/src/boot_serial.c +37 −0 Changes for boot/boot_serial/src/boot_serial.c: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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; Loading boot/boot_serial/src/boot_serial_priv.h +1 −0 Changes for boot/boot_serial/src/boot_serial_priv.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading boot/zephyr/Kconfig +5 −0 Changes for boot/zephyr/Kconfig: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading boot/zephyr/include/mcuboot_config/mcuboot_config.h +4 −0 Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading Loading
boot/boot_serial/src/boot_serial.c +37 −0 Changes for boot/boot_serial/src/boot_serial.c: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading @@ -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; Loading
boot/boot_serial/src/boot_serial_priv.h +1 −0 Changes for boot/boot_serial/src/boot_serial_priv.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading
boot/zephyr/Kconfig +5 −0 Changes for boot/zephyr/Kconfig: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading
boot/zephyr/include/mcuboot_config/mcuboot_config.h +4 −0 Changes for boot/zephyr/include/mcuboot_config/mcuboot_config.h: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -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 Loading