nuttx-apps/boot/nxboot/Kconfig

160 lines
5.1 KiB
Text
Raw Normal View History

boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig BOOT_NXBOOT
bool "NuttX bootloader"
default n
select BCH
---help---
Enable support for the minimal NuttX based bootloader.
if BOOT_NXBOOT
config NXBOOT_PRIMARY_SLOT_PATH
string "Application firmware primary image slot path"
default "/dev/ota0"
---help---
The path to the application firmware image primary slot character
device driver. The image runs from this location.
Default: /dev/ota0
config NXBOOT_SECONDARY_SLOT_PATH
string "Application firmware secondary image slot path"
default "/dev/ota1"
---help---
The path to the application firmware image primary slot character
device driver. This is either update or recovery slot.
Default: /dev/ota1
config NXBOOT_TERTIARY_SLOT_PATH
string "Application firmware tertiary image slot path"
default "/dev/ota2"
---help---
The path to the application firmware image primary slot character
device driver. This is either update or recovery slot.
Default: /dev/ota2
config NXBOOT_HEADER_SIZE
hex "Application firmware image header size"
default 0x200
---help---
The nxboot bootloader itself requires only a few bytes of header
data. Increase this value, if you need to store additional
application-specific meta data.
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
Note that this size should be aligned with the program memory write
page size!
config NXBOOT_PLATFORM_IDENTIFIER
hex "A unique platform identifier"
default 0x0
---help---
This is a unique platform identifier used by the bootloader to
verify whether the image should be run on a given platform. An update
(or even a firmware uploaded via a programmer) is rejected if the
value in image's header doesn't match this option.
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
config NXBOOT_BOOTLOADER
bool "Build nxboot bootloader application"
default n
select BOARDCTL
select BOARDCTL_BOOT_IMAGE
---help---
This option builds and links a bootloader application. This application
("nxboot_loader_main") should be the entry function for NuttX.
It checks for a possible update/revert operation, performs it and boots
the correct image.
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
if NXBOOT_BOOTLOADER
config NXBOOT_COPY_TO_RAM
bool "Copy bootable image to RAM before calling board boot-image function"
default n
---help---
The is a board and/or arch specific option that may be used when running
directly from flash, especially if external flash, even in XIP mode, is too
slow.
Running from RAM usually results in faster execution but the board must, of
course, have sufficient RAM available for the application image, stack
and heap.
config NXBOOT_RAMSTART
hex "Start address in RAM that the application is to be loaded"
default 0x0
depends on NXBOOT_COPY_TO_RAM
---help---
This will be board specific. A check of the board's linker script
may be informative. For example the SAMA5D2-XULT eval board's uboot
linker script - boards/arm/sama5/sama5d2-xult/scripts/uboot.ld - has:
sdram (W!RX) : ORIGIN = 0x20008000, LENGTH = 256M - 32K
This shows the load address to be 0x20008000 and would be the address
to use here if the same linker script is to be be used for NXboot.
Typically the address is the base address of the RAM to be used, plus the
size of the NXboot image itself. The example above has reserved
32KiB (0x8000) for this from the 256MiB available on the board at
address 0x20000000.
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
config NXBOOT_SWRESET_ONLY
bool "Perform update/revert only on SW reset"
default n
select BOARDCTL_RESET_CAUSE
---help---
This option ensures the update/revert is performed only for following
reset causes:
BOARDIOC_RESETCAUSE_CPU_SOFT: software reset
BOARDIOC_RESETCAUSE_CPU_RWDT: watchdog error
BOARDIOC_RESETCAUSE_PIN: reset button
This way the board can keep its image (even if not confirmed) during
for example power shutdown and perform update/revent only if expected
based on user/maintainer input.
config NXBOOT_PREVENT_DOWNGRADE
bool "Perform update only for newer version"
default n
---help---
NXboot uses Semantic Version 2.0.0 (without build metadata). By default
the update is performed for every version that doesn't match the
currently running one. If NXBOOT_PREVENT_DOWNGRADE selected, update is
performed only for newer versions (according to Semantic Version
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
preference rules).
WARNING: NXboot currently implements preferences only for
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
MAJOR.MINOR.PATCH and ignores prerelease.
config NXBOOT_PROGRESS
bool
default n
config NXBOOT_PRINTF_PROGRESS
bool "Enable progress messages to be sent to STDOUT"
default y
select NXBOOT_PROGRESS
---help---
This will display progress during typically lengthy operations:
- Calculating checksums
- copying images between slots
Note: the NXboot binary will be approximately 2KiB larger with this enabled.
choice
prompt "Choose preferred progress indication type"
depends on NXBOOT_PRINTF_PROGRESS
default NXBOOT_PRINTF_PROGRESS_PERCENT
config NXBOOT_PRINTF_PROGRESS_DOTS
bool "Display progress using sequential dots"
config NXBOOT_PRINTF_PROGRESS_PERCENT
bool "Display progress using percentage remaining"
endchoice
boot: add NuttX bootloader with update and recovery support This commit adds NuttX based bootloader with the support for image update and recovery if not confirmed. The algorithm utilizes three flash partitions: primary (image runs from this area), secondary and tertiary. Secondary and tertiary areas are used for update upload and recovery. The update is performed by simple copy from update area to primary area with recovery being created in recovery area if not already present. Once image is confirmed by the user, the image in update area is confirmed as well, update area becomes recovery area and vice versa. This means the recovery is always present (except for the first update) and subsequent updates just copy image from update to primary. This makes the update significantly faster and more considerable to flash wear while keeping the recovery/revert possibility. A header (aligned to flash's erase size) must be added to the beginning of the image. Python script nximage.py can be used to prepend this header to built binary. The algorithm also uses one erase page at the end of a partition (partition, not image!) to store flags used to indicate image confirm status and to detect update/recovery partitions. Any program uploading update image to the update partition has to erase this page for the boot to work correctly! The algorithm implementation is based on a patch initially developed for MCUboot project but rejected by the project's maintainers https://github.com/mcu-tools/mcuboot/pull/1902 Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-20 20:48:58 +02:00
endif # NXBOOT_BOOTLOADER
endif # BOOT_NXBOOT