Skip to content

Enable post build bootloader merging in uvision #10021

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

Merged
merged 11 commits into from
Apr 12, 2019

Conversation

bridadan
Copy link
Contributor

@bridadan bridadan commented Mar 8, 2019

Description

This PR enables the following:

  • Header generation and bootloader merging after building with Uvision
  • Flashing of the complete merged image when debugging
  • Debugging with the proper symbols loaded

This could probably use some more testing on my end. I recently had to a big rebase to get this up to speed with master and the application I was using to test is not compatible with the master branch.

Fairly confident this is now in working order after doing quite a bit of testing offline. There are some other issues with the uvision exporter at the moment. Some of them are being addressed in #10045 (which this PR depends on). I've raised #10045 separately because those fixes are higher priority than the feature added in this PR.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@theotherjimmy @SenRamakri @dlfryar

Release Notes

Offline projects that use the managed bootloader mode (as is the case for all Pelion Device Management projects using the update capability) should now be able to export and debug properly in uVision. A post build script is now enabled which takes care of the header generation, binary merging, and loading of the correct symbols for your application. This only allows debugging the application, not the bootloader.

Note: This feature is only enabled when exporting offline with Mbed CLI. This is because the post build script has a dependency on the Mbed OS tools and their Python dependencies. This means projects exported from the Online Compiler will not be able to use this capability.

@ciarmcom ciarmcom requested review from dlfryar-zz, SenRamakri, theotherjimmy and a team March 9, 2019 00:00
@ciarmcom
Copy link
Member

ciarmcom commented Mar 9, 2019

@bridadan, thank you for your changes.
@SenRamakri @theotherjimmy @dlfryar @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@theotherjimmy
Copy link
Contributor

@bridadan This also requires the tools directory in the exported project.

@bridadan
Copy link
Contributor Author

bridadan commented Mar 11, 2019

@theotherjimmy, very true. Is this currently omitted when exporting Mbed OS 5 projects from the online compiler? I realize the tools directory would not be present in Mbed OS 2 projects, but those projects can't/shouldn't be using managed bootloader?

@theotherjimmy
Copy link
Contributor

@bridadan Yes, there is an .mbedignore file in the root of the tools dir.

@theotherjimmy
Copy link
Contributor

@bridadan mbed2 docs don't say anything about managed bootloader mode, but nothing is stopping them from using it. I don't think we need to worry about that though.

@bridadan
Copy link
Contributor Author

@bridadan Yes, there is an .mbedignore file in the root of the tools dir.

Crud you're right. Well I'm open to suggestions! It may be that this is only possible to achieve offline.

@bridadan bridadan force-pushed the uvision_postbuild_regions branch from 90eb3e5 to 0d77cb2 Compare March 12, 2019 00:20
@bridadan bridadan marked this pull request as ready for review March 12, 2019 00:21
@bridadan
Copy link
Contributor Author

bridadan commented Mar 12, 2019

@theotherjimmy oh how about I make the post build script a generated file?

@bridadan
Copy link
Contributor Author

Actually that definitely wouldn't work as is, the post build script has dependencies in the rest of the config system. The way I see it, my options are:

  1. Remove the dependencies on the rest of the tools and treat the post build script as a generated file. This actually doesn't sound too bad looking at regions.py, but it would take longer than I'd like and I'd have duplicate all that functionality in this script.
  2. Add the ability to add directories to exported projects (but not through the Resource class)
  3. Disable the post build script functionality when exporting to a zipped file. I believe the online compiler always uses this path when exporting. This would still enable the feature for offline exports, which I know a few people who would still find this very useful.

Any thoughts on the above options?

@theotherjimmy
Copy link
Contributor

@bridadan I'm down for 3. 1 would need to require that the script is actually not duplicated. I'm not sure that 2 is a good idea. Recent refactors have taken the direction of migrating files into the Resources style of working, so adding yet another way to do the same thing feels like adding tech debt to me.

@bridadan
Copy link
Contributor Author

Ok cool, I'll go with 3 then.

@bridadan
Copy link
Contributor Author

Note to self: update the release notes in the PR description

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2019

@bridadan This needs a rebase.

@bridadan bridadan force-pushed the uvision_postbuild_regions branch from 0d77cb2 to 63155db Compare April 8, 2019 19:44
@bridadan
Copy link
Contributor Author

bridadan commented Apr 8, 2019

Ok @theotherjimmy, I've implemented the option we discussed above (choice 3). I've also updated the release notes to reflect these new changes.

@bridadan
Copy link
Contributor Author

bridadan commented Apr 8, 2019

I should note that in order for the entire uvision exporter to be working 100% fixes from #9966 and #9967 are still needed.

@bridadan bridadan removed the request for review from dlfryar-zz April 9, 2019 19:06
bridadan added 3 commits April 9, 2019 14:08
merge_region_list was changed to do some extra checks regarding the
different regions. It only was checking the "restrict_size" parameter
and not the whole config option. So this reduces the argument down to
just this value. This makes it easier to serialize the data needed for
post build steps after being built in an exported project.
bridadan added 8 commits April 9, 2019 14:08
These files are used when the post build script is enabled to support
projects that are using managed bootloader mode.
Projects that are zipped are typically from the online compiler or they
are meant to be used in a separate environment. Since the postbuild
script requires the Mbed OS tools to present in the project, we will
disable the postbuild script when the project is exported to a zipped
project.
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 10, 2019

Ci started

@mbed-ci
Copy link

mbed-ci commented Apr 10, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr merged commit 3bda0ef into ARMmbed:master Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants