Neil Wyper wrote:

On 9/12/06, Grant Edwards <gra...@visi.com> wrote:
On 2006-09-12, Grant Edwards <gra...@visi.com> wrote:

My program is broken because mspgcc 3.2.3 is generating
unaligned word accesses.  I'm calling memset() and memcpy()
fill in the fields in a packed struct.  Since I've requested a
2-byte copy/set mspgcc is optimizing some of those memset() and
memcpy() calls into mov.w instructions, but the destination
address isn't word aligned, so the generated code is not
correct.
It appears to be doing the same thing for 4-byte memcpy()
operations. :(

This was noted on the list a year ago:
http://www.nabble.com/memcpy-assumes-16-bit-alignment--t712619.html

msp430-libc/src/string/bcopy.c hasn't changed since then, so the bug
is still present.  The thread from last year did include a possible
replacement memcpy() from Daniel Néri.

Neil
That old thread seems to have faded away without conclusion. I will try to do something about it. However, I am not sure what to do. The routine which was posted in about the simplest we could use, so it is the smallest. However, it is not efficient. Should I go for size or speed (and consider speed affects power consumption - the faster code will be more energy efficient :-) )?

Maybe I should just change to the simplest code for now, so we have something reliable, and consider efficiency later.

Steve


Reply via email to