Adding DFU to Peripheral UART example (NCS 2.9.0) - Flash Overflowed

Hello,

I have an application that I have been working on that was based off of the peripheral_uart example that I am using with the nRF52832. I was trying to see if I can add DFU support.  To add DFU support, I followed steps from the Lesson 9, Exercise 5 (FOTA over BLE) from the SDK Intermediate Course.  Initially I created a new example of the Peripheral UART example using NCS 2.9.0.  This built successfully. 

Memory region Used Size     Region Size   %age Used
FLASH: 244432 B                 480 KB             49.73%
RAM: 34820 B                       64 KB               53.13%
IDT_LIST: 0 GB                     32 KB               0.00%

I then tried to turn on the DFU by adding the following:
In sysbuild.conf, I added SB_CONFIG_BOOTLOADER_MCUBOOT=y

In prj.conf, I added CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

I see the following output:

[219/224] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/code/009-Nordic-projects/nrfconnect/peripheral_uart__ncs_2_9_0/build/peripheral_uart__ncs_2_9_0/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\b620d30767\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -Os -DNDEBUG -gdwarf-4 -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf -L"c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -lc -lgcc && cmd.exe /C "cd /D C:\code\009-Nordic-projects\nrfconnect\peripheral_uart__ncs_2_9_0\build\peripheral_uart__ncs_2_9_0\zephyr && C:\ncs\toolchains\b620d30767\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
c:/ncs/toolchains/b620d30767/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH' overflowed by 23840 bytes
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[5/15] No configure step for 'mcuboot'
FAILED: _sysbuild/sysbuild/images/peripheral_uart__ncs_2_9_0-prefix/src/peripheral_uart__ncs_2_9_0-stamp/peripheral_uart__ncs_2_9_0-build C:/code/009-Nordic-projects/nrfconnect/peripheral_uart__ncs_2_9_0/build/_sysbuild/sysbuild/images/peripheral_uart__ncs_2_9_0-prefix/src/peripheral_uart__ncs_2_9_0-stamp/peripheral_uart__ncs_2_9_0-build
cmd.exe /C "cd /D C:\code\009-Nordic-projects\nrfconnect\peripheral_uart__ncs_2_9_0\build\peripheral_uart__ncs_2_9_0 && C:\ncs\toolchains\b620d30767\opt\bin\cmake.exe --build ."
ninja: build stopped: subcommand failed.

******************************

My question is, is this failing to build the app (peripheral_uart) and then not even getting to the step of building the mcuboot application.  Is possible to just allocate more space for the peripheral_uart app? 

I did go through the intermediate course Lesson 9, Exercise 5 and was able to build the Bluetooth: Peripheral LBS sample successfully with mcuboot and able to update the firmware over BLE. 

Attached is a copy of the  Peripheral UART example that I used with SDK 2.9.0.

peripheral_uart__ncs_2_9_0.zip

*********************

When I try to build my application (without DFU) that is based on the peripheral UART (using SDK 2.7.0), I see the compilation size as:
Memory region Used Size     Region Size %age Used
FLASH: 369500 B                 504 KB         71.60%
RAM: 57008 B                      64 KB           86.99%
IDT_LIST: 0 GB                    32 KB           0.00%

 

If I then try to enable mcuboot with SB_CONFIG_BOOTLOADER_MCUBOOT=y in sysbuild.conf, the following error is generated:

FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/code/009-Nordic-projects/nrfconnect/peripheral_uart_stepper/build/peripheral_uart_stepper/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\ce3b5ff664\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\code\009-Nordic-projects\nrfconnect\peripheral_uart_stepper\build\peripheral_uart_stepper\zephyr && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `text' will not fit in region `FLASH'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH' overflowed by 136620 bytes
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[5/15] No configure step for 'mcuboot'

The flash is overflowed by a much larger value, 136620 bytes. 

I did go through the intermediate course Lesson 9, Exercise 5 and was able to build the Bluetooth: Peripheral LBS sample successfully with mcuboot and able to update the firmware over BLE.

Any suggestions on what I can modify so that I can use mcuboot to be able to perform a DFU?

Thanks.

Related