mbed-os/tools
Lingkai Dong 351680fb18 Rework post-build to support multiple executables
When building greentea tests, each test is an executable with its
own output binary path. This is also the case when a user project
produces multiple executables. But the current implementation of
post-build operations always assumes there's only one executable,
at the root of the build directory.

The post-build command depends on Mbed target, and it always takes
the the executable we build as an input file. To achieve this, we
let each Mbed target (that has a post-build command) define a function

    function(mbed_post_build_function target)

which takes a CMake executable target as an argument from which it can
get its binary path using generator expressions. It generates and adds
to the passed executable target a post-build custom command.

Notes:
* The function name needs to be exact, because CMake only supports
literal function calls - CMake can't dereference a function name from
a variable. To avoid multiple definitions of this function, each Mbed
target needs to guard it with a macro to check if the user is
building this Mbed target.
* `mbed_post_build_function()` is a function, but it is usually
defined by another macro rather than a parent function, because
nesting functions would make many variables inaccessible inside the
innermost `mbed_post_build_function()`.
* There's no more need to force regenerate images. Previously, post-
build commands were custom *targets* which always got to run, so we
force regenerated images on every build to avoid patching an image
that's already been patched once on previous build. Now post-build
commands are custom *commands* of the same executable target, and they
are only run if the executable target itself is rebuilt.
2021-07-22 17:31:22 +01:00
..
arm_pack_manager added STM32WLE5CCUx + version 1.1.0 2021-07-06 17:10:53 +02:00
bootloaders Update MTS_DRAGONFLY_F411RE bootloader to work with mbed 5 & 6 2020-07-14 15:26:36 -05:00
cmake Rework post-build to support multiple executables 2021-07-22 17:31:22 +01:00
config tools: Remove obsolete API 2020-06-18 12:16:28 +01:00
debug_tools/crash_log_parser Fix #12290: crash_log_parser on py3 2020-02-12 14:56:35 +00:00
export Modify the python tools to support Cortex-A5 2021-06-23 13:39:21 +08:00
flash_algo Updates to `/tools` for Python 3 compatibility 2019-11-21 15:02:37 +00:00
importer cmsis: remove math header file 2020-11-02 10:23:45 +00:00
notifier Updates to `/tools` for Python 3 compatibility 2019-11-21 15:02:37 +00:00
profiles Turn on ARM linker --inline 2020-04-17 13:28:22 +03:00
psa Add missing license header and SPDX identifier 2021-02-25 14:02:57 +00:00
resources Remove LPC8x targets 2020-04-30 09:56:33 +01:00
targets Merge pull request #14783 from rwalton-arm/dont_capture_stdout 2021-07-06 12:57:45 +01:00
test icetea: Remove icetea TEST_APPS 2021-07-15 16:07:20 +01:00
test_configs test configs: Test Experimental API on K64F/K66F 2021-06-28 10:31:55 +01:00
toolchains Modify the python tools to support Cortex-A5 2021-06-23 13:39:21 +08:00
.mbedignore
README.md fix(docs): corrects various typos in project documentation 2021-04-23 23:31:11 -05:00
__init__.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
build.py psa: Remove PSA secure binary building tools 2020-04-27 09:51:14 +01:00
build_api.py Revert "Add the exception in Mbed OS build tool for Arm Compiler 5 toolchain." 2020-05-22 15:39:01 +01:00
build_release.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
default_settings.py Removing GCC_CR mention from settings.py 2018-10-02 10:46:31 -05:00
detect_targets.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
device_management.py device_management.py supports application access keys 2020-09-02 08:47:47 +03:00
get_config.py Revert get_config.py make.py test.py 2019-01-17 13:16:09 -05:00
libraries.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
make.py psa: Remove PSA secure binary building tools 2020-04-27 09:51:14 +01:00
memap.py suppress 'unknown object name' messages 2020-02-29 15:10:37 +01:00
memap_flamegraph.html Impl differential memap 2018-07-24 11:40:43 -05:00
options.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
paths.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
project.py psa: Remove PSA secure binary building tools 2020-04-27 09:51:14 +01:00
regions.py merge_region_list now takes in just restrict_size instead of config. 2019-04-09 14:08:13 -05:00
run_icetea.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00
settings.py Allow toolchain paths to be wrapped in quotes 2019-04-05 14:47:02 -05:00
singletest.py Remove nRF51 targets 2020-05-13 10:36:50 +01:00
test.py psa: Remove PSA secure binary building tools 2020-04-27 09:51:14 +01:00
test_api.py Remove host_tests from mbed-os/tools 2021-07-20 05:07:28 -07:00
test_exporters.py Updates to *.py in 'tools/' for Python 3 2019-11-21 16:06:59 +00:00
tests.py psa: Replace Mbed PSA with TF-M 2020-06-18 12:16:20 +01:00
utils.py tools: fix SPDX identifiers 2020-02-21 07:01:48 +00:00

README.md

Mbed OS Build Tools

This directory contains the python tools used for building Mbed OS and Mbed 2.

Quick navigation:

file/directory Purpose/function
build.py implementation of mbed compile --library
build_api.py full-project build operations
build_release.py CLI for making an mbed 2 release
config implementation of Config System
debug_tools Crash log parsing
default_settings.py Default version of project local settings.py
detect_targets.py implementation of mbed detect
device_management.py implementation of mbed device-management
export Export plugins and API for woking with them
flash_algo CMSIS flash algorithm parser
get_config.py implementation of mbed compile --config
host_tests location of pre-htrun host tests
importer code importer for use with CMSIS, TFM/PSA etc.
libraries.py constants for building mbed 2 libraries
make.py implementation of mbed compile
memap.py map file parser and summary generator
notifier API for seting compile status to a frontend
options.py Default option parser and option utilities
paths.py constants for many paths used
profiles location of the default build profiles
project.py implementation of mbed export
psa PSA
regions.py merging from managed bootloader mode
resources scans directories for files used in a project
run_icetea.py implementation of mbed test --icetea
settings.py project specific settings from env vars
singletest.py location of pre-greentea greentea
targets target description reader and post-build steps
test unit tests for tools
test_api.py part of pre-greentea greentea
test_configs configuration files used by mbed test
test_exporters.py part of pre-greentea greentea
tests.py implementation of mbed test --greentea
toolchains API for calling the selected compiler
utils.py General purpose utilities like file moving