Hello,
A colleague of mine, while processing some binary data, transfered a RAM memory address to a function. That address was not even (ARM7 architecture) so the LDR instruction behaved exactly as the assembly manual specifies it should in case of a misaligned address - round in the address + some more shift magic, which created a memory access off by 1 byte. My question is: Is there a way to deal with this runtime error in advance?
is that some ARM cores (non Cortex) do not complain at all if an unaligned access is done.
It's not the fault of the core, really. If I remember correctly, the ARM7 core was originally designed to be used in ASICs, and hence does not come with any fancy peripherals (no memory controller). It's up to the chip designer to include (or omit, if minimal gate count/power consumption is required) these.
Then again, producing a misaligned access in C requires playing fast and loose with pointers.