This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting NRF_LOG_ENABLED to 1 results in too big image when UART log is enabled

My setup:

NRF52DK; Keil 5.22.0.0; nRF5_SDK_12.2.0; S132 3.1.0

While trying to use ble_peripheral\ble_app_template\pca10040\s132\arm5_no_packs I decided to modify sdk_config.h by setting: NRF_LOG_ENABLED 1

I also have NRF_LOG_BACKEND_SERIAL_USES_UART 1

So my goal is to be able to "see" logs over the UART.

Once I tried to compile my project I saw this error: "The size of this image (33456 bytes) exceeds the maximum allowed for this version of the linker"

Is there a way to use UART logger with free Keil?

  • Hi,

    The evaluation version of Keil does not support program size of more than 32 kB. For reducing the code size in the ble_app_template example, a trick could be to temporarily disable the peer manager. This will reduce the code size with about 12kB. Comment out line 791 peer_manager_init(erase_bonds); and line 555 pm_on_ble_evt(p_ble_evt);

    Note that you cannot do pairing and bonding when not using the peer manager.

    You can also switch to build tools that are not size limited, such as GCC. You can find a good tutorial on setting up GCC with Eclipse here, and a guide for setting up Segger Embedded Studio here.

  • Thanks, commenting out those 2 lines allowed me to not only use UART logging but also to change the Optimization Level to Level-0 and I am still under 27kB.

Related