How to change the heap size of Thread 2.7.0.0 based applications in Simplicity Studio™
07/199/2018 | 09:26 AM
Question
How do I change the heap size for Thread applications in Simplicity Studio™?
Answer
In your open project in App Builder. Select the Other tab.
Under Additional Macros. Select the Value of the Macro EMBER_HEAP_SIZE. The default is 8000.
Try changing this value to modify the heap size of your Thread application.
Save your .isc file than click Generate. Make sure to overwrite the .mak file when prompted to do so.
Right click your project folder in Project Explorer. Clean your project.
Right click your project again and Build your project. The heap size should be changed.
Confirm by searching for the .emheap tag in the .map file under [project_name]/[Compiler]/[project_name].map. In my case because my project name was client and I used the GNU ARM v7.2.1 - Default compiler configuration the path in the Project explorer is client/GNU ARM v7.2.1 - Default/client.map
.map file before modification:
.emheap 0x20000000 0x1f40
0x20000000 PROVIDE (__EMHEAP__begin, .)
*(.emheap .emheap.*)
.emheap 0x20000000 0x1f40 ./stack/thread-stack/ember-ip-configuration.o
0x20000000 heapMemory
[!provide] PROVIDE (__EMHEAP__end, .)
0x00001f40 PROVIDE (__EMHEAP__size, SIZEOF (.emheap))
0x20001f40 . = (RAM_BOTTOM + MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
0x20001f40 PROVIDE (__EMHEAP_OVERLAY__end, .)
[!provide] PROVIDE (__EMHEAP_OVERLAY__size, MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
As you can see the size of the .emheap is 0x1f40 in hexadecimal which is exactly the default 8000 in decimal.
.map file after rebuilding with the modified value (I used 9000)
.emheap 0x20000000 0x2328
0x20000000 PROVIDE (__EMHEAP__begin, .)
*(.emheap .emheap.*)
.emheap 0x20000000 0x2328 ./stack/thread-stack/ember-ip-configuration.o
0x20000000 heapMemory
[!provide] PROVIDE (__EMHEAP__end, .)
0x00002328 PROVIDE (__EMHEAP__size, SIZEOF (.emheap))
0x20002328 . = (RAM_BOTTOM + MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
0x20002328 PROVIDE (__EMHEAP_OVERLAY__end, .)
[!provide] PROVIDE (__EMHEAP_OVERLAY__size, MAX (SIZEOF (.resetinfo), SIZEOF (.emheap)))
As you can see the size of the .emheap changed to 0x2328 in hexadecimal which is exactly the 9000 in decimal value I set.
How to change the heap size of Thread 2.7.0.0 based applications in Simplicity Studio™
Question
How do I change the heap size for Thread applications in Simplicity Studio™?
Answer
.map file before modification:
As you can see the size of the .emheap is 0x1f40 in hexadecimal which is exactly the default 8000 in decimal.
.map file after rebuilding with the modified value (I used 9000)
As you can see the size of the .emheap changed to 0x2328 in hexadecimal which is exactly the 9000 in decimal value I set.