nrf52840 bootloader questions

Hi Devzone,

I am building an application for a nrf52840 mounted on a custom board. I wanted to implement the DFU functionality, and I have a few general questions, as well as some issues implementing it.

Questions: 

  1. From what I gather, BLE DFU can only be done using MCUBoot as bootloader, am I correct ?
  2. There is a LTE module mounted on the board, communicating with the nrf52840 via UART. Is MCUBoot capable of receiving an update sent via LTE ?
  3. Since I want to be able to update the bootloader if needed, I wanted to implement a 2 stage bootloader chain. Following the instructions here: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/config_and_build/bootloaders/bootloader_adding.html, this can be done by enabling the CONFIG_SECURE_BOOT and CONFIG_BOOTLOADER_MCUBOOT options in the app prj.conf file. From my understanding, Zephyr’s sysbuild can be used to handle multi-image builds, so it could be suited to handle the two bootloader and application images. Are there benefits to doing it one way or the other ?

Issues:

4. I first started to implement only the NSIB by adding CONFIG_SECURE_BOOT=y to my prj.conf file. Because I have no available UART to use as the console, I would like to use RTT to do the logging. This means that I have no zephyr,console defined in the chosen node of my board dts file, which leads to some errors, because the UART console seems to be enabled by default by the NSIB. I tried to disable the UART console by creating a child_image/b0.conf file:

CONFIG_UART_CONSOLE=n

However I get the following warning and errors:

warning: CONSOLE (defined at drivers/console/Kconfig:9) was assigned the value 'n' but got the value
'y'. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_CONSOLE and/or look up CONSOLE in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: UART_CONSOLE (defined at drivers/console/Kconfig:43) was assigned the value 'n' but got the
value 'y'. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_CONSOLE and/or look up
UART_CONSOLE in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.

In file included from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain.h:50,
                 from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/kernel_includes.h:23,
                 from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/kernel.h:17,
                 from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/console/uart_console.c:16:
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_CHOSEN_zephyr_console_ORD' undeclared here (not in a function)
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
  216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/console/uart_console.c:40:9: note: in expansion of macro 'DEVICE_DT_GET'
   40 |         DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
      |         ^~~~~~~~~~~~~
[105/139] Linking C static library modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a
[106/139] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/nrfx_glue.c.obj
ninja: build stopped: subcommand failed.
[146/402] Linking C static library zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a
FAILED: modules/nrf/samples/b0_subimage-prefix/src/b0_subimage-stamp/b0_subimage-build b0/zephyr/zephyr.hex b0/zephyr/zephyr.elf 
cd /home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build/b0 && /home/vboxuser/ncs/toolchains/7795df4459/usr/local/bin/cmake --build . --
[148/402] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/long_wq.c.obj
[149/402] Building C object zephyr/subsys/bluetooth/host/CMakeFiles/subsys__bluetooth__host.dir/data.c.obj
ninja: build stopped: subcommand failed.

Is there a way to disable the uart console and enable the RTT logs on the NSIB bootloader ?

Alternatively, can I send the bootloader logs to a USB connection ? I tried to get some inspiration from the USB console sample, but to no avail.

5. Also, when I compile my application without the bootloader, I get the following memory report at the end:

When I compile using the NSIB, I get the following two:

I imagine the first one refers to the NSIB, and the second one to my application. The application Flash region size in this case is much smaller than when compiling without the bootloader. I imagine it is used by the bootloader ? Is there a way to configure the size available for my program, and if so, what are the best practices with respect to sizes when using a single or 2 stage bootloader ?

6. In order to go a little further, I used a temporary uart as the chosen zephyr,console node. Doing this I could compile and flash my application, and it works fine. I then tried to add MCU Boot as the upgradable bootloader by adding CONFIG_BOOTLOADER_MCUBOOT=y in my prj.conf. This time, I I get the following error:

/home/vboxuser/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_124'

However, if I go to check the generated devicetree file, device n°124 corresponds to a spi node that otherwise works in my standalone application.

Do you have any pointers on what I can look into to solve this issue ?

Thanks in advance.

Nicolas Goualard

