Hi,
I have done a couple of tests more and wanted to share the results.
If I don't use struct packing attribute, the compiler does himself the
padding and uses ldrh/strh without problem.
If I do use packing with my struct, then the compiler trusts you with
struct alignment and everything but takes himself another measure and
performes the word-wise (2 byte) operations with byte-wise code
(ldrb/strb)..
Best,
Bekir
________________________________
Von: A...@yahoogroups.com [mailto:A...@yahoogroups.com] Im Auftrag
von Foltos
Gesendet: Dienstag, 8. Juli 2008 11:50
An: A...@yahoogroups.com
Betreff: Re: [AT91SAM] 2 Byte Operations
Hi,
if you access a static address (not a pointer) then the compiler will
see the 16 bite access will fail because the incorrect alignment. So it
is generation code to work around that. The same can happen if you use
packed structs.
Foltos
ICLI, Bekir (EXT) wrote:
Hi all,
I have turned on the mmu alignment checks so that I can catch
the misaligned structs.
But strangely the compiler uses always byte-wise operations
(strb/ldrb) for the 2byte read/writes, where, I thought, it would use
ldrh/ldrb..
This occurs in a strange point where my destination address is
byte-wise aligned (0x10173545) and I am doing a 2 byte operation..
Normally an exception should be thrown by the mmu, right?
Is there a way of telling the compiler that it should use the
corresponding operation (ldr for 4bytes, ldrh for 2 bytes, ldrb 1bytes)?
Regards,
Bekir
------------------------------------

(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )