nrf52840dongle_nrf52840 Exceed Flash, with smp_svr sample

I have looked at forum_post_1forum_link_2 and forum_link_3.

In short, I am following instructions for my_dongle.

I have ncs 2.6.1.

I have clones of nordics git repos in the proj directory.
--

---mcuboot
 |
 +-zephyr


The mcuboot is 
> git remote -v
>     origin github.com/.../sdk-mcuboot (fetch)
> git status
>     On branch v2.0.99-ncs1-1

The zephyr branch is 
> git remote -v
>     github.com/.../sdk-zephyr (fetch)
> git status
>     On branch v3.599-ncs-1

Following instructions from my_dongle OPTION 2 I am able build mcuboot, and flash using nrfutil (Which btw needs instructions for the rust version that needs to install the pkg before use).

However when I get to the west build of the smp_svr it fails with 

/home/Spector/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/Spector/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 7768 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[204/223] Linking C static library zephyr/kernel/libkernel.a
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf /home/Spector/work/_play/dongle_play/dongle_smp_svr/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build /home/Spector/work/_play/dongle_play/dongle_smp_svr/mcuboot/zephyr/zephyr.hex /home/Spector/work/_play/dongle_play/dongle_smp_svr/mcuboot/zephyr/zephyr.elf


I get that some configuration tweaks are required in the board config files, but i'm concerned because i would have thought....that a tags version v2.6.1 would be working with the provided examples.

Is Nordic Semi using AI to write documentation? Has a human been involved in the loop testing it?

Is there a stable build i can just use without tweaking the "sample" files.

Regards,
Spector

  • Hello,

    My colleague, who is more experienced, will review this in the coming days, as he is currently swamped with other work.

    In the meantime, I would like to clarify a few points:

    1. The smp_server sample from Zephyr does not support the nRF52840 dongle out of the box. Some settings will need to be adjusted and updated.

    2. The nRF52840 dongle has a different memory layout compared to the development kit. You may need to modify the memory partitioning to accommodate the bootloader that comes pre-installed on the dongle (as explained in forum post 1).

    3. The nRF52840 dongle does not have exposed hardware UART lines and typically uses USB for communication. You will need to enable USB in your configuration.

    If you have already customized the smp_server sample, please share the changes you have made.

    Is Nordic Semi using AI to write documentation? Has a human been involved in the loop testing it?

    There is no involvement of AI in creating technical documentation. We have a dedicated team responsible for that.

    Is there a stable build i can just use without tweaking the "sample" files.

    Unfortunately, a pre-configured smp_server sample for the nRF52840 dongle is not available.

    Kind Regards,

    Abhijith

  • Unfortunately, a pre-configured smp_server sample for the nRF52840 dongle is not available.

    In the link for "my_dongle" the instructions would lead one to believe that they could simply compile the smp_svr with 
    west build -b nrf52840dongle/nrf52840 -d build/smp_svr zephyr/samples/subsys/mgmt/mcumgr/smp_svr

  • For information sake notice the comment with 5 steps on the forum thread here

  • I have generated more information.

    This is a capture of steps taken to try and implement the smp_svr demo.
    
    1. Open terminal, make project work directory
    ❯ cd ~/work
    ❯ mkdir nrf_connect
    ❯ cd nrf_connect
    ❯ code .
    
    2. Within vscode nrf_connect extension tab.
    * Create a new application.
    * Copy a sample
    * Select nRF Connect SDK v2.9.0
    * Select zephyr/samples/subsys/mgmt/mcumgr/smp_svr
    * Name it ~/work/nrf_connect/discord_demo/
    
    3. Setup vscode workspace so that it's in ~/work/nrf_connect/discord_demo/
    
    4. Within the nrf_connect applications add a build configuration.
    * Set toolchain and sdk (2.9.0)
    * Set board target nrf52840dongle/nrf52840
    * For Extra Kconfig fragments add overlay-cdc.conf (imported with when project was created with sample)
    * For Base Devicetree overlay add usb.overlay (imported with when project was created with sample)
    * Set build directory name - build
    * click build
    !!ERROR!!
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/wtr/work/nrf_connect/discord_demo/dongle/mcuboot/zephyr/zephyr_pre0.map 
    : && ccache /home/wtr/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/wtr/work/nrf_connect/discord_demo/dongle/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/nrf52840/libsoc__nordic.a  zephyr/boards/nordic/nrf52840dongle/libboards__nordic__nrf52840dongle.a  zephyr/drivers/usb/device/libdrivers__usb__device.a  zephyr/drivers/usb/common/nrf_usbd_common/libdrivers__usb__common__nrf_usbd_common.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/zcbor/libmodules__zcbor.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/home/wtr/work/nrf_connect/discord_demo/dongle/mcuboot/zephyr  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfloat-abi=hard  -mfp16-format=ieee  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  /home/wtr/ncs/v2.9.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.19.a  /home/wtr/ncs/v2.9.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a -L"/home/wtr/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard" -lc -lgcc && cd /home/wtr/work/nrf_connect/discord_demo/dongle/mcuboot/zephyr && /home/wtr/ncs/toolchains/b77d8c1312/usr/local/bin/cmake -E true
    /home/wtr/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
    /home/wtr/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 7912 bytes
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [10/20] No configure step for 'discord_demo'
    FAILED: _sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build /home/wtr/work/nrf_connect/discord_demo/dongle/_sysbuild/sysbuild/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build 
    cd /home/wtr/work/nrf_connect/discord_demo/dongle/mcuboot && /home/wtr/ncs/toolchains/b77d8c1312/usr/local/bin/cmake --build .
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /home/wtr/ncs/toolchains/b77d8c1312/usr/local/bin/cmake --build /home/wtr/work/nrf_connect/discord_demo/dongle
    

  • Hi Spector,

    Spector said:
    In the link for "my_dongle" the instructions would lead one to believe that they could simply compile the smp_svr with 
    west build -b nrf52840dongle/nrf52840 -d build/smp_svr zephyr/samples/subsys/mgmt/mcumgr/smp_svr

    Our apologies for the inconvenience, but this is one of the documentations that are very outdated. The content you were referring from was written in 2019. Since then, there seem to have only been mass automated document updates due to changes in the toolchain and documentation rendering.

    Back at the time the guide was written, perhaps the smp_svr sample was simple enough that it can fit on the nRF52840 Dongle with the chain loadings setup. However, since then, there have been a lot of improvement made to the features that sample uses, as well as the sample code itself. That increases the memory footprint, and causes the linker error you have:

    region `FLASH' overflowed by 7768 bytes

    The simplest way to overcome this is to use a different sample instead. I can recommend the Beacon sample with CONFIG_BOOTLOADER_MCUBOOT=y.

    The other options to work with the nRF52840 Dongle should also leave more space for the application.

    If the smp_svr sample is a must, you can attempt memory optimization for the SMP server.

    Finally, there is the new compressed image feature that should also give some more space for the application. You will need to rebuild MCUboot though.

    All that said, may I ask what you intend to use the Dongle for, or is there any goal overall, independent of the dongle?

    Hieu

Related