Tyler and JMGross,

I appreciate both of your help in this.  At the risk of making myself out to be 
a total idiot, I realized that like so much else in my life, this misery was 
self-inflicted.  Hopefully humility counts for something.  Also, hopefully you 
will find this as hilarious as I did.

Since taking on this codebase, I have learned a world about how the msp430 
works, and how gcc works.  When I started, I attempted to port this codebase 
from the Quadravox compiler.  Many of the build automation done for that 
compiler was autogenerated, but I regardless attempted to dutifully transcribe 
from one set of options to the other.  Most of these were easy to find, but 
some were more difficult.

One of the more difficult ones happened to be specifying the stack pointer, 
which I eventually found to be "-Wl,--defsym=__stack=[...]".  But, just to make 
double sure that this one really stuck, I set it to a rather... unique address 
- one that, you guessed it, happened to be odd.  Sure enough, the compiler 
generated code to match, as expected.  Pleased that I figured out how to set 
the stack pointer, I moved on... without fixing my Makefile.

TL;DR: If you want to learn a TON about how compilers work and how your target 
architecture works, set the stack pointer to an odd address, and then forget 
about it.

Also, I might humbly suggest that the compiler flags the __stack value being 
set to an odd address with a warning, that some other poor soul somewhere 
wouldn't be faced with the same experience.

Sheepishly,

Nate Bragg

Reply via email to