Hi Wolfgang,

On Monday 16 May 2011 05:18 PM, Wolfgang Denk wrote:
> Dear Aneesh V,
>
...
>
>>>> +struct ch_toc {
>>>> +  uint32_t section_offset;
>>>> +  uint32_t section_size;
>>>> +  uint8_t unused[12];
>>>> +  uint8_t section_name[12];
>>>> +} __attribute__ ((__packed__));
>>>> +
>>>> +struct ch_settings {
>>>> +  uint32_t section_key;
>>>> +  uint8_t valid;
>>>> +  uint8_t version;
>>>> +  uint16_t reserved;
>>>> +  uint32_t flags;
>>>> +} __attribute__ ((__packed__));
>>>> +
>>>> +struct gp_header {
>>>> +  uint32_t size;
>>>> +  uint32_t load_addr;
>>>> +} __attribute__ ((__packed__));
>>>
>>> Is there any good reason to have these "__attribute__ ((__packed__))"
>>> here?  In general, these are only known to cause trouble and pain, and
>>> I cannot see a need here.
>>
>> ROM code expects the header in a precise format. I think it will not be
>> safe to leave it to the compiler to decide the field layout. For
>> instance, the compiler may align the uint8_t or uint16_t to 32 bit
>> boundary and that will break the Configuration Header.
>
> No. Not in the structs listed above.

You mean "__packed__" should be removed from "struct gp_header" alone,
not from the other structs?

best regards,
Aneesh
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to