CSTACK pointer corruption in Sharp LH75410

I'm programming the LH75410 (ARM7TDMI core) in C++ using IAR workbenc version 4.42A.

Startup seems to run correctly. But when I execute the first instructio in "main" I get an error message "CSTACK pointer is 0000 0000, outsid stack range". Stack range is in our RAM area, 4000 0000 - 401F FFFF, an I believe I've written the memory descriptor file properly. The S register contains a valid address for the stack pointer.

Questions are,

1 -- What can I do about this? 2 -- What's causing the problem? 3 -- Is the CSTACK pointer the SP register? If not, what?

No doubt this is a case for "rtfm", but I've read and searched all th fm's I can find and not seen a mention of this.

Reply to
senor_mike
Loading thread data ...

Are you using hand-rolled startup code, or vendor-provided?

It sounds like the RTL expects to have an internal variable initialized, separately from the machine's stack pointer. A quick Google suggests that you should have a separate CSTACK section; what does the MAP file say about CSTACK?

Reply to
larwe

In the IAR IDE go to Project Options, Debugger, Plugins, and remove the check next to Stack.

CSTACK is defined in your linker script. It is usually the stack used by USER/SYSTEM mode, but that depends on your startup file. If the SP register contains a valid address then don't worry about it.

Reply to
Paul Bosselaers

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.