Skip to content

Conversation

ndrs-pst
Copy link
Contributor

@ndrs-pst ndrs-pst commented Jul 4, 2020

Summary of changes

According to this post in forum
https://forums.mbed.com/t/enable-to-merge-header-region-into-update-binary/8936
@adbridge suggest me to make pull-request.

Impact of changes

If enable Header in managed bootloader then update binary will contain header region

Migration actions required

N/A

Documentation

https://os.mbed.com/docs/mbed-os/v6.1/program-setup/creating-and-using-a-bootloader.html
May need to change document about update image which having header area bundle with.


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom requested review from a team July 4, 2020 09:00
@ciarmcom
Copy link
Member

ciarmcom commented Jul 4, 2020

@ndrs-pst, thank you for your changes.
@ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@teetak01 teetak01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ndrs-pst

Adding the header by default without any new flagging/configuration introduced, will also mean that also the unmanaged mode will be changed.

Pelion Device Management Client update uses unmanaged mode and does not expect to find header as part of the update image, thus this would be a breaking change.

To test with Pelion you can try the basic tutorial: https://www.pelion.com/docs/device-management/current/connecting/mbed-os.html

cc: @alzix

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 6, 2020

I recall seeing this before in pull request, there might be also an issue but couldn't locate it now. We should find it.

@ndrs-pst
Copy link
Contributor Author

ndrs-pst commented Jul 7, 2020

@teetak01
Thanks for your reply.
I just feel conflict in logical of managed bootloader image when enable "header" as followings :

  1. final image : bootloader + header + application.
  2. update image : why only application, not (header + application)
    Since APPLICATION_ADDR == HEADER_ADDR + HEADER_SIZE so I expected update image contain header area
    then bootloader can look and verifies application without getting header information from others way.

@alzix
Copy link
Contributor

alzix commented Jul 7, 2020

@ndrs-pst,
the build today produces 3 build artifacts :

  1. <name>.bin - combined image (bootloader + header + application)
  2. <name>_update.bin - just the application part
  3. <name>_application.bin - same as <name>_update.bin

I think tweaking _update.bin to include the headers does make sense.

But, it is kind of a breaking change for Pelion OTA.
Pelion OTA library and tools assume only the firmware image is present in update binary, while image header is added by the library on a device .

Please refer to "device managment" commands in mbed-cli https://github.com/ARMmbed/mbed-cli/blob/master/mbed/mbed.py#L3047
You may also need to tweak https://github.com/ARMmbed/mbed-os/blob/master/tools/utils.py#L600

0xc0170, please note this can not go in in a patch release.

@teetak01
Copy link
Contributor

teetak01 commented Jul 7, 2020

Well, I would prefer not to do it like this at all, for breaking the expected behaviour (documentation and tooling), but as Pelion OTA uses FEATURE_BOOTLOADER, this could be done when that feature is not defined?

Or then it would be Mbed OS 7 change at minimum.

@ndrs-pst
Copy link
Contributor Author

ndrs-pst commented Jul 7, 2020

@alzix
so the Pelion OTA use _update.bin right ?
Then why don't we just add header into _application.bin instead ?
Otherwise, would you suggest the recommend way so that bootloader can verify the integrity of the application (without using Pelion OTA).

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 9, 2020

Thanks for the reviews. I marked this as breaking. As noted, if this should get in, it shall wait until we get another major version (we just released Mbed 6, will not happen that quick).

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 22, 2020

@ARMmbed/mbed-os-tools could you review as well?

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 11, 2020

Regarding the latest development in the tools (see #13349), I'll close the pull request, this should be discussed as the feature request for the new tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants