mirror of https://github.com/ARMmbed/mbed-os.git
This patch changes the way data is put in the TX_DATA_PORT register when sending packet over Ethernet. When this driver is compiled with release compilation profile (space optimization compiler options) with Arm compiler version 5, the line: SMSC9220->TX_DATA_PORT = *pktptr; generates the assembly instruction to get the pktptr pointed value: LDM r2!, {r3} with pktptr = r2 However, the code does not prevent the pktptr value from being unaligned (to a 32 bits boundary) in that zone and the LDM instruction causes a HardFault if this is the case. When the compiler option is not activated (debug and develop compilation profiles), the compiler generates LDR instruction instead which does not cause a HardFault. The ARM v7-M states page B3-601: "Unaligned load-store multiples and word or halfword exclusive accesses always fault." To face that problem, we check if the data pointer is aligned or not. If it is, we apply the same algorithm than before. If not, a local variable is created and we copy in it, byte per byte, the contents at the unaligned pointer. However, it will impact performances adding 8 instructions (one LD and one ST for each copied byte). Change-Id: I11f6e82ce5521960d2ecf499f718f76fec29c0b0 Signed-off-by: Hugues de Valon <hugues.devalon@arm.com> |
||
---|---|---|
.. | ||
lwipopts_conf.h | ||
mps2_emac.c |