This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: pragma pack


Thanks for the link ^^ I'm a bit dumb when dealing with that kind of things.
The problem is when I put the data in flash and read it thereafter, I
obtain the value 768 for timestamp, which is 300 in hex.
I must have made something wrong there ...

On Jan 10, 2008 11:06 AM, EXTERNAL Gladis Olaf (Praktikant; CR/AEM)
<external.Olaf.Gladis@de.bosch.com> wrote:
>
>
> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alexandre
> Sent: Donnerstag, 10. Januar 2008 10:43
> To: Paul D. DeRocco
> Cc: ecos-discuss@ecos.sourceware.org
> Subject: Re: [ECOS] Re: pragma pack
>
> > Actually i had some problems accessing my packed structures without
> > flows, I think that may help resolve things a bit.
> > Eg with things like that:
> >
> > cyg_uint8 i = 0;
> > struct s_pelco_pattern_array a;
> >
> > a.command2_byte = i++;
> > a.data3 = i++;
> > a.data4 = i++;
> > a.timestamp = i;
> >
> > I finish having a structure which looks like this in memory:
> >
> > cm2: 0x00
> > data3: 0x01
> > data4: 0x02
> > ts: 0x0300
> >
> > Which is really not what i want to have eventually.
> >
>
> I would say this looks correct.
> Maybe you thought there must be 0x0003 in the last one?
>
> But if you have a little endian CPU it swaps the bytes.
> If you have more questions about Endianness take a look at
>
> http://en.wikipedia.org/wiki/Endianness
>
> Greets olaf
>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]