Adding CONFIG_LOG=y causes Flash overflow error

This is my environment

  • IDE: VSC
  • SDK: NCS v2.2.0
  • nRF52-DK

I've got a couple of different sets of firmware for different applications, and I am seeing this issue with all of them.

They all use Bluetooth and have the MCU Boot manager enabled, as I need the OTA Firmware Update functionality.

Setup like that, I can't enable logging.  The moment I do, I get this error:

c:/nordic/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 23716 bytes

I've got no idea why this is occuring and whether its actually something I can get around somehow.

In the past, I've resolved this by simply printing debug statements out using printk(), and having a bunch of #ifdef DEBUG #end statements around the printk() statement so I can enable/disable those as I move through the firmware development.

But it would be good to get the logging working

Does anyone know how I can fix this?

Regards,

Mike

Parents
  • Hi Mike,

    In which file do you enable logging?

    How large was your project before enabling logging?

    A common trick is to set CONFIG_LOG_DEFAULT_LEVEL to 0 and then configure the log level for the specific module you need logging from.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    I've got logging enabled in my proj.conf file via CONFIG_LOG=y

    With this set to  "=n", I can get my code to build.  This is the report on Flash useage:

    [31/31] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       25274 B        48 KB     51.42%
                 RAM:       23680 B        64 KB     36.13%
            IDT_LIST:          0 GB         2 KB      0.00%
    [266/287] Linking C executable zephyr\zephyr_pre0.elf
    
    [270/287] Linking C executable zephyr\zephyr_pre1.elf
    
    [279/287] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      217844 B     224768 B     96.92%
                 RAM:       59686 B        64 KB     91.07%
            IDT_LIST:          0 GB         2 KB      0.00%
    [282/287] Generating ../../zephyr/app_update.bin
    sign the payload
    [284/287] Generating ../../zephyr/app_signed.hex
    sign the payload
    [285/287] Generating ../../zephyr/app_test_update.hex
    sign the payload
    [287/287] Generating zephyr/merged.hex

    So, I'm certainly pushing the limits of my available flash.

    This is my memory report - not sure if there is any scope to reduce how much flash I'm currently using.

    I did a quick test with a project that doesn't use Bluetooth - looks like adding the logging requires nearly 11k of Flash - does that seem right?

    I tried using the CONFIG_LOG_DEFAULT_LEVEL = 0, but its still needing way more flash that I have spare - I've only got about 7kB left at the moment

    Regards,

    Mike

Reply
  • Hi Sigurd,

    I've got logging enabled in my proj.conf file via CONFIG_LOG=y

    With this set to  "=n", I can get my code to build.  This is the report on Flash useage:

    [31/31] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       25274 B        48 KB     51.42%
                 RAM:       23680 B        64 KB     36.13%
            IDT_LIST:          0 GB         2 KB      0.00%
    [266/287] Linking C executable zephyr\zephyr_pre0.elf
    
    [270/287] Linking C executable zephyr\zephyr_pre1.elf
    
    [279/287] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      217844 B     224768 B     96.92%
                 RAM:       59686 B        64 KB     91.07%
            IDT_LIST:          0 GB         2 KB      0.00%
    [282/287] Generating ../../zephyr/app_update.bin
    sign the payload
    [284/287] Generating ../../zephyr/app_signed.hex
    sign the payload
    [285/287] Generating ../../zephyr/app_test_update.hex
    sign the payload
    [287/287] Generating zephyr/merged.hex

    So, I'm certainly pushing the limits of my available flash.

    This is my memory report - not sure if there is any scope to reduce how much flash I'm currently using.

    I did a quick test with a project that doesn't use Bluetooth - looks like adding the logging requires nearly 11k of Flash - does that seem right?

    I tried using the CONFIG_LOG_DEFAULT_LEVEL = 0, but its still needing way more flash that I have spare - I've only got about 7kB left at the moment

    Regards,

    Mike

Children
Related