We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
In start.a51, there is defined a idata segment ?STACK.
?STACK SEGMENT IDATA
Now, in my asm file, I want to use the ?STACK to reset the SP,when using it directly as follows,
mov SP, #STACK-1
but there is an error: "error A45: UNDEFINED SYMBOL"
How can I do it, thanks.
The ISR may need a bit of stack space to save some registers. Preferably, the ISR should not make a lot of function calls requiring extra stack - most often, it shouldn't do any function calls at all.
Try to allocate static variables for the information needed by the ISR - and for any calls you just have to make from the ISR.
I recommend that you solve your stack usage problem, instead of continuing to play with the stack. Besides - playing with the stack means that the ISR doesn't need to know the start address of the main app stadck. It must save the stack pointer, before switching to a separate stack. After being done, this is the value that you must restore - not the start address of the stack.