Hi. I'm trying to wrap my head around some stuff.
1) The datasheet says that SRAM starts at 0x2000.0000 and ends at 0x2006.FFFF, but that's a lot more than 256KB that this chip is supposed to have. I'm not worried about it but is there a particular reason or something I'm not seeing?
2) The linker command file says:
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
.vtable : > 0x20000000
Then I'm experimenting with the stack size, here I try a very small stack:
__STACK_TOP = __stack + 128;
When I debug, __stack appears to be located at 0x2001.98B8 and dereferenced it is pointing to 0x2001.9634.
So why wouldn't it be much closer to 0x2000.0000? Shouldn't the stack come "pretty much?" right after the vector table?
3) When the program starts, SP = __STACK_TOP = 0x2001.9938, which is exactly 128 bytes (my stack size) higher than 0x2001.98B8 but I'm confused because I thought 0x2001.98B8 was the location in memory of __stack but that the value is 0x2001.9634 and the value should be what counts.
In my watch window it says:
"__stack" of type int* with value 0x2001.98b8 {0x2001.9634}, no address given
then I expand this expression and it says:
"(x) = *(__stack)" of type int with value 0x2001.9634, and address 0x2001.98b8.
I know this sounds very confusing but I'm thinking that the watch window is mixing up address and value.
4) Can I set a breakpoint when a variable of my choice is written to, or changed to a certain value or is that not possible?
5) How would I go about setting a breakpoint for when SP reaches or goes lower than __stack
FYI I'm not having stack overflow problems but I would like to understand this stuff in more detail so that I can be a good programmer :)