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

Parents
  • 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

Reply
  • 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

Children
  • Hi Einar,

    Sorry for the delayed response! I was able to reduce the memory footprint, without debug options enabled, down to the following:

    Memory region         Used Size  Region Size  %age Used
               FLASH:      242468 B     409088 B     59.27%
                SRAM:        173 KB     211736 B     83.67%
            IDT_LIST:          0 GB         2 KB      0.00%

    However, what is weird is that when I go to enable debug options for this build, I still get the same number of bytes for the overflow error: region `FLASH' overflowed by 15872 bytes


    Thanks,

    Nathan

  • Hi

    I just noticed that the difference between the flash region sizes in our build logs is pretty close to your reported overflow amount of 15000 bytes. (409088B vs 392704B)

    Perhaps you've done a mistake in your partition file that only takes effect once you surpass the actual flash region size?

    -Einar

Related