From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5734 invoked by alias); 9 Jan 2008 14:51:48 -0000 Received: (qmail 5726 invoked by uid 22791); 9 Jan 2008 14:51:47 -0000 X-Spam-Check-By: sourceware.org Received: from gw.kuantic.com (HELO gw.kuantic.com) (213.244.28.44) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 14:51:28 +0000 Received: from [10.0.0.4] (pcbernard.kuantic.com [10.0.0.4]) by gw.kuantic.com (8.14.1/8.14.1) with ESMTP id m09EpOsV014766; Wed, 9 Jan 2008 15:51:24 +0100 Message-ID: <4784DF5F.8000903@kuantic.com> Date: Wed, 09 Jan 2008 14:51:00 -0000 From: =?ISO-8859-1?Q?Bernard_Fouch=E9?= User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: thekyz@gmail.com CC: ecos-discuss References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (gw.kuantic.com [213.244.28.44]); Wed, 09 Jan 2008 15:51:24 +0100 (CET) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] pragma pack X-SW-Source: 2008-01/txt/msg00028.txt.bz2 First try reorganizing your structure to have the biggest item at the beginning, that will avoid 'loosing' intermediary bytes: typedef struct { cyg_uint16 timestamp; cyg_uint8 command2_byte; cyg_uint8 data3; cyg_uint8 data4; } pelco_pattern; Your target may also require that all items have to be 16 bits aligned (that would explain whyt #prama pack(1) gave nothing). In that case try, as you are not looking for speed: typedef struct { cyg_uint16 timestamp; cyg_uint16 command2_byte_and_data3; cyg_uint8 data4; } pelco_pattern; With 16bits alignment you should fall back to a 6 bytes data structure, but you'll need code to manage 'command2_byte' and 'data3', so this will add to your program size, as it will slow processing. Hope it helps! Bernard Alexandre wrote: > 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