On ARM-based systems you cannot address a 32-bit word that is not aligned to a 4-byte boundary
LDR r0, = 0x1001
LDR r1, [r0]
The second line in the above code will give hard fault since are trying to read 4 bytes but the memory address is not divisible by 4
If we change the second line in above code to the following
LDRB r1, [r0];
//Load 1 byte from address
The above line will not produce a hard fault, since we are trying to access 1 byte(1 byte can be accessed from any memory location)
Also notice the following example;
LDR r0,= 0x1002
LDRH r1,[r0]; //Load half word from 0x1002
References:
- https://lists.denx.de/pipermail/u-boot/2010-October/079003.html
- http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html
沒有留言 :
張貼留言