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

nrf52811: Zephyr with MCUboot

Hi,

I am trying to create and FOTA upgradable application on the nrf52811 SoC. I have managed to do the same for nrf52832, but when I repeated the process for nrf52811 it seems that there is not enough memory. Here is the build output after running the command west build -b nrf52811_pca10056:

> Executing task in folder peripheral_uart: source /home/voja/.virtualenvs/zephyenv/bin/activate; west build -b nrf52811_pca10056 -d build/nrf52811_pca10056_app <

-- west build: build configuration:
       source directory: /home/voja/Documents/irnas/zephyr_tests/peripheral_uart
       build directory: /home/voja/Documents/irnas/zephyr_tests/peripheral_uart/build/nrf52811_pca10056_app
       BOARD: nrf52811_pca10056 (origin: CMakeCache.txt)
-- west build: building application
[1/256] Preparing syscall dependency handling

[12/256] Performing build step for 'mcuboot_subimage'
[1/1] Linking C executable zephyr/zephyr.elf
[43/256] Building C object CMakeFiles/app.dir/src/main.c.obj
../../src/main.c:299:13: warning: 'bt_ready' defined but not used [-Wunused-function]
 static void bt_ready(int err)
             ^~~~~~~~
../../src/main.c:284:13: warning: 'advertise' defined but not used [-Wunused-function]
 static void advertise(struct k_work *work)
             ^~~~~~~~~
[247/256] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf 
: && ccache /home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc    zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj  -o zephyr/zephyr_prebuilt.elf  -Wl,-T  zephyr/linker.cmd  -Wl,-Map=/home/voja/Documents/irnas/zephyr_tests/peripheral_uart/build/nrf52811_pca10056_app/zephyr/zephyr_prebuilt.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/libarch__arm__core__aarch32__cortex_m__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a  zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a  zephyr/subsys/bluetooth/controller/libsubsys__bluetooth__controller.a  zephyr/subsys/fs/libsubsys__fs.a  zephyr/subsys/mgmt/libsubsys__mgmt.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/random/libsubsys__random.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/entropy/libdrivers__entropy.a  modules/nrf/lib/dk_buttons_and_leds/lib..__nrf__lib__dk_buttons_and_leds.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/mcumgr/lib..__modules__lib__mcumgr.a  modules/tinycbor/lib..__modules__lib__tinycbor.a  modules/nordic/lib..__modules__hal__nordic.a  modules/littlefs/lib..__modules__fs__littlefs.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/thumb/v7e-m/nofp"  -L/home/voja/Documents/irnas/zephyr_tests/peripheral_uart/build/nrf52811_pca10056_app/zephyr  -lgcc  -Wl,--print-memory-usage  -mthumb  -mcpu=cortex-m4  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -no-pie  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -mabi=aapcs  -march=armv7e-m && :
Memory region         Used Size  Region Size  %age Used
           FLASH:      194652 B      60928 B    319.48%
            SRAM:       34160 B        24 KB    139.00%
        IDT_LIST:         136 B         2 KB      6.64/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: zephyr/zephyr_prebuilt.elf section `text' will not fit in region `FLASH'
/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: zephyr/zephyr_prebuilt.elf section `noinit' will not fit in region `SRAM'
/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: section .intList VMA [0000000020006000,0000000020006087] overlaps section noinit VMA [0000000020002e20,00000000200078bb]
/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 133724 bytes
/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: region `SRAM' overflowed by 9584 bytes
collect2: error: ld returned 1 exit status
%
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/voja/Documents/irnas/zephyr_tests/peripheral_uart/build/nrf52811_pca10056_app
The terminal process terminated with exit code: 1

So is there enough space on the nrf52811 to do such a thing?
If it is what are the changes needed to be made so it can compile?

I saw a similar question a while back on the devzone: link but then you did not support nrf52 series in the NCS.

Best regards,
Vojislav

  • Hi,

     

    You're overflowing flash by ~133 kB.

     

    So is there enough space on the nrf52811 to do such a thing?

    Technically, yes. It is space enough to do it, but it will highly depend on your image size.

    If you take a small example, like hello_world, configure it to the nrf52811_pca10056 board, then apply these settings:

     

    CONFIG_FLASH=y
    CONFIG_IMG_MANAGER=y
    CONFIG_BOOTLOADER_MCUBOOT=y

     

    You can then build and run the command "ninja rom_report" in the build folder and get the flash layout back:

    [129/129] Running utility command for rom_report
    Partition Manager report
    FLASH (0x30000):
    +-----------------------------------------+
    | 0x0: mcuboot (0xc000)                   |
    +---0xc000: mcuboot_primary (0x12000)-----+
    | 0xc000: mcuboot_pad (0x200)             |
    +---0xc200: mcuboot_primary_app (0x11e00)-+
    | 0xc200: app (0x11e00)                   |
    | 0x1e000: mcuboot_secondary (0x12000)    |
    +-----------------------------------------+
    

    If it is what are the changes needed to be made so it can compile?

     As showed above, if you can get your application down to ~71kB flash, then you can run dual bank with the current mcuboot setup. However; there is not many applications that fits within this size

     

    Kind regards,

    Håkon

  • Hi Håkon,

    Thank you for your reply and suggestions. 
    What I need to do is to create an application similar to peripherial_uart, and when adding MCUBoot to that application I get a memory problem which is a clear sign to me that my application won't fit. 

    Still, I will run the tests you recommended and get back to you with my rom_report. 

    Best regards,
    Vojislav. 

  • As I can see from testing even peripherial_uart application without the MCUboot cannot fit the nRF52811 because of the SRAM constraint: 

    Memory region         Used Size  Region Size  %age Used
               FLASH:      148128 B       192 KB     75.34%
                SRAM:       25912 B        24 KB    105.44%
            IDT_LIST:         136 B         2 KB      6.64/home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: zephyr/zephyr_prebuilt.elf section `datas' will not fit in region `SRAM'
    /home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: section .intList VMA [0000000020006000,0000000020006087] overlaps section datas VMA [0000000020005c28,0000000020006211]
    /home/voja/Documents/gcc-arm-none-eabi-8-2019-q3-update/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: region `SRAM' overflowed by 1336 bytes
    collect2: error: ld returned 1 exit status
    


    I suppose these examples need to be further optimised on your side? 

  • Hi,

     

    Yes, There is an overflow in RAM by default when trying to target nrf52811/nrf52810, which is unfortunate, likely due to asymmetrical security, storing bond information, logging, and SeggerRTT printing being enabled. We do indeed have some optimization to do here. I'll report this internally.

     

    The sample still requires more flash than what can be fit into a image with mcuboot support, unfortunately.

     

    Kind regards,

    Håkon

  • Håkon, Thank you for your support.

    Best regards,
    Vojislav.

Related