zephyr/boot_serial_extension: kconfig of custom command for get images status

made he command implementation selectable.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2021-07-29 16:22:52 +02:00
parent 1b62cf2c10
commit 420ad9adbd
3 changed files with 18 additions and 1 deletions

View File

@ -567,7 +567,7 @@ 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 ENABLE_MGMT_PERUSER
menuconfig ENABLE_MGMT_PERUSER
bool "Enable system specific mcumgr commands"
depends on BOOT_SERIAL_UART
help
@ -577,6 +577,14 @@ config ENABLE_MGMT_PERUSER
These are system specific command and system specific implementation
function is required to process these commands.
if ENABLE_MGMT_PERUSER
config BOOT_MGMT_CUSTOM_IMG_LIST
bool "Enable custom image list command"
help
The option enables command which returns versions and installation
statuses (custom property) for all images.
endif # ENABLE_MGMT_PERUSER
endif # MCUBOOT_SERIAL
config BOOT_INTR_VEC_RELOC

View File

@ -50,6 +50,7 @@ static int bs_custom_storage_erase(cbor_state_t *cs)
return rc;
}
#ifdef MCUBOOT_MGMT_CUSTOM_IMG_LIST
static int custom_img_status(int image_index, uint32_t slot,char *buffer,
ssize_t len)
{
@ -117,6 +118,8 @@ static int bs_custom_img_list(cbor_state_t *cs)
#ifndef ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST
#define ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST 1
#endif
#endif /*MCUBOOT_MGMT_CUSTOM_IMG_LIST*/
int bs_peruser_system_specific(const struct nmgr_hdr *hdr, const char *buffer,
int len, cbor_state_t *cs)
{
@ -128,9 +131,11 @@ int bs_peruser_system_specific(const struct nmgr_hdr *hdr, const char *buffer,
mgmt_rc = bs_custom_storage_erase(cs);
}
} else if (hdr->nh_op == NMGR_OP_READ) {
#ifdef MCUBOOT_MGMT_CUSTOM_IMG_LIST
if (hdr->nh_id == ZEPHYR_MGMT_GRP_BASIC_CMD_IMAGE_LIST) {
mgmt_rc = bs_custom_img_list(cs);
}
#endif
}
}

View File

@ -151,6 +151,10 @@
#define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0
#endif
#ifdef CONFIG_BOOT_MGMT_CUSTOM_IMG_LIST
#define MCUBOOT_MGMT_CUSTOM_IMG_LIST
#endif
/*
* The configuration option enables direct image upload with the
* serial recovery.