Maximum size of DCD after adding padding on i.MX7
Lech Perczak
l.perczak at camlintechnologies.com
Fri Dec 4 18:48:01 CET 2020
Hello,
When bringing up a new board based on i.MX7D, I stumbled upon an ABI incompatibility between U-Boot,
and a boot-ROM plugin used to select and execute DCD, that was caused by the following commit:
699279cac0ed0816433e0922aba26fe6dd0a8066 ("tools: mkimage: fix imximage header size") [1]
My configuration has worked previously with i.MX6, which shares the DCD format and constraints with i.MX7.
This change concerns me for the following reasons:
- Compatibility between i.MX boot-ROM plugin and U-boot,
- I need to maintain ABI compatibility between U-boot and SPL.
- DCD is copied to OCRAM by boot-ROM, and it either wouldn't be copied in whole, or worse,
overwrite boot-ROM state if size specified in header is greater than allowed maximum -
and 'imximage' always generates DCD images of the maximum size as defined by dcd_v2_t.
Although, the first seems more likely.
Before [1], sizeof(dcd_v2_t) was 1768 bytes, and this is the maximum size specified by [2] and [3]:
"The DCD table shown below is a big-endian byte array of the allowable DCD commands.
The maximum size of the DCD is limited to 1768 B."
After [1] is applied, then sizeof(dcd_v2_t) grows to 1772 bytes.
This is not only not aligned to 8 byte boundary as the commit message tells,
but is out of specification for i.MX7 [2] and i.MX6 [3].
So, the main question is - which value is correct? 1768 or 1772 bytes?
I wrote a simple static assertion to check for that (in include/imximage.h, after definition of dcd_v2_t), and it passes after introducing [1]:
_Static_assert (sizeof(dcd_v2_t) == 1772, "DCD size mismatch");
Secondary question is: If [1] is correct, then shouldn't the DCD header be counted in?
After [1], DCD payload itself take up 1768 bytes indeed.
According to [4], DCD length specified in header itself includes the header:
Tag: A single-byte field set to 0xD2
Length: a two-byte field in the big-endian format containing the overall length of the DCD
(in bytes) including the header
Version: A single-byte field set to 0x41
I fixed my issue by reverting this commit locally for the time being,
but I'd still like to keep the tree as close to upstream as possible.
Any information on the topic would be greatly appreciated.
[1] https://gitlab.denx.de/u-boot/u-boot/-/commit/699279cac0ed0816433e0922aba26fe6dd0a8066
[2] "i.MX 7Dual Applications Processor Reference Manual" paragraph 6.6.7.2
[3] "i.MX 6Dual/6Quad Applications Processor Reference Manual" paragraph 8.6.2
[4] "i.MX 7Dual Applications Processor Reference Manual" figure 6-43. DCD header format
--
Pozdrawiam/With kind regards,
Lech Perczak
Sr. Software Engineer
Camlin Technologies Poland Limited Sp. z o.o.
More information about the U-Boot
mailing list