DSPRelated.com
Forums

What happens to my stack?

Started by esbn8 April 13, 2006
Hi,
trying to run a code developed and running in MSVC on CCS3.1. I use
the c64xx CPU Cycle accurate simulator. I use the Call Stack window to
track my function calls, but a some point the list of nested calls is
replaced by some strange hex number, probably an address. This address
is changing as I step further through the code, sometimes its pointing
to the stack, sometimes to space outside any specified memory area.

Eventually, a little bit further down, the program crashes.

Does anyone have an idea of what could be the problem?

Thanks for you time.

\Esben.
Hello Esben,

Please see suggestion below.

--- esbn8 wrote:

> Hi,
> trying to run a code developed and running in MSVC
> on CCS3.1. I use
> the c64xx CPU Cycle accurate simulator. I use the
> Call Stack window to
> track my function calls, but a some point the list
> of nested calls is
> replaced by some strange hex number, probably an
> address. This address
> is changing as I step further through the code,
> sometimes its pointing
> to the stack, sometimes to space outside any
> specified memory area.
>
> Eventually, a little bit further down, the program
> crashes.
>
> Does anyone have an idea of what could be the
> problem?

I am not sure if your 'code is bad' or your stack is
stepping on some of your code. See the linker command
file below for a conceptual solution [your LCF might
be different]. If your stack is 'stepping on your
code', this should prevent it. As an added measure,
you could fill 'EMPTY' and 'STACK' with a pattern to
see how far down your stack went.

MEMORY
{
/* vecs + IRAM = size of internal memory */
vecs: o = 00000000h, l = 00000200h, fill = 0
IRAM: o = 00000200h, l = 0001ffe0h
/* CE0 = the size of ext memory-SDRAM, minus stack
size [I assumed 64k for stack, minus 64k */
CE0: o = 80000000h, l = 000e0000h
/* the following is only for reference - nothing show
ever address this range */
EMPTY: o = 800e0000h, l = 00010000h
STACK: o = 800f0000h, l = 00010000h
}

SECTIONS
{
"vectors" > vecs
.cinit > IRAM
.text > IRAM
.stack > STACK
.bss > IRAM
.const > IRAM
.data > IRAM
.far > IRAM
.switch > IRAM
.sysmem > IRAM
.tables > IRAM
.cio > IRAM
}

>
> Thanks for you time.
>
> \Esben.
> c...
>
>