This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Too much or too less stack size

Hi,

I've had a question some time ago, because I thought the compiler generates wrong code.
Your answers told me that my startup-configuration seems to be wrong. Here I want to say thank you for the help.

I dicovered, that my system seems to have problems with user-stack-size.
All functions are not working stable.

I use this function-Header:

char putchar(char Handle}

My parameter "Handle" sometimes has been interpreted like it should and sometimes not.
If I try my function-body as a macro like this

#define putchar(c) ...

with the same function-body everything works fine.
I think I have problems with user-stack.
But my user-stack-size is 0x1000
and system stack-size is 0x200.
Any size lower than this values resolves in a not working system.
I tried using a biger stacksize, but if I raise my stack, my system is not working at all.

Everything within main() is working great.
Just function calls work randomly.
I tried a loop with 10000 calls and put the results onto my pc screen using RS232.
not every 10000 calls worked, but nearly 1000. Sending 10000 chars directly to RS232 works errorfree.

Do you know anything about this behaviour?
I use the default startup-code.

thanks for your help

Jacek

  • Hi Jacek,
    I would suggest running your code under debugger. If you don't have an in-circuit debugger set up, use the simulator, it supports serial I/O. You will be able to single-step through code, set breakpoints, check stack usage, etc. - all you need to find the root of the problem. Based on the information that you posted it's hard to tell what's wrong.

    Regards,
    - mike