I am little bit confused by the stack usage in CC2430. Normally we can use stack in data memory pointed by SP. It is ISTACK.
but CC2430 also use XDATA segment to hold stack, it defines XSP as its stack pointer as:
// Internal (MCU) Stack addresses
#define CSTK_PTR _Pragma("segment=\"XSP\"") __segment_begin("XSP")
#define CSTK_BEG _Pragma("segment=\"XSTACK\"") __segment_begin("XSTACK")
#define RSTK_END _Pragma("segment=\"ISTACK\"") __segment_end("ISTACK")
accoring to zmain_ram_init(), it seems all call parameters are in XSTACK, and return address is in ISTACK, so it seems most of stack usage is in XDATA area. Am I right? The CPU will automatically assign function call parameters and return address to different stack? What is the reason to do like this way?
If there is some long function call chain or recursive function call, which part of stack is more likely to face stack overflow?
Thanks
Rui