dear All,
i started an arm cortex m3 project using eclipse+gnu.
i want to size boundary of the structure alignment.
where and how i can do it?
thanks and regards,
Ras
Hi Ras,
it would be possible if the structure size is a positive power of 2.
For example, the code
struct struct1 {
int i[10];// 40 bytes
char c[24];// 24 bytes
};
struct struct1 __attribute__ ((aligned(sizeof(struct struct1)))) ic;
int main()
{
ic.i[0]=0x12345678;
ic.c[1]=0x5a;
return 0;
}
would be compiled as the followings.
.text .align 2 .global main .thumb .thumb_func .type main, %functionmain: ldr r3, .L2 ldr r2, .L2+4 str r2, [r3] movs r2, #90 strb r2, [r3, #41] movs r0, #0 bx lr.L3: .align 2.L2: .word ic .word 305419896 .size main, .-main .comm ic,64,64
Is this your intention?
Best regards,
Yasuhiko Koumoto.