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

RAM usage with S110 support

Hi

I'm a little confused with the RAM usage with S110 support, the following represents the memory usage of example of "ble_app_template", even there is no any application code is added, the ZI-data is almost up to 5.7K, so the question is, does the 5.7K include RAM used by S110? how much RAM left for my own code? 2.3K or 10.3K?

...... linking... Program Size: Code=14140 RO-data=228 RW-data=188 ZI-data=5724
FromELF: creating hex file... "._build\ble_app_template.axf" - 0 Error(s), 0 Warning(s).

  • The softdevice loaded claims a good chunk of the RAM (see each individual softdevice spec for more details). For instance, the S110 softdevice claims 8 kB RAM + shares it's stack with the application. The "Stack_Size" set in arm_startup_nrf51.s must therefore be set greater than what is specified as a minimum requirement in the Softdevice you're using. With the S110, it will require: 8 kB + >1.5 kB Stack_Size.

    However, by default, there's not much optimization in this example. For instance, the HEAP is also a part of your RAM usage. If you enable "Use MicroLIB" in your Keil options, it will take away the HEAP, giving you >4 kB for your application.

    Additional info about calculating RAM (in case you're interested):

    Total RAM usage will be RW-data + Zi-data. RW data is variables != 0, while ZI-data (zero initialized data) is variables set to 0. RW-data will also be present in flash, as they need to be initialized to a specific value != 0.

    Total flash usage is therefore: Code + RO-data + RW-data.

Related