Skip to content
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

Fix readme #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix readme #12

wants to merge 2 commits into from

Conversation

boraozgen
Copy link
Collaborator

Fixes #10

@@ -181,8 +187,6 @@ Explanation of each option:
- `--header-size 4096`: this must be the same as the value specified in `mcuboot.header-size` configuration (4096 bytes by default)
- `--pad-header`: this tells imgtool to insert the entire header, including any necessary padding bytes.
- `-S 0xC0000`: this specifies the maximum size of the application ("slot size"). It **must** be the same as the configured `mcuboot.slot-size`!
- `--pad`: this should only be used for binaries you plan on initially flashing to your target at the factory. It pads the resulting binary to the slot size and adds initialized trailer TLVs. This is not needed for update binaries.
Copy link
Owner

Choose a reason for hiding this comment

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

@boraozgen Have you tested this? It was my impression that the trailer TLVs are not appended by imgtool to the signed binary unless the --pad flag is included. I will have to test booting an application that has been signed without the --pad flag...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not use --pad at all, it works fine.

Copy link
Collaborator Author

@boraozgen boraozgen May 12, 2021

Choose a reason for hiding this comment

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

In my experience --pad pads the image to fit the slot and adds the trailers just before the end of the slot. I don't know what would be a use case for this.

Copy link
Contributor

@LDong-Arm LDong-Arm Aug 24, 2021

Choose a reason for hiding this comment

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

The --pad option causes problems on DISCO_L475VG_IOT01A. I still don't fully understand how it works, but if we want to put the board in a clean state, it's way more reliable to erase the chip

pyocd erase --chip

Then run the demo from beginning to end, without --pad.

Copy link
Contributor

@LDong-Arm LDong-Arm Aug 24, 2021

Choose a reason for hiding this comment

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

The latest MCUboot documentation explains it:

The optional --pad argument will place a trailer on the image that indicates that the image should be considered an upgrade. Writing this image in the secondary slot will then cause the bootloader to upgrade to it.

So it's intended for the secondary slot only, and

  • without --pad, the current application needs to call boot_set_pending() to active the secondary image and let MCUboot apply it.
  • with --pad, the secondary image already comes pre-activated, so MCUboot will apply it.
  • will --pad --confirm, the secondary image comes pre-activated and pre-confirmed, so MCUboot will apply it and there will be no need to boot_set_confirmed() afterwards.

It's no replacement for erasing the primary slot into a clean state by ourselves (or the manufacturing process).

Copy link
Contributor

@LDong-Arm LDong-Arm Aug 24, 2021

Choose a reason for hiding this comment

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

So before flashing the initial primary image at the factory, it's the manufacturer's responsibility to put the chip in a clean state by erasing it. Using pyocd erase --chip is what we can do with Mbed boards. It makes sense that MCUboot doesn't provide a utility to clean up the primary slot, because it should be a prerequisite before we even place MCUboot onto the board.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pan- FYI, removing this --pad should resolve the problem you encountered.

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.

Readme clarifications
3 participants