Re: Global Variables Being Overwritten



jgurtner wrote:

BINGO! Thanks a million!

you wrote:
"Some suggestions:
- Check your stack placement. Make sure it's not colliding with data
space. "

My compiler automatically placed the stack right in the middle of my
data. The stack was set to 80 bytes. I reset the size to 255 bytes
and the compiler moved it out in the open away from my other data.
(Not an major issue, but still not sure how to specify the exact
placement of the stack with my compiler).

Now the stack has plenty of room to expand!

Thanks again!
JimG

You want to look for a thing called a 'linker command file'. If you're lucky the extension will be documented. If you're _really_ lucky about 30% of the syntax will be documented. After that you're on your own. Usually these have a way of locating segments -- you need to figure out how to tell it not to let data and stack collide.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html
.



Relevant Pages

  • Re: Do buffers always start with the lowest memory address being the first element?
    ... > The C standard does not assume a downward-growing stack, ... > an upward-growing stack. ... C allows but does not require that the array produced ... > machine depends on both the C compiler and the machine. ...
    (comp.lang.c)
  • Re: switch statement, was compiler, status...
    ... Primary Register, Secondary Register, ... Stack, and abit of storage does it. ... This version of Small-C is copyrighted as a revision to Ron Cain's ... Croatia) is "Calculator Compiler" by Senko Rasik. ...
    (alt.lang.asm)
  • Re: subroutine stack and C machine model
    ... On a typical system the stack on entry to the function looks like this ... balance to specify the order of evaluation). ... compiler developer to find out when code can be moved around. ... I think the Standards people used compiler optimization as an excuse ...
    (comp.lang.c)
  • Re: back online again...
    ... really "acceptable") convention. ... stack machine, but the design ... target with my compiler (may need a different name for this though, ... most of this code is not likely to ever go to object files anyways... ...
    (alt.lang.asm)
  • Re: 2.6.25-git2: BUG: unable to handle kernel paging request at ffffffffffffffff
    ... since the compiler is totally free to spill and reload the local variable ... So forget about the prefetch, ... variable onto the stack, since it did that volatime memory access through ... the insane "store and immediately reload from ...
    (Linux-Kernel)