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

Bootloader support #305

Open
chrissnow opened this issue Jul 17, 2024 · 8 comments
Open

Bootloader support #305

chrissnow opened this issue Jul 17, 2024 · 8 comments

Comments

@chrissnow
Copy link

I don't think there is a way to implement bootloaders? mbed-tools was never updated to include it.

ARMmbed/mbed-tools#156
ARMmbed/mbed-tools#315

The give away is this in the configure

WARNING: You are attempting to override an undefined config parameter target.header_format.
It is an error to override an undefined configuration parameter. Please check your target_overrides are correct.
The parameter target.header_format will not be added to the configuration.
WARNING: You are attempting to override an undefined config parameter target.bootloader_img.
It is an error to override an undefined configuration parameter. Please check your target_overrides are correct.
The parameter target.bootloader_img will not be added to the configuration.

How complicated to implement this would it be? I could work around it if too complex.

There was once talk in mbed of supporting mcuboot as it has a lot of nice features.
https://docs.mcuboot.com/

@multiplemonomials
Copy link
Collaborator

I should have some updates about this within the next week or two! Currently the CMake build system (started by ARM, improved by us) does not support this, but it can, someday.

@multiplemonomials
Copy link
Collaborator

multiplemonomials commented Jul 19, 2024

However, I will admit, it's probably a 1-2 years away thing, not a few months thing, unless someone is interested in working on it now!

@multiplemonomials
Copy link
Collaborator

To provide an update, since the merging of the memory banks PR, progress is being made on this. It is now possible for Mbed targets to coeexist with a bootloader, if the target's linker script uses MBED_CONFIGURED_ROM_BANK_x_START/SIZE variables to size its flash region. If that is the case, you can use the memory_bank_config section in mbed_app.json to reconfigure your target's flash bank to a different size, enabling a bootloader to be installed at the start of flash.

However, the majority of targets still don't have linker scripts that make use of these defines.

@multiplemonomials
Copy link
Collaborator

@timIdeaTech ^

@JohnK1987
Copy link
Member

Okay, what features should the MbedCE bootloader have?
ARM Mbed had two options

  1. managed bootloader - the bootloader is always at start of ROM and application/s follow after it. Maybe a app header included, not sure.
  2. unmaneged bootloader - any other variant what does not meet the managed bootloader option

From my point of view the first one is very simple and enough for most of applications.
With latest modification on STM32H7 (memory banks, linker scripts) seems to be easy to do this.
There are probably missing only some scripts:

  • script for padding of empty place in rest of reserved sectors. Probably important for second point and for possibility of checksums.
  • script for merging two binaries into one. Probably necessary for first default app deploy.

@timIdeaTech
Copy link

@JohnK1987 I've only done one mbed project with bootloader support and it used the managed option, and then only using minimal managed support. Basically I just used the target.restrict_size in the bootloader and target.bootloader_img in the applications. The mbed-os build system of course created all three combinations of binaries: bootloader, app and bootloader+app.

It is/was an STM32L433 and STM32H743 dual processor design using a common custom targeted bootloader, where each micro had it's own Littlefilesystem2 NOR Flash. The app bin file and a bootloader trigger descriptor file (bin file name pointer and checksum) would be put in the root or predefined directory for a reboot/power-on update. This design didn't get out of development and by no means was complete. It required an embedded CLI in the app binary to load the files from any of a number of CLI enabled ports.

I only recount this to give you an idea where I got to and this was by no means where I wanted it or complete. I have only scratched the surface on MCUboot which I see has been brought up a few times and looks interesting. I'm all for keeping the overall design simple, but effective for most cases, and better yet an example project along the lines of the custom targets example. Some form of checksum and size checking on the app binary would be useful and maybe a mechanism for the the application to find the bootloader revision. I wish I could give this some gray matter time but got a little busy as of late and the mbed-os to mbed-ce port of the above project got put on hold.

@multiplemonomials
Copy link
Collaborator

@zhiyong-ft has contacted me about restoring mcuboot support, and we are going to try and work together on this effort. I at least got mcuboot building! https://github.com/mbed-ce/mbed-mcuboot-bootloader

@JohnK1987
Copy link
Member

Ok, that mean the mcuboot will be official bootdloader for MbedCE and no other solution is necessary, right? But that also mean someone will must update mbed port with every mcuboot release, I suppose.

@mbed-ce mbed-ce deleted a comment from lefebvresam Dec 7, 2024
@mbed-ce mbed-ce deleted a comment from lefebvresam Dec 7, 2024
@mbed-ce mbed-ce deleted a comment from lefebvresam Dec 7, 2024
@mbed-ce mbed-ce deleted a comment from lefebvresam Dec 7, 2024
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

No branches or pull requests

4 participants