Hello,
The two PRM files are quite different in their structure, and to increase the size of the stack for each case will requre different measures.
For Bootloader.prm, a stack section is specifically defined, and this (unusually) lies below the APP_RAM section.
// APP_STACK_RAM = READ_WRITE 0x0101 TO 0x02C0; // RAM memory
APP_STACK_RAM = READ_WRITE 0x0101 TO 0x02EE; // RAM memory
// 802.15.4/App. general memory
APP_RAM = READ_WRITE 0x02C1 TO 0x0F6F; // RAM memory
I presume that you added the modified line that clearly overlaps into the APP_RAM section. To increase the size of the APP_STACK_RAM section, the size of the APP_RAM section must be correspondingly reduced. To double the size of the stack allocation, you might use the following -
APP_STACK_RAM = READ_WRITE 0x0101 TO 0x04EF; // RAM memory
// 802.15.4/App. general memory
APP_RAM = READ_WRITE 0x04F0 TO 0x0F6F; // RAM memory
The following might be an even better arrangement because APP_RAM will be assigned to variables from the bottom upward, and the stack will be used from the top downward. This will give maximum separation between the stack section and the allocated variables (just in case actual stack usage overflows its allocated section) -
APP_RAM = READ_WRITE 0x0101 TO 0x0B8F; // RAM memory
// 802.15.4/App. general memory
APP_STACK_RAM = READ_WRITE 0x0B90 TO 0x0F6F; // RAM memory
Whether or not it is possible to increase the stack size to this degree will depend on the RAM requirements for global and static variables. A check of the project.map file should show whether this is feasible.
A further improvement might be to change the DEFAULT_RAM placement sequence. The current placement is -
DEFAULT_RAM INTO DIRECT_ADDRESSING_MEMORY, APP_RAM, APP_RAM2;
If my understanding is correct (and it might not be) the linker will assign variables to each section, in the order given in the placement. If this is so, there may be some advantage in reversing the order of APP_RAM and APP_RAM2, so that the APP_RAM section will be the one that is partially utilized.
Regards,
Mac
Message Edited by bigmac on
2008-03-29 03:52 PM