I am trying to force stack in a 256 byte part to start at a different address, eg. resize it.
In Compiler/Linker manual I can find a command line way to do it, but would rather have
this done by project settings.
-dram_end:<address> Define the end of the data area. The startup file uses this argument to ini-
tialize the value of the hardware stack.
How would I go about this ?
Dana, when you are using ImageCraft the stack begins at low address after the last global var and advances up to 0xff.
So if you define a placeholder var (global, uninitialized) you will get the wanted effect.
Actually I don't think thats true, my stack starts at 0x80 in a 256 byte part,
and globals + API >> 128 bytes.
There must be a way to set stack address......
I have a simple workaround to force stack start address to a particular RAM location - but I do not recommend it, just if you are desperate 🙂 ..
Open 'boot.tpl' file in either designer or notepad. Most probably, Line 212 (or search for 'Set up the stack' - refer attached figure). You will find that stack pointer, SP being initialized there. It is all yours, just edit it to your need 🙂
For LMM devices, (with more than >256 bytes of RAM), you get an option in the compiler settings for moving the stack stack address in the last page of RAM - this also can be found and edited in boot.tpl.
I saw that in tpl as well, but did not use because it states it is a temporary stack start
address. I wound up using script in custom.lkp file, and the command -dram_end:<address>
For large memory models, yes it is temporary. For a 256 byte device, it is where stack starts.
Even for LMMs, if you do a CTRL+F and search 'stack' in the file, you will find all the stack related assignments. For LMMs, the extra stuffs, that are done are basically initialization of the various page pointers, IDX_PP, CUR_PP, STK_PP etc.
Thanks MSUR for the clarification.
Seems to me Imagecraft could spend a little more time on documenting their
compiler/user manual and illustrated examples of linker mods and optimization
techniques. Also would be nice if someone brings stackwalk up to date as well.