public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "EXTERNAL Gladis Olaf (Praktikant; CR/AEM)" <external.Olaf.Gladis@de.bosch.com>
To: <thekyz@gmail.com>, 	"ecos-discuss" <ecos-discuss@ecos.sourceware.org>
Subject: RE: [ECOS] pragma pack
Date: Wed, 09 Jan 2008 15:02:00 -0000	[thread overview]
Message-ID: <F6E0DC7B316B5342918DD39721EE25B101C9FFEE@si-mail07.de.bosch.com> (raw)
In-Reply-To: <d5aafeec0801090619h67034bddkb7cd7c515c272418@mail.gmail.com>

Sorry forget to reply to all:

Hi Alex,

I am not 100% sure but i think you have to write it like this:

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

You have to add push and pop in you code.
So try this and write if this is helping you.

Greets

Olaf Gladis 

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alexandre
Sent: Mittwoch, 9. Januar 2008 15:19
To: ecos-discuss
Subject: [ECOS] pragma pack

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


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

      parent reply	other threads:[~2008-01-09 15:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 14:19 Alexandre
2008-01-09 14:40 ` Andrew Lunn
2008-01-09 14:51 ` Bernard Fouché
2008-01-09 14:56   ` Alexandre
2008-01-09 21:55     ` Bronislav Gabrhelik
2008-01-09 22:22       ` Paul D. DeRocco
2008-01-09 23:50         ` [ECOS] " Grant Edwards
2008-01-10  0:50           ` Paul D. DeRocco
2008-01-10  9:43             ` Alexandre
2008-01-10 10:07               ` EXTERNAL Gladis Olaf (Praktikant; CR/AEM)
2008-01-10 10:29                 ` Alexandre
2008-01-09 15:02 ` EXTERNAL Gladis Olaf (Praktikant; CR/AEM) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F6E0DC7B316B5342918DD39721EE25B101C9FFEE@si-mail07.de.bosch.com \
    --to=external.olaf.gladis@de.bosch.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=thekyz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).