This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840dongle_nrf52840 CONFIG_BOOTLOADER_MCUBOOT=y partition to small

Hi,

when I build the nrf52840dongle_nrf52840 target I r

Memory region         Used Size  Region Size  %age Used
          FLASH:       53236 B        48 KB    108.31%
           SRAM:         29 KB       256 KB     11.33%
       IDT_LIST:          88 B         2 KB      4.30

/opt/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld:
zephyr/zephyr_prebuilt.elf section `text' will not fit in region `FLASH'

build target nrf52840dk_nrf52840 has no problem.

174/179] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
          FLASH:       34876 B        48 KB     70.96%
           SRAM:       19392 B       256 KB      7.40%
       IDT_LIST:          88 B         2 KB      4.30%

I tried for the simple blinky application to double check it.

Run my development on  nRF Connect SDK 1.5.1

Any hints?

Chris

  • Hi,

    The error here comes from trying to make the bootloader fit, not the application itself (for instance blinky). The nRF52840 dongle ships with a USB bootloader, so unless you use a external debugger with it it is not straight-forward to test it with MCUBoot (then you would adapt it to use multiple stages, both the nRF5 SDK USB bootloader and then MCUBoot). So in short the 840 dongle is not well suitable for this.

  • Hi Einar,

    Oh what you told me here make sense, and from the MCUBoot "documentation" the MCUBoot should be the 1st stage boot-loader and not queued up after the USB loader.

    Thanks
    Chris :wq

  • In fact, the mcuboot can support 5840 dongle.

    This zephyr document shows how to build mcuboot for 52840 dongle, but it not work in NCS. I'll explain next.

    The `fstab-stocks.dts` file in `zephyr/boards/arm/nrf52840dongle_nrf52840` shows the partitions, the mcuboot need 60kB (0xf000) flash because it needs USB stack. And must reserve the region in `0xe0000 ~ 0xfffff` for nrf5 USB bootloader.

    But in NCS, the Partition Manager takes place of the partitions in `.dts‵ file, and the default size for mcuboot is 48kB (0xc000), which is not enough. You can check this information in `nrf/modules/mcuboot/boot/zephyr/Kconfig:32`

    To solve this problem, follow the steps below:

    1. open the `child_image/mcuboot.conf` file in your project. If it not exists, just create one:

    2. add `CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xf000` to mcuboot.conf

    3. add configurations to prj.conf

    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    
    # set FLASH_SIZE=0xe0000 (896 KB), to reserve the nrf5 bootloader space
    CONFIG_FLASH_SIZE=896

    4. now you can build and see the memory report, the size for mcuboot is 60KB, and the end address is 0xdffff 

    5. generate DFU package and download. Make sure the red led is blinking, which means it is running the nrf5 USB bootloader.

    nrfutil pkg generate --hw-version 52 --sd-req=0x00 \
     --application build/zephyr/merged.hex --application-version 1 build/zephyr/merged.zip
     
    nrfutil dfu usb-serial -pkg build/zephyr/merged.zip -p /dev/ttyACM0

    6. After download, re-plug the dongle. And the application will be chain load. 

    Notes:

    1. to enter nrf5 bootloader, just click the reset button, and you will see the red led blink.

    2. to enter mcuboot recovery mode, plug in with the SW1 pressed and hold for a few seconds.

    3. to run the application, just plug in the dongle.

Related