-
Notifications
You must be signed in to change notification settings - Fork 3k
Reserve and Render header in managed BL mode #5950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@thegecko @JoeTheGuitarist Could you tag a bunch of people on this? Update and Client teams need to test this for themselves. |
09ca7e7
to
17291bf
Compare
17291bf
to
c0f1080
Compare
@evedon @LiyouZhou Can you guide @teetak01 and @saheerb on how they can test this PR with client test setup ? |
It's very elegant. I do have one question about the calculation of CRCs. At the moment we are calculating the CRC by generating it for all fields up to but not including the CRC field itself. Although there is currently no need to generate it by including the CRC field itself, all zeroed, is there a way to do this - it was done this way in the past, so might reappear for some reason. |
Some minor things: "and and
|
@seankinghan I could calculate any digests as "up to their start address", or "all uncomputed checksums are 0s" Which would you prefer? |
In this particular case of the header CRC it needs to be "up to". Whether or not that applies to, for example, a version 1 header, I don't know. Let me get back to you. |
c0f1080
to
7726c49
Compare
In connection with validating this change, we are trying to create a build with this new capability, and having some issues. I think. @theotherjimmy would you mind taking a look at this PR and letting me know what we are doing wrong, if it is at all evident? https://github.com/ARMmbed/mbed-cloud-client-example-internal/pull/280 |
@seankinghan Discussion has moved to the referenced thread, and is progressing there. |
a1d50df
to
7c7171d
Compare
19fcf0f
to
acb37cb
Compare
9b732fc
to
4f4e645
Compare
What's the status with this PR ? We need this in mbed OS 5.8. |
@yogpan01 This PR is stalled awaiting confirmation that it will resolve the requirements for using managed BL mode in Mbed Client / Update Client for the near future. See the appropriate prototype PRs in those repos for more details. |
In that case they are actually a lot more consistent and communicative than they were originally, good. |
@sarahmarshy Review please. |
/morph build |
Build : FAILUREBuild number : 1301 |
License failure |
Build : SUCCESSBuild number : 1302 Triggering tests/morph test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM. No glaring problems. My only feedback would be to add a few more comments.
size = self._header_size(header_format) | ||
region = Region("header", start, size, False, None) | ||
start += size | ||
start = ((start + 7) // 8) * 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain this logic in a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty standard "round up to a multiple of 8" logic. Do you want an explanation of why 8 or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I got that it is a round up to a multiple of 8, but I haven't seen it that often so had to logic it out myself. I think just a comment saying "round up to multiple of 8" would help people who haven't seen it before. Or you could add a comment for the entire function about the region it returns/its alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a strong preference for commenting the entire function. I'll do that, if you don't mind.
Exporter Build : SUCCESSBuild number : 962 |
Test : SUCCESSBuild number : 1086 |
Need a check mark from a reviewer. |
CI has passed but this is blocked pending review approval from one of: |
Bogdan has approved this so I am also doing so to allow for merging |
@theotherjimmy Is there documentation for this feature yet? |
@AGlass0fMilk Does this page not fit the bill? |
Thanks @cmonr I wasn’t sure what part of the handbook might already pertain to this. |
Detailed Design
The header specification is a JSON ordered list of
JSON tuples in the
target.header_format
configu-ration key. The tuple represents a single element of
the header format as first the name (a valid C identi-
fier), then a type, a subtype and finally a single argu-
ment. For example, the const type defines subtypes
for common sizes of constants, including the 32 sub-
type that indicates the constant will be represented
as 32 bits. The following is a list of all types and
subtypes that we plan to support.
const
A constant value.8be
A value represented as 8 bits.16be
A value represented as 16 bits big endian.32be
A value represented as 32 bits big endian.64be
A value represented as 64 bits big endian.8le
A value represented as 8 bits.16le
A value represented as 16 bits little endian.32le
A value represented as 32 bits little endian.64le
A value represented as 64 bits little endian.timestamp
A time stamp value, in seconds fromepoch in the timezone GMT/UTC.
This type’s argument is always null.
64be
A time stamp value truncated to 64 bits big endian.64le
A time stamp value truncated to 64 bits ilttle endian.digest
A digest of an image. All digests arecomputed in the order they appear. A digest of the header
digests the header up to its start address.
CRCITT32be
A big endian 32bit checksum of an image.CRCITT32be
A little endian 32bit checksum of an image.SHA256
A SHA-2 using a block-size of 256bits.
SHA512
A SHA-2 using a block-size of 512bits.
size
The size of a list of images, added together.32be
A size represented as 32 bits big endian.64be
A size represented as 64 bits big endain.32le
A size represented as 32 bits little endian.64le
A size represented as 64 bits little endain.The addition of new types and new subtypes must
come in a feature release.
Items in the header are packed starting where
the previous field ended; Items in the header are
packed using the C “packed” struct semantics. The
presence of the target.header format field de-
fines two macros
MBED_HEADER_START
, which expandsto the start address of the firmware header, and
MBED_HEADER_SIZE
, containing the size in bytes ofthe firmware header.The region following the
application header starts at
MBED_HEADER_START + MBED_HEADER_SIZE
rounded up to a multiple of 8
bytes.
Example
I wrote up a
mbed_lib.json
that covers a firmware header I have seen.The JSON description follows.
This produces a header as follows:
For reference the application compiled to
0xbf90
bytes. which makes application + header0xc000
bytes.The header's hex dump is as follows:
TODO