Forums

M16 IAR CSTACK / ISTACK

Started by Unknown March 24, 2006
Hi !

I want to add some code to check the stack sizes at runtime.
while gtting the current end is quite easy with 'C' means  ....
  asm("PUSHC  SP");
  asm("POP    R0");
  asm("MOV.W  R0,val_usp");
  asm("PUSHC  ISP");
  asm("POP    R0");
  asm("MOV.W  R0, val_isp");

I have problems to determine the begin of the stack
This is what can be found in the MAP file

CSTACK                             00000400 - 000005FF         200
rel    0
ISTACK                             00000600 - 000007FF         200
rel    0

I know there must be a way to acces tehm in 'C' , but all I tried
failed.
any ideas ?!?!

TIA
w.b.

s'been just a matter of RTFM , as usual ..:)


#pragma segment = "ISTACK"
#pragma segment = "CSTACK"

-> then

  cstack_begin = __segment_begin("CSTACK");
  istack_begin = __segment_begin("ISTACK");