This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF51822: memory space for Application code

Hello, guys.

We are using nRF51822 SoC together with nRF5 v12.3.0 SDK.

According to the nRF51822 memory layout, half of the 256KB flash memory space is taken by the Softdevice, MBR, and Bootloader.

The other half (~127KB) is at our disposal for the Application code. What I noticed is the following:

  • When I enable debug logging with the NRF_LOG_ENABLED flag, an additional ~20KB space of the Application area is taken for that.
  • When ble_init() function is included in the code that contains:
    • ble_stack_init()
    • peer_manager_init()
    • gap_params_init()
    • advertising_init()
    • gatt_init()
    • services_init()
    • conn_params_init(),

    additional ~40KB space is taken from the Application area, leaving us with only ~65KB for our application code.

    Inside services_init(), two standardized BLE Services (BAS and DIS) are initialized together with one custom BLE Service that contains two custom BLE Characteristics.

    Is there anything we can do to minimize the memory footprints of debugging and BLE so that we can have more space for our Application code? Here attached you can find the sdk_config.h file that we use in our project.

    Thanks in advance for your time and efforts.

    Sincerely,

    Bojan.

    6012.sdk_config.h

    Parents Reply Children
    • Hi, 

      bojan said:
      What's the way of disabling BSP?

      You can comment out  leds_init(); and buttons_init();

      bojan said:
      Can we benefit from ANCS without having a Peer Manager?

      Not sure, but you can try to disable bound with NULL as p_sec_params. If it still can work, you can try to remove PM. 

      -Amanda

    Related