From: "Barbier, Renaud" <Renaud.Barbier@ametek.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: ARM: Packed structure
Date: Wed, 2 Mar 2022 16:29:44 +0000 [thread overview]
Message-ID: <MN2PR16MB31350C9F693E21BF29D24D1791039@MN2PR16MB3135.namprd16.prod.outlook.com> (raw)
I am building a boot loader (barebox) with gcc 10.2.0 for a NXP LS1021A for which I intend to use SPD.
The SPD structure for DDR3 (struct ddr3_spd_eeprom )can be found here: https://git.pengutronix.de/cgit/barebox/tree/include/ddr_spd.h
The problem I have is that the field after the union are not packed:
....
} registered;
unsigned char uc[57]; /* 60-116 Module-Specific Section */ ==> uc[56] is at the right place offset 116
} mod_section;
/* Unique Module ID: Bytes 117-125 */
unsigned char mmid_lsb; /* 117 Module MfgID Code LSB - JEP-106 */ ===> mmid_lsb end up at offset 120 instead of offset 117
I tried the __packed attribute without effect
This is the debug output showing the offset from the start of SPD structure:
uc[56]@ = 0x1000e2cc, 116
mmid_lsb@ = 0x1000e2d0, 120 ==> should be 117.
Is there a bug in 10.2.0 that I have not found or a parameter I have not used to build the boot loader that could fix this problem.
Cheers,
R
next reply other threads:[~2022-03-02 16:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 16:29 Barbier, Renaud [this message]
2022-03-02 21:07 ` David Brown
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=MN2PR16MB31350C9F693E21BF29D24D1791039@MN2PR16MB3135.namprd16.prod.outlook.com \
--to=renaud.barbier@ametek.com \
--cc=gcc-help@gcc.gnu.org \
/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).