Dear all,
I am trying to figure out why gcc always aligns on 4 bytes boundaries (32 bits)
on arm-elf-gcc in an attempt to reduce code footprint. I found that GCC produces
much bigger code than ADS (30 to 50 %) when ARM and THUMB are mixed
(interworking enabled) on our project.
It indeed seems that ARM ADS 1.2 aligns on halfwords (16 bits) when in THUMB
mode (along with much more sophisticated rules). GCC different behavior causes
much more padding to be inserted in structs members and, as the project I work
on uses HW mapped registers, application crashes.
For now, I worked around that using a compile time define to enable the
__attribute((packed))__ on the struct(s). I would nevertheless like to know
whether there is another solution.
I am also digging into the arm.h and arm.c files (thanks to the gcc's internal
manual) to try to change the alignment behavior.
Could you give me other ideas/solutions on that point?
Thanks for your consideration,
Vincent