Using prc tools (gcc), is there a way to ensure (#pragma perhaps?) that some of my 
stack variables are aligned on 4 byte boundaries?  That is, depending on what the rest 
of the code looks like, the following "foo" variable may or may not be aligned on a 4 
byte boundary:

int fxn() {
//    Err retVal;
    UInt32 foo;

    <snip>
}

Something as simple as uncommenting the retVal declaration will shift the location of 
foo back/forward 16 bits and can cause mis-alignment.

I'm one of the fortunate souls with real 5.0 hardware, and I need the variables to be 
32 bit aligned because they're being passed down to an armlet, and the arm crashes 
when it tries to access non-32-bit aligned memory.

Currently I have to MemPtrNew all my memory which I pass down to the armlet, but it 
sure would be nice if I could just use variables on the stack.  (As a side-note, is 
MemPtrNew guaranteed to return 32-bit aligned memory?  I haven't had any problems so 
far, but the documentation on this is non-existent).

If the current tools don't support this, it might be a very nice feature to add to the 
prc/code warrior compilers ASAP as 5.0 devices start showing up and people start 
writing armlets.

Chris Ring
Software Engineer
Texas Instruments
http://www.omap.com



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to