Skip to content

Let libraries, targets configure bootloader #5909

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 6 commits into from
Feb 1, 2018

Conversation

theotherjimmy
Copy link
Contributor

@theotherjimmy theotherjimmy commented Jan 23, 2018

Abstract

This PR lets libraries and targets configure boot loader parameters like any other parameter. This allows a release of a boot loader as an mbed library, with an mbed_lib.json that contains links to the boot loader binaries.

Usage

The following patch, to mbed-os-example-bootloader-blinky, shows how this allows a standalone bootloader directory to contain all information required to merge a boot loader.

diff --git a/bootloader/mbed_lib.json b/bootloader/mbed_lib.json
new file mode 100644
index 0000000..eea6b25
--- /dev/null
+++ b/bootloader/mbed_lib.json
@@ -0,0 +1,24 @@
+{
+    "name": "bootloader_images",
+    "target_overrides": {
+        "K64F": {
+            "target.bootloader_img": "K64F.bin"
+        },
+        "NUCLEO_F429ZI": {
+            "target.bootloader_img": "NUCLEO_F429ZI.bin"
+        },
+        "UBLOX_EVK_ODIN_W2": {
+            "target.bootloader_img": "UBLOX_EVK_ODIN_W2.bin"
+        }
+    }
+}
diff --git a/mbed_app.json b/mbed_app.json
deleted file mode 100644
index 12ced95..0000000
--- a/mbed_app.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-    "target_overrides": {
-        "K64F": {
-            "target.bootloader_img": "bootloader/K64F.bin"
-        },
-        "NUCLEO_F429ZI": {
-            "target.bootloader_img": "bootloader/NUCLEO_F429ZI.bin"
-        },
-        "UBLOX_EVK_ODIN_W2": {
-            "target.bootloader_img": "bootloader/UBLOX_EVK_ODIN_W2.bin"
-        }
-    }
-}

TODO

  • Config Tests

@theotherjimmy
Copy link
Contributor Author

@sarahmarshy @cmonr @0xc0170 Could you review?

@0xc0170 0xc0170 requested review from cmonr and sarahmarshy January 25, 2018 09:05
@theotherjimmy theotherjimmy changed the title Allow libraries to configure bootloader Allow libraries, targets to configure bootloader Jan 25, 2018
@theotherjimmy theotherjimmy changed the title Allow libraries, targets to configure bootloader Let libraries, targets to configure bootloader Jan 25, 2018
@theotherjimmy theotherjimmy changed the title Let libraries, targets to configure bootloader Let libraries, targets configure bootloader Jan 25, 2018
@theotherjimmy theotherjimmy force-pushed the bl-as-config branch 3 times, most recently from 90398ba to db3e87a Compare January 25, 2018 19:48
@sarahmarshy
Copy link
Contributor

Would it still work at the application level?

@theotherjimmy
Copy link
Contributor Author

Yes.

self.cc.append("-D%s=0x%x" % define)
self.cppc.append("-D%s=0x%x" % define)
if region.active:
self.ld.append(self.make_ld_define(*define))
Copy link
Contributor

@sarahmarshy sarahmarshy Jan 26, 2018

Choose a reason for hiding this comment

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

Will this still work for MBED_APP_START in the linker scripts? It seems like MBED_APP_START_ADDR would be the new define?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just tried these changes with bootloader blinky for K64F and it did not work. I could see that it only -DAPPLICATION_ADDR and -DAPPLICATION_SIZE were passed to the linker. The k64f linker script expects MBED_APP_START.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Let me fix that.

Copy link
Contributor

@sarahmarshy sarahmarshy left a comment

Choose a reason for hiding this comment

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

The linker script defines need to be added to the profile like on master - https://github.com/ARMmbed/mbed-os/blob/master/tools/build_api.py#L301-L304. The current changes do not pass the correct defines to the linker.

@theotherjimmy
Copy link
Contributor Author

@sarahmarshy The linker defines are passed to the linker, just named incorrectly. The do not need to be part of the profile, just part of the command line.

@theotherjimmy theotherjimmy force-pushed the bl-as-config branch 2 times, most recently from 741248d to ca56a49 Compare January 26, 2018 20:44
@theotherjimmy
Copy link
Contributor Author

@sarahmarshy That should do it.

Copy link
Contributor

@sarahmarshy sarahmarshy left a comment

Choose a reason for hiding this comment

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

Tried with bootloader blinky, and it works now! Good work. LGTM.

@theotherjimmy
Copy link
Contributor Author

now to rebase #5950

@cmonr
Copy link
Contributor

cmonr commented Jan 26, 2018

/morph build

@theotherjimmy
Copy link
Contributor Author

Rebased
/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 31, 2018

Build : FAILURE

Build number : 1027
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5909/

@cmonr
Copy link
Contributor

cmonr commented Jan 31, 2018

@studavekar Looks like the build experienced a license timeout with the ARM compiler.

@studavekar
Copy link
Contributor

studavekar commented Jan 31, 2018

@studavekar Looks like the build experienced a license timeout with the ARM compiler.

May be issue with license server/connectivity, re-triggering it

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 31, 2018

Build : SUCCESS

Build number : 1028
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5909/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 31, 2018

@cmonr
Copy link
Contributor

cmonr commented Jan 31, 2018

/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Jan 31, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 1, 2018

/morph uvisor-test

1 similar comment
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 1, 2018

/morph uvisor-test

@theotherjimmy
Copy link
Contributor Author

@cmonr Poke. Looks ready to merge

@marcuschangarm
Copy link
Contributor

@cmonr double poke. 😄

@marcuschangarm
Copy link
Contributor

@0xc0170 fine, we can poke you too! 😆

@cmonr cmonr merged commit bf3693f into ARMmbed:master Feb 1, 2018
@cmonr
Copy link
Contributor

cmonr commented Feb 1, 2018

Jeez, can't a guy enjoy a morning taco anymore? 😆

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.

8 participants