Unable to enable debug options in VS Code for NCS v2.2.0

Hi,

I am able to build my application fine in VS Code with NCS v2.2.0. However, I am unable to debug the application when I select "Enable debug options" when editing the build configuration. It makes it nearly all the way through the build and linking process, but then fails with: region `FLASH' overflowed by 15872 bytes

It may be noteworthy that I am using a statically allocated partition file (I was unable to get LittleFS working with partitions created in the devicetree). But there are no issues building and running with this static partition file when I am not trying to enable debug options.

Any help would be greatly appreciated!

Thanks,
Nathan

  • Hello

    Enabling debug options makes your application's memory footprint larger, so it seems like you've exceeded your available memory when including it.

    You'll have to disable other features to fit the ones you need, I'd recommend having a look at our memory footprint optimization recommendations:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_memory.html

    Best regards,

    Einar

  • Hi Einarh,

    Thank you for the response! So that is what I assumed, however when I disable some of the more more memory heavy libraries like MBED (see below), the amount of memory it says it overflows by does not decrease and simple remains the same.

    #CONFIG_MBEDTLS=y
    #CONFIG_MBEDTLS_SSL_CLI_C=y
    #CONFIG_MBEDTLS_TLS_LIBRARY=y
    #CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

     Even by reducing CONFIG_MAIN_STACK_SIZE for example, the amount that it says flash overflows by is unchanged.

    I'm not sure if this is helpful, but this is a more verbose few lines of the error:

    c:/sdk/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x1fc40 of bin\tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH'
    c:/sdk/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: bin\tfm_s.axf section `.sg_end_dummy' will not fit in region `FLASH'
    c:/sdk/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: address 0x1fc40 of bin\tfm_s.axf section `.gnu.sgstubs' is not within region `FLASH'
    c:/sdk/toolchains/v2.1.3/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 15872 bytes

  • If you don't include debug options, and you let it build successfully, what does the end of the build log say about memory usage?

    -Einar

  • Hi Einar,

    Below is the memory usage of the successful build:

    Memory region         Used Size  Region Size  %age Used
               FLASH:      309068 B     409088 B     75.55%
                SRAM:      190720 B     211736 B     90.07%
            IDT_LIST:          0 GB         2 KB      0.00%

    Thanks,

    Nathan

  • Ok, well you are using a large amount of your available memory.

    If I for instance try to build the Asset Tracker v2 application for the nRF9160 DK without debug options, I see this result:

    Memory region         Used Size  Region Size  %age Used
               FLASH:      261412 B     392704 B     66.57%
                 RAM:      130896 B     211736 B     61.82%
            IDT_LIST:          0 GB         2 KB      0.00%

    And if I try to build with debug options the build fails, though not with exactly the same error message as yours:

    Error: Image size (0x67f5e) + trailer (0x630) exceeds requested size 0x68000

    So it's very possible that debug options need a lot of memory for your application.

    Could you try building with some of the more memory heavy libraries disabled while still having debug options disabled to see how much you are able to reduce the memory footprint by?

    -Einar

Related