How to build multiple firmware applications with different features from the CLI?

Hi,

I just started using mbed OS two weeks ago so this is a newbie question.

I’m trying to build two different firmware applications (same target hardware) with different features enabled. There is a directory “A” which is used only by Application A. There is a directory “B” used only by Application B. There are three common directories X, Y and Z used by both applications (A & B). How do you specify two different targets with two different sets of source directories as mbed cli does its own scanning looking for source code? Do you use custom_targets.json? I’m looking for some direction as to where to look or better yet, examples of how to do this.

Thanks in advance.

Hank

I’m using a project structure like this:

there I have mbed-os and several libs, and also different apps that use the common code. The mbed-cli supports this by adding the libs to the compile command, e.g.

mbed compile --build ../../BUILD/blinky/Debug --source . --source ../../libs --source ../../mbed-os --source ../../custom_targets --profile debug

each app needs also an entry for the MBED_OS_DIR in the .mbed config file:

ROOT=.
TARGET=NUCLEO_F746ZG
MBED_OS_DIR=..\..\mbed-os

Hi Johannes,

That’s very helpful. Thanks for giving me a direction to go.

Thanks very much.

Hank

I think this is the most sensible answer.

Another option is to run mbed-cli in Docker and mount required directories as volumes where default settings will find them.