Keil™, An ARM® Company

Discussion Forum

How to move the 167 stack?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Ricard Wanderlöf
Posted
1-Feb-2002 09:48
Toolset
C166
New! How to move the 167 stack?
Hi!

For various reasons, I want to position the internal 167 stack so that it starts at the bottom of internal RAM (F600 on the C167CR), and extends 512 bytes up (i.e. to F7FF). This of course requires modification to the START167.ASM startup code. However, L166 still locates the stack at the default location of FA00..FBFF (as can be seen in the .map file). Looking at the linker SSKDEF directive definition, it implies that the linker indeed automatically puts the stack at these addresses when a 512 byte stack is selected. However, in the 167 chip manual, I can see no reason for not placing the stack anywhere in the internal RAM, as long as the appropriate registers are properly initialized (SP, STKUN, STKOV).

So my question is ... how do you get the linker to allocate the stack where I want it? (I'm still using the old 3.xx tool series, perhaps this has been fixed in the 4.xx versions?)

regards,

/Ricard W


Read-Only
Author
Mike Kleshov
Posted
1-Feb-2002 10:13
Toolset
C166
New! RE: How to move the 167 stack?
I don't know if there is an option to move the system stack in the Keil tools, but you can find a way around the problem. Reserve the area you want to use for the system stack and set the stack size setting to 32 words (so you waste as little memory space as possible in the default stack area). The rest can be fixed in Start167.asm

Regards,
Mike
Read-Only
Author
Jon Ward
Posted
1-Feb-2002 12:00
Toolset
C166
New! RE: How to move the 167 stack?
I just tried the following using C166 V4.20. I'm CERTAIN this will work OK with version 3 as well.

http://www.keil.com/support/docs/1706.htm

It located the stack exactly where I placed it.

Jon
Read-Only
Author
Ricard Wanderlöf
Posted
4-Feb-2002 06:59
Toolset
C166
New! RE: How to move the 167 stack?
>I just tried the following using C166 V4.20. I'm CERTAIN this will work OK with version 3 as well.

>http://www.keil.com/support/docs/1706.htm

I tried doing this, but in the version I'm using (3.50c, yeah it's old) changing _BOS or _TOS did not have any effect.

After thinking about it, I decided to do it "manually" and skip the SSKDEF definition altogether, by allocating a separate section for the stack. That seems to work well.

/Ricard

/Ricard
Read-Only
Author
Jon Ward
Posted
4-Feb-2002 11:42
Toolset
C166
New! RE: How to move the 167 stack?
Did you set STKSZ to a 7. If this is not set to 7, the stack is in a fixed location (from what I recall).

Jon

Next Thread | Thread List | Previous Thread Start a Thread | Settings