Running Keil 5.1 on Freescale K64 32MHz crystal.
Trying to copy data into a two-dimensional array. Copying to an array lastRequestedHeader[3][14] from an array requestedPacket[14].
I have no problem copying into lastRequestedHeader[0] because it starts at address 0x20004514 in memory, but copying to lastRequestedHeader[1] gives me an
Stepping through the memcpy call, I see the first two bytes being copied properly in the __aeabi_memcpy function, but then getting into __aeabi_memcpy4 is where my processor stops on an unaligned access fault
Any ideas? Is there another memcpy call that I can substitute into the project?
If unaligned accesses are not allowed, then the compiler should handle the placement of variables on aligned addresses. Special care should be taken when dealing with byte arrays...but that should be a compiler/linker/library issue, not a programmer concern
This isn't a case of the compiler leaving variables on aligned or unaligned addreses.
This is about memcpy() being defined to support any alignment of the source and destination data, and the Keil implementation being designed based on false assumptions. memcpy() must always assume that the two pointers are to byte arrays of arbitrary align.