Due to a known issue in Mbed TLS's architecture determination
(ARMmbed/mbedtls#1077), we get the error
error: inline assembly requires more registers than available
when compiling `bignum.c` for Cortex-M0/0+/1/M23 which do not have
the macro `__thumb2__` set by the compiler.
The workaround is to define the macro `MULADDC_CANNOT_USE_R7` which
is already defined by Mbed CLI 1 but missing in our CMake support.
FixesARMmbed/mbed-os-example-lorawan#220
Update CMAKE_MODULE_PATH at once place.
Note, we update also CMAKE_MODULE_PATH in app.cmake. This is temporary until we get a proper way to include
Mbed Os (removing app.cmake need to be included by an application).
To avoid conflicts as we expose our CMake list files via CMAKE_MODULE_PATH. Some files already include it, this
aligns the rest of files.
I leave app.cmake as it is - it's user facing and it would be breaking change. We can clean this one for the next major version.
All files within tools/cmake can now include within tools/cmake. We do not expose
internal folders like core/profiles/toolchains.
They should be included via toolchain file (mbed_toolchain in our case).
The -mcpu=cortex-a9 flag conflicts with the march=armv7-a flag.
Opted to keep mcpu=cortex-a9 as it is more specific and
allows GCC to perform better optimization.
The compiler is also changed to use soft-float ABI as it
was necessary to successfully build. Without it the application
appears to be built with soft-float ABI and it conflicts with
the previous setting which was built with hard-float ABI.
This may be related to: https://gitlab.kitware.com/cmake/cmake/-/issues/21173
Binaries generated for Cortex-M33 targets (e.g. Musca S1/B1) using
the Arm toolchain + CMake is unable to run, unless we instruct the
linker to not use floating points.
Note: This is a temporary workaround, because
* Ideally, the Arm linker should be able to auto detect the
architecture support from the input object files, but it's not
always the case. We already have a similar workaround for Cortex-M4.
* The full option to use should be `--cpu=Cortex-M33.no_dsp.no_fp`
but `no_dsp` currently conflicts with CMake's compilation tests
(no option to disable DSP in the test objects before linking).
- No longer need to create mbed_os.lib and soft link to mbed-os as new
--mbed-os-path command-line removes such dependency and creates mbed_build.cmake
when passing mbed-os path with that command line argument.
In targets.json, ARM_MUSCA_B1 and ARM_MUSCA_S1 have alias target
names suffixed with `_NS`. They are identical to targets without
`_NS` and exist purely for compatibility with the old naming
convention we had. The CI builds them as separate targets and uses
extra resources.
As we are upgrading Musca targets to TF-M v1.2, it's time to clean
up the aliases.
The GCC flag to specify the floating-point hardware (`mfpu`) does not accept
the value `none`. The default value is `auto` which causes the compiler to
select the floating-point and Advanced SIMD instructions based on the
settings of -mcpu and -march. The extension option `+nofp` has been added
to disable floating point instructions.
There should not be a reference to APP_TARGET in Mbed OS as end-users
may decide to use a different name for the CMake variable to store their
application name.
The CMake custom target must be unique to avoid more than one
Mbed target adding the same. Only the CMake custom command added for the
Mbed target being built is run as the custom CMake target now includes
the Mbed target name.
We need to generate a "response file" to pass to the C preprocessor
when we preprocess the linker script, because of path length limitations
on Windows. We set the response file and bind the path to a global
property. The MBED_TARGET being built queries this global property when
it sets the linker script.
We must set this global property before the targets subdirectory is
added to the project. This is required because the MBED_TARGET depends
on the response file. If the path to the response file is not defined
when the target requests it the config definitions will not be passed
to CPP.
A CMake custom target, mbed-post-build, is added as a dependency of the
application CMake target if a Mbed target adds a CMake custom target
named mbed-post-build-bin. mbed-post-build-bin is added as a dependency
of mbed-post-build. mbed-post-build-bin depends on the application binary.
This is done so a CMake custom command that executes post-build can be added.
The Python scripts that implement the operations have been modified to add
CLI entry points so they can be called from CMake. Dependency on the old
tool has been removed on those scripts by passing them exactly what they
require instead of passing old tool Python objects. A consequence of that
was to slightly amend how the old tool calls some of those Python modules.
Support has only been added for Mbed targets that currently have a requirement
for post build operations. This includes: LPC1114, LPC1768, ARCH_PRO, LPC54114,
LPC546XX, FF_LPC546XX, CY8CKIT064B0S2_4343W, CYTFM_064B0S2_4343W, CYSBSYSKIT_01
The following targets are not supported as TFM support is not yet included:
ARM_MUSCA_B1, ARM_MUSCA_B1_NS, ARM_MUSCA_S1, ARM_MUSCA_S1_NS.
- Added the new CMake `MBED_TEST_LINK_LIBRARIES` command-line argument support to receive
all dependent libraries for the particular greentea test suite.
For example:
- To select mbed-os library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-os
- To select baremetal library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal
- To select baremetal with external error logging library to the test with -D "MBED_TEST_LINK_LIBRARIES=mbed-baremetal ext-errorlogging"
We need to fix linker script differently, it should not need APP_TARGET. This is a series of
commits fixing APP_TARGET in our tree. We should not require it.
The linker script preprocessing will be fixed differently. "application" prefix is temporary until
we clean this up completely.
Move the mbed_set_mbed_target_linker_script function into its own file
and make it set the linkerscript on the target passed in, rather than
setting the linkerscript on the top level mbed-core target. We use
CMake's automatic forwarding of usage requirements to forward the linker
script to the top level target.
This commit also adds a condition to check whether the MBED_TARGET is a
CMake buildsystem target. If it is we will just link to it in the
idiomatic CMake way, if it's not then we use the 'old' mechanism of
setting the linkerscript for the mbed-core target. This check will be
useful when we refactor MBED_TARGETS to be CMake buildsystem targets as
it will allow us to do the refactoring incrementally.