I've used the intrinsic __swap_bytes(x) to do big to little endian data conversion.
I came to the conclusion that __swap_bytes(x) only works correctly when x is word aligned.
This intrinsic is essential the assembler command "swpb x", the generated code is shown below:
9898: 2e 4d mov @r13, r14 ;
989a: 8e 10 swpb r14 ;
989c: 8d 4e 00 00 mov r14, 0(r13) ;
The problem stems from the fact that 'mov @r13, r14' seems to only be able to do word transfers, at least that's what happens when this command is executed by the CPU.
GCC (msp430-14r1-167) does not seem to be able to take this into account and work around this alignment problem.
George Mock, could you possibly comment on that?