Posted: Fri Apr 03, 2015 11:33 pm Post subject: Newbie: Need to set initial stack pointer at a specific addr
Hello, I just bought BASCOM-AVR so I can program ATXMEGA128A1.
I've read about the hardware stack, software stack and the frame.
What bothers me is how do I set that the CPU stack pointer isn't at 0x3FFF which is the end of SRAM, but 0x2FFF.
I don't want to do this manually like writing to the CPU SPL and SPH because I think that will overflow the software stack.
The reason why I'm putting the stack pointer at 0x2FFF is because there will be a user program that my debugging program will load with stack pointer at 0x3FFF and it will be context switching like a little OS.
the hardware stack pointer is always set to the last sram address.
you could change the RAMEND value in the dat file. that is the most simple solution. _________________ Mark
My program flash start: 0x000000
My program stack start: 0x2FFF (I don't want to set this in the DEF file because I'll get the out of bounds error for accessing above this)
User's program flash start: 0x008000
User's program stack start: 0x3FFF
My program uses RTC for context switching between these two programs.
I succeeded by using SPH=$2F.
However, I cannot read the stack pointer. Whenever I try to read and print, I get zeros.
Reading the stack pointer will be important so that the user can use the "cpu" command to print out all the registers to USART which are put into my array by context switching.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum