Commit Graph

152 Commits (d489c92a1bc541d19df66f79501a91ba3f29764b)

Author SHA1 Message Date
Martin Kojtal 7f42511673
Merge pull request #14529 from LDong-Arm/cmake_MULADDC
CMake: Fix Mbed TLS compilation on Cortex-M0/0+/1/M23
2021-04-15 14:29:27 +02:00
Lingkai Dong 86e7bc559b CMake: Fix Mbed TLS compilation for Cortex-M0/0+/1/M23
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.

Fixes ARMmbed/mbed-os-example-lorawan#220
2021-04-15 11:04:40 +01:00
Martin Kojtal 121c8286da CMake: set CMAKE_MODULE_PATH in the Mbed OS CMakelists.txt
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).
2021-04-14 13:09:28 +01:00
Martin Kojtal 65e246fe4d CMake: add mbed_ prefix to our CMake files
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.
2021-04-14 13:09:27 +01:00
Martin Kojtal ed609f57c4 CMake app: add our cmake folder to CMAKE_MODULE_PATH
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).
2021-04-14 13:09:27 +01:00
Martin Kojtal b88d5687e2 CMake tools: use CMAKE_CURRENT_LIST_DIR instead of MBED_PATH
Excluding greentea tests, they will be fixed separately (more work needed).
2021-04-14 13:09:27 +01:00
Hugues Kamba b193d97532 CMake: Fix Cortex-A9 flags for GCC_ARM toolchain
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
2021-03-12 13:21:04 +00:00
Martin Kojtal 0ef2024a1d
Merge pull request #14401 from LDong-Arm/m33_link_fix
Workaround for Cortex-M33 Arm toochain linking
2021-03-11 11:05:10 +00:00
Lingkai Dong 6dc85e0386 Workaround for Cortex-M33 Arm toochain linking
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).
2021-03-09 17:35:48 +00:00
Lingkai Dong 26abe5656b CMake README: post build now supported on TF-M targets 2021-03-08 16:38:00 +00:00
Rajkumar Kanagaraj 3695cefad3 CMake: Update readme for greentea test build procedure
- 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.
2021-03-03 03:58:59 -08:00
Martin Kojtal 76b2902f48
Merge pull request #14354 from ARMmbed/feature-tf-m-1.2-integration
Update TF-M support to v1.2
2021-03-03 11:08:24 +00:00
Ladislas de Toldi fd7ea7305f
Configure memory map per target to allow multiple add_executable 2021-02-27 13:16:03 +01:00
Martin Kojtal eceaea54fd
Merge pull request #14299 from hugueskamba/hk_cmake_refactor_mapfile_generation
CMake: Refactor mapfile generation
2021-02-25 15:08:55 +00:00
Lingkai Dong 63523bd0aa Remove _NS aliases for Musca B1/S1
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.
2021-02-25 14:02:57 +00:00
Martin Kojtal 7da6100ff6
Merge pull request #14304 from hugueskamba/hk_cmake_remove_app_target_reference
CMake: Refactor post-build hook to remove APP_TARGET references
2021-02-25 10:41:44 +00:00
Martin Kojtal 737153bcc1
Merge pull request #14328 from hugueskamba/hk_cmake_fix_greentea_tests
CMake: Fix Greentea tests
2021-02-24 16:09:55 +00:00
Martin Kojtal 6c08123dff
Merge pull request #14313 from hugueskamba/hk_cmake_fix_cortex_m33_gcc
CMake: Fix Cortex-M33 GCC build
2021-02-23 14:23:01 +00:00
Hugues Kamba 1ba3b73a30 CMake: Fix Greentea tests
* Specify new Greentea tests build steps in README
* Correct path to generated CMake configuration module
2021-02-23 13:08:43 +00:00
Hugues Kamba ed09a5cc95 CMake: Refactor mapfile generation
The refactoring was necessary to remove a function call
(mbed_configure_app_target()) from application's CMakeLists.txt.
2021-02-23 11:39:00 +00:00
Hugues Kamba cd6cb71c29 CMake: Fix Cortex-M33 GCC build
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.
2021-02-22 15:21:20 +00:00
Hugues Kamba 261deae561 CMake: Fix Cortex-A9 builds with GCC_ARM
Add the `-march` flag for Cortex-A9 GCC_ARM in order to
generate instructions for the armv7-a machine type.
2021-02-22 11:28:06 +00:00
Hugues Kamba 0eae4f6c3f CMake: Refactor post-build hook to remove APP_TARGET references
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.
2021-02-19 11:52:57 +00:00
Martin Kojtal 3894d73680
Merge pull request #14289 from hugueskamba/hk_cmake_refactor_cypress
CMake: Refactor Cypress targets
2021-02-16 13:43:35 +00:00
Hugues Kamba 68b6e6ff96 Fix post build mechanism with unique CMake custom targets
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.
2021-02-15 17:39:27 +00:00
Robert Walton 0c7bfe93e3 CMake: Generate response file before adding mbed-targets
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.
2021-02-15 11:12:18 +00:00
Martin Kojtal da34eecaf6
Merge pull request #14247 from rajkan01/refactor_greentea_cmakelist
CMake: Refactor Greentea test CMakeLists.txt
2021-02-15 10:28:32 +00:00
Martin Kojtal 34627b7d53
Merge pull request #14280 from hugueskamba/hk_cmake_refactor_wiced
CMake: Refactor WIO_EMW3166 support
2021-02-15 10:28:12 +00:00
Martin Kojtal ba1e7b53d0
Merge pull request #14272 from ladislas/ladislas/feature/cmake-current-binary-dir
Change CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR
2021-02-14 19:23:46 +00:00
Hugues Kamba 01875ebb09 WICED: Move directory to WiFi driver
WICED is something is build to Cypress WiFi on multiple devices, it's a binary form. It is owned
by Seeed studio
2021-02-12 16:40:22 +00:00
Ladislas de Toldi 5a879c6a4e
Change CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR 2021-02-11 22:49:07 +01:00
Rajkumar Kanagaraj c93901a804 CMake: Update readme about new MBED_TEST_LINK_LIBRARIES command line argument 2021-02-11 11:28:51 -08:00
Hugues Kamba deeaa7970f CMake: Add post build operation support
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.
2021-02-11 17:04:41 +00:00
Martin Kojtal 33c06fb346
Merge pull request #14265 from 0xc0170/cmake-fix-app-target
CMake: remove need for APP_TARGET
2021-02-11 11:49:16 +00:00
Rajkumar Kanagaraj b1c4c446d2 CMake: Greentea test CMakeLists.txt refactoring
- 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"
2021-02-11 03:03:18 -08:00
Martin Kojtal 207dcbb88b CMake: move Gcc Arm memmap to configure app
This allows us to keep all in one place and fix (removing this function later)
2021-02-10 19:37:42 +00:00
Martin Kojtal 8be5da2619 CMake: hardcode mem map name to "application" for Gcc Arm
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.
2021-02-10 14:02:04 +00:00
Martin Kojtal b9990089eb
CMake: fix wording in naming
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2021-02-10 12:15:48 +00:00
Martin Kojtal a6915af60d CMake readme: add naming scheme for our CMake targets
Be consistent
2021-02-10 09:43:08 +00:00
Martin Kojtal ce6ff0ac5f
Merge pull request #14207 from JeanMarcR/STM32WL_JMR
Adding NUCLEO_WL55JC support
2021-02-08 15:56:46 +00:00
reme 6220ca5fd5 STM32WL : ADDING CORTEX-M4 LINK OPTION
Add link option in file used for compilation.
Due to a bug in mbedtools environment.
2021-02-08 09:42:51 +00:00
Martin Kojtal dd33463518
Merge pull request #14205 from multiplemonomials/master
CMake: better detection of memap dependencies
2021-02-05 10:13:18 +00:00
Robert Walton 0e491cc0cf cmake: Refactor mbed_set_mbed_target_linker_script
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.
2021-02-04 15:26:33 +00:00
Jamie Smith 7b03aeaf98 Rebase against master 2021-02-03 14:16:07 -08:00
Jamie Smith 9e2b04e945 Whitespace formatting changes. 2021-02-03 14:12:29 -08:00
Jamie Smith 0a67fef995 Add intelhex version info (same as #14201) 2021-02-03 14:12:29 -08:00
Jamie Smith df60d42aed Realized that companion Python script is actually not needed at all, can be replaced with command line 2021-02-03 14:12:28 -08:00
Jamie Smith 8eca0cffb2 Fix incorrect comment in tools/cmake/python_packagecheck.py
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2021-02-03 14:12:28 -08:00
Jamie Smith e61a45a0c3 Add extra lines as requested 2021-02-03 14:12:27 -08:00
Jamie Smith 049f1a7bf6 Fix indentation error in tools/cmake/CheckPythonPackage.cmake
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2021-02-03 14:12:27 -08:00