cancel
Showing results for 
Search instead for 
Did you mean: 

Stack overlap

seeguard
Associate II
Posted on December 22, 2003 at 04:05

Stack overlap

5 REPLIES 5
seeguard
Associate II
Posted on December 19, 2003 at 10:35

I use ST72F521 that his stack allocation is in 100-1FF.

When I try to define in project.prm SECTION as follow:

SECTIONS

MY_ZRAM = NO_INIT 0x80 TO 0xFF ;

MY_RAM = READ_WRITE 0x200 TO 0x87F;

MY_STACK = READ_WRITE 0x100 TO 0x1FF;

MY_ROM = READ_ONLY 0x1000 TO 0xFFDF;

END

There are many link errors as:

LEX allocated in segment _ZEROPAGE is not allocated according to the

segment

_R_Z allocated in segment _ZEROPAGE is not allocated according to the segment

and so on..

In ST72F521 datasheet the memory map is as has defined above, so

Why there are many compiler (mertrowerks) errors?

The real problem is: that the compiler allocates variables in the stack area for example:

busXmit 1F6 1F ( 19) DEFAULT_RAM

and when I do memcpy to that buffer the run-time system is crashed and reset is occurred.

How do I avoid the compiler to allocate variables in STACK area?

atz

sjo
Associate II
Posted on December 19, 2003 at 13:08

Could you show us the rest of your prm file, also what memory model are you using ?

Regards

sjo
seeguard
Associate II
Posted on December 20, 2003 at 18:40

you can look the prm file in the attachments.

I compile my project (-ml) LARGE model.

atz

________________

Attachments :

kp.prm : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzyO&d=%2Fa%2F0X0000000bTq%2FDPn3nobabHsu3Nhm6vEZaOUrHLrE6BKhkVT_xNpMXh4&asPdf=false
parveen
Associate II
Posted on December 22, 2003 at 02:21

Hello,

The problem you are facing

''LEX allocated in segment _ZEROPAGE is not allocated according to the

segment ''

is because you have placed _ZEROPAGE in MY_RAM (0x200 to 0x87F) memory which is not short addressable but variables like _LEX, _REX, _R_Z assume short addressable memory.

This problem can be solved by placing ZEROPAGE in MY_ZRAM

_ZEROPAGE,_OVERLAP INTO MY_ZRAM;

Hope this helps

Could you provide some more details about the ''Run time crash'' you are referring

Regards,

PraveenG

seeguard
Associate II
Posted on December 22, 2003 at 04:05

It works!

Thank you for your help

atz