OT arm-gcc hadanka

Jan Waclawek konfera na efton.sk
Pondělí Prosinec 29 16:26:35 CET 2014


> 8 a 16?

No, to by som bol prosil, preto je tam ten __attribute__((packed)) (aligned
v tomto pripade je naozaj ignorovane, ako manual slubuje).

Lenze...

>10, 20?

Ved prave.


>
>S ARM-ami nerobim, predpokladam defaultne zarovnanie na 4 byty.


No, lenze potom by sizeof(TBar) mal byt prinajmensom nasobok 4, nie?


Takze druhe kolo, tipnite si, kolko je offsetof(TBar, b).

wek




>
>On 29.12.2014 13:34, Jan Waclawek wrote:
>> arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20131129
>> (release) [ARM/embedded-4_8-branch revision 205641]
>>
>> c:/PROGRA~1/ARMTools/launchpad.net_gcc-arm-embedded/bin/arm-none-eabi-gcc
>> -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb  -I.
>> -Wpadded -MD -MP -MF .dep/ch.o.d ch.c -o objdir/ch.o
>>
>>
>> Aka je vysledna hodnota a a b?
>>
>> wek
>>
>>
>> #include<stdint.h>
>>
>>    typedef struct __attribute__((packed, aligned(1))) {
>>      uint16_t a;
>>      union {
>>        uint32_t b;
>>        uint16_t c[3];
>>      };
>>    } TBar;
>>
>>    typedef struct __attribute__((packed)) {
>>      TBar a;
>>      TBar b;
>>    } TFoo;
>>
>>
>> const uint32_t a = sizeof(TBar);
>> const uint32_t b = sizeof(TFoo);
>>
>> int main(void) {
>> }
>>



Další informace o konferenci Hw-list