2 years, 1 month ago.

How to configure a --library build of mbedOS?

I want to build a library of mbedOS so that I can link multiple applications to it.

I can build the library using e.g:

$ mbed compile  -m K64F -t GCC_ARM  --library --profile tools/profiles/debug.json

This gives me the expected build results under BUILD.

However, I need to change some of the configuration options for the library being built. I had hoped I could do this using the app-config parameter and point it at a file containing a suitable "target_overrides" object e.g.

$ mbed compile  -m K64F -t GCC_ARM  --app-config lib-conf.json --library --profile tools/profiles/debug.json

    "name": "nick-application",
    "target_overrides": {
        "*": {
            "platform.stdio_flush_at_exit": true,
            "platform.stdio_convert_newlines" : false,
            "platform.stdio_flush_at_exit" : true,
            "platform.stdio_baud_rate" : 115200,
            "platform.default_serial_baud_rate": 115200

This doesn't work. The app-config parameter is ignored. You can specify an invalid file path or corrupt the contents of a valid file and its completely ignored. If you remove the -library option then the -app-config file is found and processed correctly to generate the expected mbed_config.h contents.

This also affects the configuration of mbedtls as the only way to do that (short of editing the config.h file) is to specify the following somewhere:

    "macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls-config-changes.h\""]

So the question is, how do I configure a library build of mbedOS?

$ mbed -version


1 Answer

2 years, 1 month ago.

Hi Nick,

I would try the following steps to use the same Mbed OS library for multiple projects with app config files: https://github.com/armmbed/mbed-cli#managing-multiple-mbed-projects

Please let me know if you have any questions!

- Jenny, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Hi Jenny, Thanks for the follow up. The article doesn’t cover the specific issue I am trying to solve. It’s not so much about how I use the resulting library but how to configure the build when compiling the library at the start of the process. It’s very easy to reproduce the reported behaviour on the command line. Thanks

posted by Nick Terry 20 Sep 2018

Is there any way to get this question answered? In the first instance it would be useful to know whether the issue is confirmed or not. Thanks.

posted by Nick Terry 02 Oct 2018