Memory size limits on 20732?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
legic_1490776
Level 5
Level 5
25 likes received 10 likes received First like received

We have been running into problems associated with code size and wondered if we could get clarification on the maximum memory available for code and data?

I saw on another forum post it mentioned that the maximum code size is 30K.  Does that pertain to the "Total RAM footprint" line in the buld console?  If so it's not quite right because we found that our system stopped working completely after our total ram footprint exceeded 27364.  This makes me nervous because unless I understand the actual limit I might see less predictable failures!

So my questions are:

(1) What is the maximum code size and how can I tell whether I am reaching it?

(2) What is the maximum stack size?

(3) What is the amount of space available for global and static variables?

Are there any built in functions of the stack that can be turned off to save space, for example if I disable the battery status profile does that cut down on the footprint?

0 Likes
1 Solution
Anonymous
Not applicable

Hello idgirod,

(1) What is the maximum code size and how can I tell whether I am reaching it?

[JT] -

(2) What is the maximum stack size?

[JT] - The app thread stack size is 1K (1024 bytes).

(3) What is the amount of space available for global and static variables?

[JT] - The app code + globals (initialized and zero-initialized) all share the same space. So allocating more globals will reduce space for app code and vice-versa.

(4) Are there any built in functions of the stack that can be turned off to save space, for example if I disable the battery status profile does that cut down on the footprint?

[JT] - No, here's why

  1. Disabling battery monitor will not give you more space because its in the ROM.
  2. The next version of our chip will enable some of these features.

Notes:

  1. The 30K is shared memory (between patches and the app) and the dynamically allocated buffers also take up some of this space.
  2. The ‘total RAM footprint ‘ line at the end of the build is only the static portion of the app + patches (includes code + initialized and uninitialized data) in our flat memory model.
  3. So you cannot take the app start address and add the app size and then subtract from 60K to get remaining size.  See block Diagram below:

Below is a brief overview of the RAM Memory Map of the BCM20732:

This is a top level explanation and some components:

Mem_Map_1.PNG

  1. The 4K CM3 Mapper is for the Cortex M3 Memory Map for Interrupts Stack, etc.
  2. Note that our Stack (YELLOW) is 30K and is DATA ONLY.
  3. The Patches Section (Features,Updates, etc) is combined with the User App but:
    1. The Patches_Init Code is overlayed and can be used by the App after the Patches are loaded.
    2. The App_Init/BLE_SET_CONFIG is also overlayed by the Dynamic Allocation.

As an example, we take the Hello_Senor App and using the SDK Console Window, we see the Patches Start/End Addresses:

Mem_Map_2.PNG

And finally, we can see the Overlap in the code:

Mem_Map_3.PNG

Hopefully this gets you started.

JT

View solution in original post

6 Replies