and armcc.
1. Remove use of printf from all code that may be directly or indirectly
invoked from an interrupt context,
2. For occasions where a printf is required and the code in question may
run both inside and outside an interrupt context, add a new interrupt safe
version of printf, utest_printf(). This function will only pass its
arguments down to printf if interrupts are not disabled.
3. In harness.cpp, is_busy() , fix a bug where the function can return
leaving interrupts disabled.
4. In unity_handler.cpp add a new function, utest_safe_putc(), This is
used to override the default putc() function used by Unity. This version
checks that the current code does not have interrupts disabled prior to
outputting the character to the serial port. This overriding is enabled by
adding unity_config.h to the unity code and redefining UNITY_OUTPUT_CHAR
to utest_safe_putc(). The new config file is included in the build by
adding the define UNITY_INCLUDE_CONFIG_H. The Unity changes are submitted
under a separate PR. This change ensures that any Unity ASSERTS executed from
within interrupt context are safe.
from an interrupt context. Where required add flags to functions and check
the values in the case teardowns. This allows validation that the case
callback was invoked without the need for an ASSERT or printf directly in
the callback.
In cases where a printf is still required in a test case but it is unclear
whether the code may or may not get called from interrupt context, a new
printf alternative, utest_printf() should be used instead. This just
checks whether the code is executing in interrupt context and only passes
its arguments to printf if not.
get_config.py can be used to view the configuration of the mbed project
that's being compiled:
- without '-v' it displays a simple list of configuration parameters and
their values
- with '-v' it displays additional data for each configuration parameter
(like the place of definition and the last place that set a value for
the configuration parameter).
Tested by running "get_config.py" on a few tests from
tools/test/config_test.
The tests check a number of features of the configuration mechanism
(mostly the inheritance and overriding of configuration parameters), as
well as the behavarious in various abnormal situations.
This commit adds the implementation of the configuration mechanism and
applies it for two uses cases:
- building a program (build_project in build_api.py)
- building a library (build_library in build_api.py)
There's also a new method 'get_config' in build_api.py that's used to
return the configuration of a project. Currently, it's used only for
testing, the intention is to use it for the implementation of the 'mbed
config' command.
Tested with various test configurations on the "blinky" example and also
with its own set of tests (to be added in a separate commit).
'make.py' was modified to send the target *name* to build_project, as
opposed to the target *instance*. This is needed because the
coniguration mechanism allows for creating custom targets, but these
targets are not available until the configuration file
mbed_app_config.json is parsed, which happens in build_project (so
before make.py calls 'build_project'). The API of build_project didn't
change, it now accepts both target names and target instances for the
'target' argument.
Known issues:
- doesn't currently work when doing binary builds of the SDK. Currently,
building the SDK is broken in mbed-os, so this will be added later.
- when building tests, the build process ends up calling
'build_project', so the configuration mechanism should play well with
tests. However, this wasn't tested.
A later commit will all documentation for the configuration mechanism.