Parents
  • Hi Nicolas,

    I will need sometime working on your questions and will send you a reply next week.

    Best regards,

    Charlie

  • Hi Charlie, I am still having issues with the NSIB console, did you have a chance to look into this ?

    I did find a way to get past item n°6, and get a better understanding of item n°5. Thanks to this I could move forward, and I managed to do a DFU via BLE on my device, which is good!

    However it seems that the space dedicated to my application by the partition manager is rather small, so I wanted to use the external flash that is present on my board to move the mcuboot_secondary partition on there, and increase the size of the mcuboot primary and secondary partitions.

    In order to do that I followed the instructions here :
    https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/nrf/config_and_build/bootloaders/bootloader_external_flash.html

    and here:
    https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/nrf/scripts/partition_manager/partition_manager.html#pm-external-flash

    and I took inspiration from the SDK nrf/tests/modules/mcuboot/external_flash/ files.

    I added a child_image/mcuboot/prj.conf and child_image/mcuboot/boards/board.overlay files to my project:

    / {
    	chosen {
    		zephyr,pm-ext-flash = &w25q128;
    	};
    };
    

    # MCUboot requires a large stack size, otherwise an MPU fault will occur
    CONFIG_MAIN_STACK_SIZE=10240
    
    # Enable flash operations
    CONFIG_FLASH=y
    
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    

    I also added a pm_static.yaml file in my application root folder:

    mcuboot_secondary:
      address: 0x00000
      region: external_flash
      size: 0xda000

    However I get the following errors when building:

    FAILED: zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/zephyr_img_mgmt.c.obj 
    ccache /home/vboxuser/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DEXT_API_MAGIC=0x281ee6de,0xb845acea,13314 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,13314 -DKERNEL -DNRF52840_XXAA -DUSE_PARTITION_MANAGER=1 -DVALIDATION_INFO_MAGIC=0x281ee6de,0x86518483,78850 -DVALIDATION_POINTER_MAGIC=0x281ee6de,0x6919b47e,78850 -DZCBOR_ASSERTS -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/drivers/mpsl/clock_control -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build/zephyr/include/generated -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/lib/libc/newlib/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/common/nordic_nrf/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/common/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/util/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/transport/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/usb/device -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/bluetooth -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/settings/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/usb/common/nrf_usbd_common/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include/shared_types -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/lib/BMI270/BMI270 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/lib/multithreading_lock/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/subsys/bluetooth/controller/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/flash -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/tests/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/cmsis/CMSIS/Core/Include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/modules/cmsis/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/lib/cmsis-dsp/Include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/drivers/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/mdk -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/modules/hal_nordic/nrfx/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/debug/segger/SEGGER -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/debug/segger/Config -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/crypto/tinycrypt/lib/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/lib/zcbor/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/common/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/nrf21540_gpio/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/simple_gpio/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/include/protocol -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/include/protocol -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/softdevice_controller/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/.. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/../include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/lib/libc/common/include -isystem /home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/crypto/nrf_cc310_platform/include -Wshadow -fno-strict-aliasing -Os -imacros /home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=/home/vboxuser/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/zephyr_img_mgmt.c.obj -MF zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/zephyr_img_mgmt.c.obj.d -o zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/zephyr_img_mgmt.c.obj -c /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c
    In file included from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/storage/flash_map.h:275,
                     from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:10:
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c: In function 'img_mgmt_flash_area_id':
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:43:22: error: 'PM_mcuboot_secondary_ID' undeclared (first use in this function); did you mean 'PM_mcuboot_primary_ID'?
       43 | #define PM_ID(label) PM_##label##_ID
          |                      ^~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:48:35: note: in expansion of macro 'PM_ID'
       48 | #define FIXED_PARTITION_ID(label) PM_ID(label)
          |                                   ^~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:139:25: note: in expansion of macro 'FIXED_PARTITION_ID'
      139 |                 fa_id = FIXED_PARTITION_ID(SLOT1_PARTITION);
          |                         ^~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:43:22: note: each undeclared identifier is reported only once for each function it appears in
       43 | #define PM_ID(label) PM_##label##_ID
          |                      ^~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:48:35: note: in expansion of macro 'PM_ID'
       48 | #define FIXED_PARTITION_ID(label) PM_ID(label)
          |                                   ^~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c:139:25: note: in expansion of macro 'FIXED_PARTITION_ID'
      139 |                 fa_id = FIXED_PARTITION_ID(SLOT1_PARTITION);
          |                         ^~~~~~~~~~~~~~~~~~
    [182/1093] Building C object zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj
    FAILED: zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj 
    ccache /home/vboxuser/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DEXT_API_MAGIC=0x281ee6de,0xb845acea,13314 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,13314 -DKERNEL -DNRF52840_XXAA -DUSE_PARTITION_MANAGER=1 -DVALIDATION_INFO_MAGIC=0x281ee6de,0x86518483,78850 -DVALIDATION_POINTER_MAGIC=0x281ee6de,0x6919b47e,78850 -DZCBOR_ASSERTS -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/drivers/mpsl/clock_control -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build/zephyr/include/generated -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/lib/libc/newlib/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/common/nordic_nrf/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/soc/arm/nordic_nrf/common/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/util/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/transport/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/usb/device -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/bluetooth -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/settings/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/usb/common/nrf_usbd_common/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/include/shared_types -I/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/lib/BMI270/BMI270 -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/lib/multithreading_lock/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/subsys/bluetooth/controller/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/drivers/flash -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/tests/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/cmsis/CMSIS/Core/Include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/modules/cmsis/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/lib/cmsis-dsp/Include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/drivers/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/hal/nordic/nrfx/mdk -I/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/modules/hal_nordic/nrfx/. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/debug/segger/SEGGER -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/debug/segger/Config -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/crypto/tinycrypt/lib/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/modules/lib/zcbor/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/common/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/nrf21540_gpio/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/simple_gpio/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/fem/include/protocol -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/mpsl/include/protocol -I/home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/softdevice_controller/include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/.. -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/../include -I/home/vboxuser/Documents/eqs-motion-s-zephyr/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/lib/libc/common/include -isystem /home/vboxuser/Documents/eqs-motion-s-zephyr/nrfxlib/crypto/nrf_cc310_platform/include -Wshadow -fno-strict-aliasing -Os -imacros /home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=/home/vboxuser/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/vboxuser/Documents/eqs-motion-s-zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj -MF zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj.d -o zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj -c /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c
    In file included from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sys/util_macro.h:34,
                     from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sys/util.h:17,
                     from /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:8:
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c: In function 'img_mgmt_active_slot':
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:52:18: error: 'PM_PM_PM_mcuboot_secondary_ID_LABEL_OFFSET' undeclared (first use in this function)
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |                  ^~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in definition of macro 'UTIL_PRIMITIVE_CAT'
      105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
          |                                    ^
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:52:9: note: in expansion of macro 'UTIL_CAT'
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |         ^~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:55:39: note: in expansion of macro 'FIXED_PARTITION_DATA_FIELD'
       55 | #define FIXED_PARTITION_OFFSET(label) FIXED_PARTITION_DATA_FIELD(label, _OFFSET)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:50:10: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
       50 |         (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET))
          |          ^~~~~~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:164:13: note: in expansion of macro 'FIXED_PARTITION_IS_RUNNING_APP_PARTITION'
      164 |         if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:52:18: note: each undeclared identifier is reported only once for each function it appears in
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |                  ^~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in definition of macro 'UTIL_PRIMITIVE_CAT'
      105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
          |                                    ^
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:52:9: note: in expansion of macro 'UTIL_CAT'
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |         ^~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/nrf/include/flash_map_pm.h:55:39: note: in expansion of macro 'FIXED_PARTITION_DATA_FIELD'
       55 | #define FIXED_PARTITION_OFFSET(label) FIXED_PARTITION_DATA_FIELD(label, _OFFSET)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:50:10: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
       50 |         (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET))
          |          ^~~~~~~~~~~~~~~~~~~~~~
    /home/vboxuser/Documents/eqs-motion-s-zephyr/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:164:13: note: in expansion of macro 'FIXED_PARTITION_IS_RUNNING_APP_PARTITION'
      164 |         if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /home/vboxuser/ncs/toolchains/2be090971e/usr/local/bin/cmake --build /home/vboxuser/Documents/eqs-motion-s-zephyr/eqs-motion-s-zephyr.git/app/build

    For reference, here is what my prj.conf looks like:

    # This file contains selected Kconfig options for the application.
    
    CONFIG_BOOT_DELAY=2000
    
    # Enable hardware stack protection
    CONFIG_HW_STACK_PROTECTION=y
    
    # enable GPIO and PWM
    CONFIG_GPIO=y
    CONFIG_PWM=y
    
    # enable uart driver
    CONFIG_SERIAL=y
    
    # additional board options
    CONFIG_GPIO_AS_PINRESET=n
    
    CONFIG_PINCTRL=y
    
    # Config for Immutable Secure Bootloader
    CONFIG_SECURE_BOOT=y
    
    # Config for Upgradable Bootloader
    CONFIG_BOOTLOADER_MCUBOOT=y
    # Include MCUMGR and the dependencies in the build
    # This KConfig option enables a lot of other stuff in the background. See https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU for more details.
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    # Enable hooks to allow the application to be notified of DFU events
    CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
    CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y
    
    # enabling State Machine Framework
    CONFIG_SMF=y
    CONFIG_SMF_ANCESTOR_SUPPORT=y
    
    # enable Hardware info
    CONFIG_HWINFO=y
    CONFIG_HWINFO_NRF=y
    CONFIG_TEMP_NRF5=y
    
    # Enabling FPU
    CONFIG_FPU=y
    
    # enable ADC
    CONFIG_ADC=y
    CONFIG_ADC_NRFX_SAADC=y
    
    # enable SPI
    CONFIG_SPI=y
    CONFIG_NORDIC_QSPI_NOR=y
    
    # enabling Bluetooth
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Zephyr"
    CONFIG_BT_DEVICE_APPEARANCE=5184
    # 5184 means Generic Outdoor Sports Activity. Complete list of appearance values can be found on the Bluetooth website under "assigned values" : https://www.bluetooth.com/specifications/assigned-numbers/
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    #Config for enabling changing ble name 
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    
    
    # enabling bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # enabling BAS service and HRS service
    CONFIG_BT_BAS=y
    CONFIG_BT_HRS=y
    
    #Enable Power Off of the device
    CONFIG_POWEROFF=y
    CONFIG_PM_DEVICE=y
    
    # USB
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Device"
    CONFIG_USB_DEVICE_PID=0x0001
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    CONFIG_UART_LINE_CTRL=y
    
    # Enable assertions
    CONFIG_ASSERT=y
    
    # Enable the UART driver (for the BG77 UART?)
    CONFIG_UART_ASYNC_API=n
    CONFIG_SERIAL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_NRFX_UARTE0=y
    
    # Enbale Ring Buffer
    CONFIG_RING_BUFFER=y
    
    # Config for enabling newlib C
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    
    # enable CMSIS for DSP library
    CONFIG_CMSIS_DSP=y
    
    # Config for enabling ZBus
    CONFIG_ZBUS=y
    CONFIG_ZBUS_MSG_SUBSCRIBER=y
    CONFIG_HEAP_MEM_POOL_SIZE=1024
    CONFIG_ZBUS_MSG_SUBSCRIBER_NET_BUF_POOL_SIZE=32
    CONFIG_ZBUS_CHANNEL_NAME=y
    #CONFIG_ZBUS_OBSERVER_NAME=y
    
    CONFIG_THREAD_NAME=y
    CONFIG_DEBUG_THREAD_INFO=y
    
    # Stack sizes:
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_MAIN_STACK_SIZE=4096
    
    # Enable MBED TFM PSA for hash and crypto
    CONFIG_MBEDTLS=y
    CONFIG_MBEDTLS_BUILTIN=y
    CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
    CONFIG_MBEDTLS_ENTROPY_ENABLED=y
    CONFIG_MBEDTLS_PSA_CRYPTO_C=y
    CONFIG_MBEDTLS_ZEPHYR_ENTROPY=y
    
    #Config clock 
    CONFIG_CLOCK_CONTROL=y
    

    and my board .dts relevant (I think) parts:

    / {
    	chosen {
    		/*zephyr,console = &uart0;*/
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    		zephyr,pm-ext-flash = &w25q128;
    	};
    };
    
    ...
    
    &qspi {
    	status = "okay";
    	pinctrl-0 = <&qspi_default>;
    	pinctrl-1 = <&qspi_sleep>;
    	pinctrl-names = "default", "sleep";
    	
    	w25q128: w25q128fw@0{
    		compatible = "nordic,qspi-nor";
    		reg = <0>;
    		/* W25Q128 supports all readoc options */
    		readoc = "read4io";
    		sck-frequency = <8000000>;
    		jedec-id = [ef 60 18]; //ef 60 18
    		size = <0x8000000>;
    		has-dpd;
    		t-enter-dpd = <3000>;
    		t-exit-dpd = <1800>;
    	};
    };
    

    It looks to me like something is wrong in my configuration as slot1_partition does not seem to be recognized. Do you have an idea what could be wrong please ?

    In addition to that, I have another question: on my board, the external flash power is controlled by a GPIO of the nrf52840. I have a SYS_INIT call to a function that enables the power of the external flash before the spi communication starts, otherwise the JEDEC-ID could not be properly read at startup.
    If I move a partition from the nrf52840 internal flash to this external flash, I imagine the bootloader will need to power the flash to have access to the partition ? Can you confirm this ? I saw the regulator-fixed compatible, which has a regulator-always-on property. Can this be used to enable the bootloader to power the flash ?

    Thanks in advance for your help.
    Nicolas Goualard

  • Hi Nicolas,

    Sorry for the late reply. We are short of staff due to the summer vacation period.

    1)

    From what I gather, BLE DFU can only be done using MCUBoot as bootloader, am I correct ?

    Yes, Mcuboot is the only supported bootload for SMP in NCS.

    2)

    There is a LTE module mounted on the board, communicating with the nrf52840 via UART. Is MCUBoot capable of receiving an update sent via LTE ?

    It is possible, but there is no solution you can use directly. See the discussion in another ticket. Firmware update through UART with other microcontroller (Not PC or Mobile tools) - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

    3)

    Since I want to be able to update the bootloader if needed, I wanted to implement a 2 stage bootloader chain. Following the instructions here: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/config_and_build/bootloaders/bootloader_adding.html, this can be done by enabling the CONFIG_SECURE_BOOT and CONFIG_BOOTLOADER_MCUBOOT options in the app prj.conf file. From my understanding, Zephyr’s sysbuild can be used to handle multi-image builds, so it could be suited to handle the two bootloader and application images. Are there benefits to doing it one way or the other ?

    From the recently released NCS v2.7.0, the previous method to define multi-image builds (parent-child images) is deprecated and being replaced by Sysbuild (System build). According to Migrating from multi-image builds to sysbuild (nordicsemi.com) guidance, it has the following features/benifites:

    • Sysbuild controls which images are added to a build, instead of the main application.

    • Sysbuild specifies the project configuration files for all images, which was previously done in the main application or child applications.

    • Sysbuild controls the packaging of firmware components, instead of the main application.

    • Sysbuild manages some software functionality of image builds, such as the configuration mode of an nRF70-series radio.

    • Sysbuild runs partition manager code (if enabled) and distributes the output information to images.

    4)

    Is there a way to disable the uart console and enable the RTT logs on the NSIB bootloader ?

    Alternatively, can I send the bootloader logs to a USB connection ? I tried to get some inspiration from the USB console sample, but to no avail.

    Nicolas Goualard said:
    I am still having issues with the NSIB console, did you have a chance to look into this ?

    For RTT log output, I did a try but did not get NSIB RTT log output either. I will spend more time on this and give you an update later.

    For USB log output, you can refer to (+) Custom board DFU on USB port on VS Code - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com).

    5)

    I imagine the first one refers to the NSIB, and the second one to my application. The application Flash region size in this case is much smaller than when compiling without the bootloader. I imagine it is used by the bootloader ? Is there a way to configure the size available for my program, and if so, what are the best practices with respect to sizes when using a single or 2 stage bootloader ?

    Yes, this is so-called dual slots DFU, you need to reserve another solt same as you have assigned for your application firmware for safe DFU operation. You can configure the solt size of course.

    If you are talking about available size for your application program firmware, it is not related too much about single(NSIB or MCUboot) or two stage bootloader(MCUboot), because they are normally quite small size, but the single solt or dual slot DFU choice will matter. Both of them have pros and cons, the differences are introduced in the below page, you need to decide according to your needs.

    Device Firmware Update (DFU) essentials - Nordic Developer Academy (nordicsemi.com)

    However, if I go to check the generated devicetree file, device n°124 corresponds to a spi node that otherwise works in my standalone application.

    Do you have any pointers on what I can look into to solve this issue ?

    Nicolas Goualard said:
    It looks to me like something is wrong in my configuration as slot1_partition does not seem to be recognized. Do you have an idea what could be wrong please ?
    Nicolas Goualard said:
    If I move a partition from the nrf52840 internal flash to this external flash, I imagine the bootloader will need to power the flash to have access to the partition ? Can you confirm this ? I saw the regulator-fixed compatible, which has a regulator-always-on property. Can this be used to enable the bootloader to power the flash ?

    If you are going to use MCUboot with external flash, you can refer to this sample from my colleague: samples_for_nrf_connect_sdk/bootloader_samples/smp/mcuboot_smp_uart_feat_external_flash at main · hellesvik-nordic/samples_for_nrf_connect_sdk (github.com)

    Best regards,

    Charlie

