Skip to content

Unable to link mbed-os aginst multiple applications with custom configuration #12837

Closed
@nat45928

Description

@nat45928

Description of defect

I am unable to build a library from mbed-os to link against when using a custom mbed_app.json because the mbed_config.h produced with the --library option differs from a normally built application. This causes the application to fail to boot.

Additional Background

I have a project which produces multiple binary applications from a single codebase. I have been using the compiler --source option to change which files are selected by mbed-os. For example (where folders foo and bar contain different main.cpp files):

  1. mbed compile --app-config mbed_app.json --source foo --source mbed-os builds foo
  2. mbed compile --app-config mbed_app.json --source bar --source mbed-os builds bar

However, this takes a long time due to the rebuild of mbed-os library for each application. I would like to use the provided --library option to build mbed-os once then link my two applications aginst it. Similar to:

  1. mbed compile --app-config mbed_app.json --source mbed-os --build BUILD/mbed-os --library --no-archive builds the mbed-os library
  2. mbed compile --app-config mbed_app.json --source foo --source BUILD/mbed-os --build BUILD/foo builds foo
  3. mbed compile --app-config mbed_app.json --source bar --source BUILD/mbed-os --build BUILD/bar builds bar

This process works but produces binaries that do not execute. Upon digging the resulting mbed_config.h for step 1 vs steps 2 and 3 differ. Digging into the tools folder it appears that build.py does not respect the app-config CLI parameter.

Is this workflow expected to work, is there a better workflow that should be followed?

Target(s) affected by this defect ?

NUCLEO_F767ZI

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM, 9-2019-q4-major, 9.2.1 20191025

What version of Mbed-os are you using (tag or sha) ?

d5f034b

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-cli, 1.10.2

How is this defect reproduced ?

  1. Create a fresh project.
  2. Create / edit the mbed_app.json configuration to change a parameter (platform.stdio-baud-rate for example).
  3. Build mbed-os using mbed compile --app-config mbed_app.json --source mbed-os --build BUILD/mbed-os --library --no-archive
  4. Build app1 using mbed compile --app-config mbed_app.json --source foo --source BUILD/mbed-os --build BUILD/foo
  5. The application does not execute correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions