Hi,

I was wondering why you haven't set the
STRICT_ALIGNMENT macro to 1 in the msp430.h header
file. (gcc-version/gcc/config/msp430/msp430.h) The gcc
documentation on this flag says:

<quote>
STRICT_ALIGNMENT 
Define this macro to be the value 1 if instructions
will fail to work if given data not on the nominal
alignment. If instructions will merely go slower in
that case, define this macro as 0.
</quote>

The msp430's documentation mentions that this is the
case.

The documentation for the msp430 libc mentions a
problem with memcpy where you copy 2 bytes. This
problem is caused because the compiler does not take
the alignment into account when using a builtin for
this function. Also, when you use structs with the
attribute 'packed' (causing the data to be misaligned)
you get problems. These can all be solved by setting
the STRICT_ALIGNMENT flag.

True, your code does get about 8% bigger and is
probably a bit slower, but the gcc output is correct
more often. It might also be an idea to make it a
command line switch that can turn off the strict
alignment when it is not necessary, although I don't
know how easy it is to do this in gcc.

G. Halkes

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

Reply via email to