Enabling MCUBOOT over USB for example project causes FLASH overflow

I've tried googling, but nothing seems to quite help.

When I simply enabled MCUBOOT for a sample project on the nRF52840DK_nRF52840 board, I can get it working just fine. However, for my purposes, I would like to enter DFU mode via GPIO and so I think I need to enable "CONFIG_BOOT_USB_DFU_GPIO". When I do so, however, I seem to run out of FLASH for MCUBOOT -- citing something like 9kB over. I have everything else setup as default. any ideas?

note: I've been enabling CONFIG_BOOT_USB_DFU_GPIO, by adding "child_image/mcuboot.conf" to the sample project to append the config variable. But I've also just tried building MCUBoot separately and adding the config to the "proj.conf" file directly -- no such luck.

Right now I'm trying the minimal configuration file with the above configuration...but I'm running into undefined symbols that all look timing related. Attempting to toggle some configs in the minimal configuration file now...

  • Closest I've gotten so far with my minimal configuration is 4420bytes over FLASH.

    here's my config, but this still has some undefined references to "z_thread_aligned_alloc" and a few others :(

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_MAIN_STACK_SIZE=10240
    CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"
    
    CONFIG_FLASH=y
    CONFIG_FPROTECT=y
    CONFIG_PM=n
    
    CONFIG_BOOT_SWAP_SAVE_ENCTLV=n
    CONFIG_BOOT_ENCRYPT_IMAGE=n
    
    CONFIG_BOOT_BOOTSTRAP=n
    CONFIG_BOOT_UPGRADE_ONLY=n
    
    ### Minimal Configurations ###
    CONFIG_BOOT_USE_MIN_PARTITION_SIZE=y
    CONFIG_ASSERT=n
    CONFIG_BOOT_BANNER=n
    # CONFIG_CLOCK_CONTROL=n
    CONFIG_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=n
    # CONFIG_GPIO=n
    CONFIG_KERNEL_MEM_POOL=n
    CONFIG_LOG=n
    CONFIG_MINIMAL_LIBC_CALLOC=n
    CONFIG_MINIMAL_LIBC_MALLOC=n
    CONFIG_MINIMAL_LIBC_REALLOCARRAY=n
    CONFIG_NCS_SAMPLES_DEFAULTS=n
    CONFIG_NO_RUNTIME_CHECKS=y
    # CONFIG_NRF_RTC_TIMER=n
    CONFIG_PRINTK=n
    CONFIG_SECURE_BOOT_DEBUG=n
    CONFIG_SERIAL=n
    CONFIG_SIZE_OPTIMIZATIONS=y
    # CONFIG_SYS_CLOCK_EXISTS=n
    CONFIG_UART_CONSOLE=n
    
    CONFIG_BOOT_USB_DFU_GPIO=y
    

  • adding some more to my project's "child_image/mcuboot.conf" I'm getting a bit closer:

    CONFIG_BOOT_SIGNATURE_TYPE_NONE=y
    CONFIG_FPROTECT=n
    CONFIG_BOOT_USB_DFU_GPIO=y
    CONFIG_BOOT_USB_DFU_WAIT=y
    CONFIG_USB_DFU_PERMANENT_DOWNLOAD=y
    CONFIG_BOOT_SWAP_USING_MOVE=y

    now I get that:

    /opt/nordic/ncs/toolchains/580e4ef81c/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 `rodata' will not fit in region `FLASH'
    /opt/nordic/ncs/toolchains/580e4ef81c/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 3336 bytes

    rodata instead of text?

  • Hello,

    Which nRF Connect SDK version are you suing here? Have you checked the memory report? If so, what does it say? If not, I recommend you  take a look at the memory report to get a better understanding of the issue. See the DFU section inside the Devacademy course, which explains various methods on doing DFU. I recommend going through the Devacademy samples to get an idea of the minimal configuration you need to use. Obtaining the memory report from the VScode is also mentioned in the course.

    Kind Regards,

    Abhijith

  • I'm using 2.6.0

    I'm not able to get a memory report working since my build fails at the linker (when the FLASH usage is too large). When I can build, my basic app I'm testing with (the USB HID test app in samples) is 50kB. I'm unable to view the memory report for MCUBoot because I can't get it to build (been trying in USB HID and in a separate application where I just have MCUBoot open)

    ah! took at look at the devafademy samples and that helped. was able to increase the PM partition for MCUBoot and I get:

    [213/213] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       52504 B        84 KB     61.04%
                 RAM:       31616 B       256 KB     12.06%
            IDT_LIST:          0 GB        32 KB      0.00%
    [15/179] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/nordic/ncs/v2.6.0/zephyr), build: v3.5.99-ncs1
    [171/179] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       51800 B     478720 B     10.82%
                 RAM:       16576 B       256 KB      6.32%
            IDT_LIST:          0 GB        32 KB      0.00%

    Previously I had MCUBoot region of 0xC000 (49kB) so it was overflowing! thanks so much. yeah I need to go through the courses at some point, thanks again

  • Hello,

    I am glad to hear that it is working for you. Please don't hesitate to create a new ticket if you come across another issue.

    Kind Regards,

    Abhijith

Related