Commit Graph

93 Commits (99cf33c20205a03fa7582325daa2008b051fe40c)

Author SHA1 Message Date
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 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
Martin Kojtal 1413c42410 CMake: use project name for Mbed OS
This enables multiple variables we can use. One of them is source dir for a project.

It will replace MBED_PATH in the tree.
2021-04-08 13:25:02 +01:00
Lingkai Dong 45a3c7193f CMake: Image format based on MBED_OUTPUT_EXT
Requires: https://github.com/ARMmbed/mbed-tools/pull/242

The optional `OUTPUT_EXT` field in Mbed OS `targets.json` specifies
the format of the output image. This is important because
* some targets only support one image format
* each post-binary hook outputs one image only

This avoids confusion of having both .hex and .bin images generated
while only one of them is usable.
2021-03-25 12:52:59 +00:00
Lingkai Dong ad27a3ec69 CMake: pass application name to post-build hook
Pass the exact name to the post-build hook, when an application's
or test's `CMakeLists.txt` calls `mbed_set_post_build()`. The
interface is CMake's built-in mechanism:
* `set_target_properties()` to set a property, e.g. application name
* `$<TARGET_PROPERTY:target,property>` to query a property at run time
2021-03-04 09:41:48 +00:00
Lingkai Dong 3579bb65da Force regenerate application binaries on rebuild
If a target has a post binary hook, we should force regenerate
the application binaries every time so that the hook is run on a
raw binary rather than a previous build that already went through
the post-build process once.
2021-03-04 09:41:43 +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
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
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 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 546cdafbd9
CMake: remove debug print 2021-02-17 16:50:13 +00:00
Martin Kojtal 8bdc626ba7
Merge pull request #14286 from 0xc0170/cmake-fix-remove-target-workaround
CMake: remove workaround for targets prior refactor
2021-02-16 14:28:26 +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
Martin Kojtal 9d70cb2a56 CMake: remove workaround for targets prior refactor
As we refactored all targets, we can remove this workaround from the tree.
2021-02-15 14:11:09 +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 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
Ladislas de Toldi 5a879c6a4e
Change CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR 2021-02-11 22:49:07 +01: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
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 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 d22772342c CMake: linker script preprocessing moved to mbed_configure_app_target
This fixes the problem for an app/test to define APP_TARGET as requirements. This is not a proper fix
but rather a workaround for broken apps/tests currently. We will address this separately via new
pull request.
2021-02-10 11:32:08 +00:00
Martin Kojtal b3344390dd CMake: move language standard to mbed-core
We set language standard via mbed-core and app inherits it if links to it.
This is breaking change for application, please remove the function call from an
application and it should build without errors.
2021-02-10 11:31:50 +00:00
Martin Kojtal 4536a5efe5
Update CMakeLists.txt
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2021-02-10 08:46:25 +00:00
Martin Kojtal e88e1149e2 CMake: fix the comment for naming targets 2021-02-09 17:12:23 +00:00
Martin Kojtal 39ab9c8b99 CMake: add naming convention for mbed targets
Using lowercase with dashes for targets with mbed- prefix
2021-02-09 15:23:17 +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
Robert Walton 8f47212085 cmake: Remove whitespace from mbed-os/CMakeLists.txt 2021-02-04 15:23:49 +00:00
Jamie Smith 029486e640 Add FindPythonPackage and use it to detect memap dependencies 2021-02-03 14:11:53 -08:00
Jamie Smith d9819a72d1 Bring back CMAKE_EXECUTABLE_SUFFIX in map filename, with a vengeance! 2021-02-01 19:40:41 -08:00
Jamie Smith 52565ae6e2 Remove CMAKE_EXECUTABLE_SUFFIX where it doesn't belong. 2021-01-27 15:56:36 -08:00
Hugues Kamba c724d790c0 CMake: Add mbed-psa library as a dependency to mbed-core if PSA is used
Include PSA source files only if a given Mbed target needs it.
This commit also consolidates CMakeLists.txt files within the platform
directory
2021-01-18 17:39:13 +00:00
Jamie Smith 0972738e46 Rebase linker script change properly, re-add external toolchain file support 2020-12-03 11:04:13 -08:00
Jamie Smith 423e8b0324 Fix functions using different names for linker script 2020-12-03 10:58:41 -08:00
Jamie Smith a942b2e21b Whoops, accidentally committed version change 2020-12-03 10:58:15 -08:00
Jamie Smith bb7391a37b Remove core.cmake 2020-12-03 10:58:15 -08:00
Jamie Smith 78be77ee5a Change toolchain file to load core and toolchain options *before* compilers are loaded. 2020-12-03 10:57:23 -08:00
Martin Kojtal 4e7c7eca7e CMake ARM: move map to unify with Gcc Arm 2020-12-01 19:04:32 +00:00
Martin Kojtal f97c7bd957 CMake: GCC ARM linker script fix
Fixes https://github.com/ARMmbed/mbed-os/issues/13983
Move linker script to the function mbed_set_mbed_target_linker_script.

I also moved memmap as it is needed for an app. The location might not be the best fit,
we will address this in separate pull request.
2020-11-30 11:21:53 +00:00
Lingkai Dong 9bf6affc74 CMake: pass predefined macros to ARM toolchain linker 2020-11-19 15:26:49 +00:00
Lingkai Dong 80a0a5b440 CMake: make linker option generator function toolchain-agnostic 2020-11-19 15:23:23 +00:00
Martin Kojtal fad7f344e7
Merge pull request #13870 from rajkan01/feature-cmake-review-comment
CMake: Address review comment from PR#13566
2020-11-18 09:42:09 +00:00
Evelyne Donnaes 7f92ba0826 Fixed top-level CMakeLists.txt 2020-11-13 15:49:24 +00:00
Rajkumar Kanagaraj 991b02ca7e CMake: Replace mbed_set_language_standard with target_compile_features and remove MBED_TARGET_LABELS variable resetting 2020-11-12 11:27:10 +00:00
Hugues Kamba 794e32df74 CMake: Use relative paths to list source files and directories
The absolute path is still required for listing linker
files as they are referenced from a function in the top
level CMake input source file.
2020-11-09 12:32:30 +00:00
Rajkumar Kanagaraj 073ae1d343 CMake: Validate selected application profile (#13856)
Check if the selected application profile is supported by the selected Mbed Target
2020-11-06 17:25:23 +00:00