sparkfun / Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
83 stars 39 forks source link

how to rebuild libmbed-os.a #279

Closed paulvha closed 3 years ago

paulvha commented 4 years ago

Much of the kernel code (for good reason) is stored in a static library {build.variant.path}/mbed/libmbed-os.a. I am studying the library code and want to check some changes. However even if I change the source code, it will not be taken into effect as the compiler (instructed in platform.txt) is using the library. How can I rebuild the libmbed-os.a from the changed source code?

regards, Paul

oclyke commented 4 years ago

Great question! Check out the CI / GitHub Action here: generate-variants.yaml

That's a hint... It relies on another GitHub action to run a few arbitrary mbed build jobs. If you check out the arguments passed in you can see that the mbed command to build a static library is: mbed compile --library --source=mbed-os -m ${YOUR_TARGET_BOARD} -t ${YOUR_TOOLCHAIN} (your toolchain would most likely be GCC_ARM, and your target board would be one of the variant folder names e.g. SFE_ARTEMIS for the RedBoard Artemis, SFE_ARTEMIS_DK for the Artemis Dev Kit and so on)

This means you will need to get mbed installed w/ a gcc toolchain. Here's a little more info about that: https://learn.sparkfun.com/tutorials/artemis-development-on-arm-mbed-os-betaw

paulvha commented 4 years ago

Thanks for the information. regards Paul

Wenn0101 commented 4 years ago

I wanted to add. You want to use the ambiq-apollo3-arduino branch when doing this. The latest version of mbed changed some namespaces and the arduinoBLE has not yet been updated to match these changes. This branch is based on an older version of mbed.

paulvha commented 4 years ago

thanks !!

paulvha commented 4 years ago

As I have spend good time getting this going I have documented how I had done it. Maybe useful for others as a starting point make_static.zip