This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

memcpy NOT on 32-bit boundary

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?

Parents
  • So - homework for Keil. They haven't done their homework - memcpy() and memmove() must work on any alignment of source and destination (assuming that there aren't some additional alignment issues for some specific parts of the processor memory region). This is a bit of a student oops if asked to implement an optimized memcpy().

Reply
  • So - homework for Keil. They haven't done their homework - memcpy() and memmove() must work on any alignment of source and destination (assuming that there aren't some additional alignment issues for some specific parts of the processor memory region). This is a bit of a student oops if asked to implement an optimized memcpy().

Children