From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] Add bmp_layout module for accessing BMP header data
Date: Tue, 05 Feb 2013 00:11:07 +0100 [thread overview]
Message-ID: <20130204231107.17DEB2001AD@gemini.denx.de> (raw)
In-Reply-To: <20130204222628.545da91e@lilith>
Dear Albert ARIBAUD,
In message <20130204222628.545da91e@lilith> you wrote:
>
> The point about md not checking alignment is indeed valid: one should
> know that a md.l requires a 4-byte-aligned address or it will abort.
Or, one might do this _intentionally_ for some testing purposes.
For me it is of utmost importance that U-Boot does not come in my way
in such things. It is supposed to do _exactly_ what I ask it to do,
even if this appears to be a stupid thing.
> OTOH, a cautious user may think that to ensure proper alignment, a BMP
> should be loaded on a 4-byte boundary, but IIUC that it precisely what
> will cause the load to fail, due to the sole 4-byte field of the BMP
> header being misaligned by two bytes.
Sole 4 byte field? The bitmap file header has actually two 32-bit
entries: file_size, and data_offset. [The "reserved" entry as we are
using it should actually be two 16 bit entries, at least according to
[1]).
Yes, struct bmp_header is a packed array with non-natural order of
entries; see also section "Bitmap file header" at [1]; we may consider
this a really stupid thing to do, but we have to live with this fact.
[1] http://en.wikipedia.org/wiki/BMP_file_format
As I understand the problem comes from the fact, that this issue has
long been undetected, because the PTB that were/are responsible for
GCC on ARM had decided that any access to apacked structure would be
silently broken down into byte accesses, no matter what the actual
data type was. While more recent versions of GCC started actually
attempting 16 or 32 bit accesses, which failed on some systems.
> So if we leave BMP loading as it is now, the load address will need to
> be 16-bit-but-not-32-bit-aligned, which is complicated enough to
> require documentation.
Indeed, this should be documented. And eventually the bmp command
should print a warning message if it sees other alignment.
> Or, the BMP struct could be prepended with two bytes so that the
> load address alignment requirement becomes a simple 4-byte boundary,
> which most users are... bound... to choose naturally.
That would violate the "standard" defining the BMP header structure.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of anthropomorphic terminology when dealing with computing
systems is a symptom of professional immaturity. -- Edsger Dijkstra
next prev parent reply other threads:[~2013-02-04 23:11 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 11:39 [U-Boot] [PATCH 0/5] Create an API for safely accessing BMP header fields Nikita Kiryanov
2013-02-04 11:39 ` [U-Boot] [PATCH 1/5] Add bmp_layout module for accessing BMP header data Nikita Kiryanov
2013-02-04 19:26 ` Wolfgang Denk
2013-02-04 21:26 ` Albert ARIBAUD
2013-02-04 23:11 ` Wolfgang Denk [this message]
2013-02-05 8:07 ` Igor Grinberg
2013-02-05 9:57 ` Wolfgang Denk
2013-02-05 11:38 ` Igor Grinberg
2013-02-05 13:20 ` Wolfgang Denk
2013-02-05 14:49 ` Igor Grinberg
2013-02-05 19:27 ` Wolfgang Denk
2013-02-05 6:52 ` Nikita Kiryanov
2013-02-05 9:47 ` Wolfgang Denk
2013-02-04 11:39 ` [U-Boot] [PATCH 2/5] lcd: use bmp_layout API Nikita Kiryanov
2013-02-04 11:39 ` [U-Boot] [PATCH 3/5] cmd_bmp: " Nikita Kiryanov
2013-02-04 11:39 ` [U-Boot] [PATCH 4/5] video/cfb_console: " Nikita Kiryanov
2013-02-04 11:39 ` [U-Boot] [PATCH 5/5] video/bus_vcxk: " Nikita Kiryanov
2013-02-04 11:57 ` [U-Boot] [PATCH 0/5] Create an API for safely accessing BMP header fields Albert ARIBAUD
2013-02-04 12:37 ` Nikita Kiryanov
2013-02-04 14:19 ` Albert ARIBAUD
2013-02-04 15:07 ` Nikita Kiryanov
2013-02-04 15:25 ` Albert ARIBAUD
2013-02-04 20:48 ` Wolfgang Denk
2013-02-05 7:20 ` Nikita Kiryanov
2013-02-04 20:39 ` Wolfgang Denk
2013-02-05 14:58 ` Tom Rini
2013-02-05 19:37 ` Albert ARIBAUD
2013-02-04 20:35 ` Wolfgang Denk
2013-02-04 21:02 ` Jeroen Hofstee
2013-02-05 7:39 ` Igor Grinberg
2013-02-05 6:53 ` Igor Grinberg
2013-02-05 7:22 ` Nikita Kiryanov
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=20130204231107.17DEB2001AD@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/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