PDA

View Full Version : GCC/ARM: halfwords alignment



wumpus
10-09-2003, 10:28 AM
Hi!

I need a byte (uint8 ) array to be aligned on a 2 byte (uint16) boundary. This is for speed reasons, but also because my MDI blit just won't work otherwise without all kinds of kludges and shifts.


uint8 __attribute__((align(2))) blaatschaap[] = {0x02, 0x70, 0x0D, 0x00}; /* MDI execute tests packet */

This does not work, the gcc complains that "attribute align is ignored". And indeed. It is ignored. Why?

g3gg0
10-09-2003, 04:04 PM
Hi!

I need a byte (uint8 ) array to be aligned on a 2 byte (uint16) boundary. This is for speed reasons, but also because my MDI blit just won't work otherwise without all kinds of kludges and shifts.


uint8 __attribute__((align(2))) blaatschaap[] = {0x02, 0x70, 0x0D, 0x00}; /* MDI execute tests packet */

This does not work, the gcc complains that "attribute align is ignored". And indeed. It is ignored. Why?

if u do it in a short(16)?
AlexD and i did it this way... 0x0270, 0x0d00, ...

EDIT:
hmm isnt it "aligned(2)" ??

wumpus
10-09-2003, 04:14 PM
if u do it in a short(16)?
AlexD and i did it this way... 0x0270, 0x0d00, ...

EDIT:
hmm isnt it "aligned(2)" ??
For DSP Code, this makes perfect sense, but for MDI packets.. they are not halfword-oriented at all (as they contain FBUS/GSM parameters/etc..) But it works and there might be no other choice..

I'll try the aligned(2), thanks!