[ECOS] pragma pack

Alexandre thekyz@gmail.com
Wed Jan 9 14:19:00 GMT 2008


Hi everybody (and happy new year would i add),

I'd like to use the pragma pack(1) in one of my applications to align
properly a 5 bytes structures array into flash.
I know that packing reduces greatly the performances of the system but
performance is not really my problem here as i'm actually looking for
more memory and would greatly need to pack things up a little bit.

I tried to declare the next structure as shown, with the pragmas, but
it's still 8 bytes large, either read with a sizeof(pelco_pattern) or
after being written in rom:

#pragma pack(1)
typedef struct {
   cyg_uint8 command2_byte;
   cyg_uint8 data3;
   cyg_uint8 data4;
   cyg_uint16 timestamp;
} pelco_pattern;
#pragma pack()


Am I doing something wrong here ? Is it even possible to use "pack"'s
pragmas within ecos ? Am I missing some compiler directives ?

I am using the arm-elf-gcc compiler and the lpc2xxx / arm version of ecos.
The compiler does not say anything about the line with the pragma in it.

Thanks in advance for you answers ^^

Alex Garcia
Hymatom SA

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list