Reply
  • Hi Nicolas,

    Sorry for the late reply. We are short of staff due to the summer vacation period.

    1)

    From what I gather, BLE DFU can only be done using MCUBoot as bootloader, am I correct ?

    Yes, Mcuboot is the only supported bootload for SMP in NCS.

    2)

    There is a LTE module mounted on the board, communicating with the nrf52840 via UART. Is MCUBoot capable of receiving an update sent via LTE ?

    It is possible, but there is no solution you can use directly. See the discussion in another ticket. Firmware update through UART with other microcontroller (Not PC or Mobile tools) - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

    3)

    Since I want to be able to update the bootloader if needed, I wanted to implement a 2 stage bootloader chain. Following the instructions here: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/config_and_build/bootloaders/bootloader_adding.html, this can be done by enabling the CONFIG_SECURE_BOOT and CONFIG_BOOTLOADER_MCUBOOT options in the app prj.conf file. From my understanding, Zephyr’s sysbuild can be used to handle multi-image builds, so it could be suited to handle the two bootloader and application images. Are there benefits to doing it one way or the other ?

    From the recently released NCS v2.7.0, the previous method to define multi-image builds (parent-child images) is deprecated and being replaced by Sysbuild (System build). According to Migrating from multi-image builds to sysbuild (nordicsemi.com) guidance, it has the following features/benifites:

    • Sysbuild controls which images are added to a build, instead of the main application.

    • Sysbuild specifies the project configuration files for all images, which was previously done in the main application or child applications.

    • Sysbuild controls the packaging of firmware components, instead of the main application.

    • Sysbuild manages some software functionality of image builds, such as the configuration mode of an nRF70-series radio.

    • Sysbuild runs partition manager code (if enabled) and distributes the output information to images.

    4)

    Is there a way to disable the uart console and enable the RTT logs on the NSIB bootloader ?

    Alternatively, can I send the bootloader logs to a USB connection ? I tried to get some inspiration from the USB console sample, but to no avail.

    Nicolas Goualard said:
    I am still having issues with the NSIB console, did you have a chance to look into this ?

    For RTT log output, I did a try but did not get NSIB RTT log output either. I will spend more time on this and give you an update later.

    For USB log output, you can refer to (+) Custom board DFU on USB port on VS Code - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com).

    5)

    I imagine the first one refers to the NSIB, and the second one to my application. The application Flash region size in this case is much smaller than when compiling without the bootloader. I imagine it is used by the bootloader ? Is there a way to configure the size available for my program, and if so, what are the best practices with respect to sizes when using a single or 2 stage bootloader ?

    Yes, this is so-called dual slots DFU, you need to reserve another solt same as you have assigned for your application firmware for safe DFU operation. You can configure the solt size of course.

    If you are talking about available size for your application program firmware, it is not related too much about single(NSIB or MCUboot) or two stage bootloader(MCUboot), because they are normally quite small size, but the single solt or dual slot DFU choice will matter. Both of them have pros and cons, the differences are introduced in the below page, you need to decide according to your needs.

    Device Firmware Update (DFU) essentials - Nordic Developer Academy (nordicsemi.com)

    However, if I go to check the generated devicetree file, device n°124 corresponds to a spi node that otherwise works in my standalone application.

    Do you have any pointers on what I can look into to solve this issue ?

    Nicolas Goualard said:
    It looks to me like something is wrong in my configuration as slot1_partition does not seem to be recognized. Do you have an idea what could be wrong please ?
    Nicolas Goualard said:
    If I move a partition from the nrf52840 internal flash to this external flash, I imagine the bootloader will need to power the flash to have access to the partition ? Can you confirm this ? I saw the regulator-fixed compatible, which has a regulator-always-on property. Can this be used to enable the bootloader to power the flash ?

    If you are going to use MCUboot with external flash, you can refer to this sample from my colleague: samples_for_nrf_connect_sdk/bootloader_samples/smp/mcuboot_smp_uart_feat_external_flash at main · hellesvik-nordic/samples_for_nrf_connect_sdk (github.com)

    Best regards,

    Charlie

Children
No Data
Related