From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8721 invoked by alias); 9 Jan 2008 21:55:50 -0000 Received: (qmail 8711 invoked by uid 22791); 9 Jan 2008 21:55:49 -0000 X-Spam-Check-By: sourceware.org Received: from rv-out-0910.google.com (HELO rv-out-0910.google.com) (209.85.198.190) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 21:55:16 +0000 Received: by rv-out-0910.google.com with SMTP id c27so552269rvf.6 for ; Wed, 09 Jan 2008 13:55:15 -0800 (PST) Received: by 10.141.205.10 with SMTP id h10mr748790rvq.110.1199915714928; Wed, 09 Jan 2008 13:55:14 -0800 (PST) Received: by 10.140.170.2 with HTTP; Wed, 9 Jan 2008 13:55:14 -0800 (PST) Message-ID: <7b2a34230801091355n355da963lce9b0264e1c99653@mail.gmail.com> Date: Wed, 09 Jan 2008 21:55:00 -0000 From: "Bronislav Gabrhelik" To: thekyz@gmail.com Cc: "eCos discuss mailing list" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4784DF5F.8000903@kuantic.com> 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/msg00034.txt.bz2 Beware of bad alignment of timestamp field. Some processors might raise an exception/interrupt when you use the int like operation directly on field (including assignment & evaluation). You should copy out/in this by memcpy into/from temporary variable of the same type when you need to do some integer computing on this field. In other case your code might not be portable. Best Regards Bronislav Gabrhelik 2008/1/9, Alexandre : > Thanks a lot to all of you, > > I'm gonna try what you wrote to see if it works Olaf, but what Andrew > told me resolved the problem. My structure is now defined like this: > > typedef struct __attribute__ ((__packed__)) s_pelco_pattern_array{ > cyg_uint8 command2_byte; > cyg_uint8 data3; > cyg_uint8 data4; > cyg_uint16 timestamp; > } pelco_pattern_array; > > and is actually 5 bytes large :) > > I was reffering to this page of the gcc doc for the "pack" pragma and > thought it would work, maybe what Bernard pointed should also help > resolve the problem about the pragma: > > http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html > > Again, thanks a lot, i'm still gonna push a little my research on this > matter and i'll get you all updated. > > Alex Garcia > Hymatom SA > > PS: Sorry for the double mail Bernard :( > > -- > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss > > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss