ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 118 forks source link

Add FOTA Service mcuboot example #378

Closed noonfom closed 3 years ago

noonfom commented 3 years ago

This PR extends the Mock example by including a bootloader based on mcuboot.

Co-authored by @AGlass0fMilk

noonfom commented 3 years ago

Note: we need to rework .circleci/config.yml to accommodate sub libraries in CI.

noonfom commented 3 years ago

@paul-szczepanek-arm Can you advise on how we should add multi-example folders, e.g., FOTA, to the CI workflow? Probably, it should be generic to accommodate future use cases.

paul-szczepanek-arm commented 3 years ago

I'd suggest making it in its own repository as this is not really about teaching anything about the BLE API.

noonfom commented 3 years ago

I'd suggest making it in its own repository as this is not really about teaching anything about the BLE API.

That has crossed my mind before. I guess we decided to put it here to collocate it with the other Experimental BLE Services examples. However, I do see how this example could diverge significantly from the other material in the repository. In particular, we may want to explore the possibility of integrating it with Secure Boot, as opposed to standalone MCUboot. Of course, we would need a TF-M board for that. Either of the Nordic boards (5340/9160) could work but, alas, neither are supported by Mbed OS.

Edit: either of the Musca boards w/a BLE shield could work.

Anyway, that's a tangent. In general, it might be worth supporting multi-example folders in the CI workflow. Taking inspiration from Mbed Tools, we could decide what to build based on the presence of an mbed-os.lib.

pan- commented 3 years ago

@paul-szczepanek-arm I agree this could go into its own repository. At the same time this is in a branch. I merge.

AGlass0fMilk commented 3 years ago

Since this has been merged into a branch, is it still desired that an example of BLE FOTA go into a separate repository?

@paul-szczepanek-arm Sent me this one: https://github.com/ARMmbed/mbed-os-example-ble-fota

AGlass0fMilk commented 3 years ago

@noonfom Excellent work! I just tried this out and it worked without issue!

Good job. I think we can just move this branch to its own separate repository.

What I'd like to do at the same time is set this up for use with Mbed CLI2 and Cmake. I think Cmake would eliminate a lot of the manual steps for signing/merging, etc.

Let me know your thoughts and how I could help.

paul-szczepanek-arm commented 3 years ago

Yeah, it's going to the separate repo. Someone on our team is doing the move (he just doesn't have a arm github account yet). He'll also add the cmakelists.txt.

noonfom commented 3 years ago

@noonfom Excellent work! I just tried this out and it worked without issue!

Good job. I think we can just move this branch to its own separate repository.

What I'd like to do at the same time is set this up for use with Mbed CLI2 and Cmake. I think Cmake would eliminate a lot of the manual steps for signing/merging, etc.

Let me know your thoughts and how I could help.

Thanks for the feedback George :smile: It has been a real pleasure working with you to enable the FOTA example and other BLE features within the Bluetooth Working Group.

I should let you know that I rotated into the TF-M team at the beginning of June so no longer work day-to-day on Mbed OS. In saying that, I continue to have an interest in firmware OTA and am keen to explore the possibility of integrating the FOTA example with TF-M and Secure Boot. You may have noticed me harping on about this above. Currently, this remains an interest as I've been too busy to initiate a POC. However, I am curious to see if this would interest you and your customers?

On using CMake to automate the image signing process, I suggest taking a look at how it is done inside TF-M’s bl2. In the CMakeLists.txt, you will find several places where imgtool is invoked from Python inside the CMake (e.g., signing the non-secure application on line 170). Even with such CMake utilities, merging is so platform-specific (i.e., dependant on flash layout) that it must be done manually.

Thanks again for all your hard work on Mbed OS BLE and I look forward to working again together soon.