Commit Graph

43 Commits (3be2d15e2d6d2cd76e12b195b5d86d9549868fe0)

Author SHA1 Message Date
Martin Kojtal 3be2d15e2d CMake ARMClang6: use armclang for asm
Fixes the issue of armasm, passing -DMACRO={0,0} - fails to parse.

We use armclang frontend but passing -masm=armasm.
2020-11-06 17:25:20 +00:00
Hugues Kamba 933b1db1be CMake: Set language std per target using properties 2020-11-06 17:25:19 +00:00
Hugues Kamba a1259ecf22 CMake: Remove utility function dependency on mbed-os target
The utility function may be called by targets other than mbed-os
when it is broken into multiple libraries.
2020-11-06 17:25:19 +00:00
Hugues Kamba dde395c82f CMake: Do not hard code target in build profile CMake module
Provide a function in each build profile module to set the toolchain
options. All the functions have the same interface therefore the
CMake source file including the module always calls the same
function regardless of which build profile module is actually
included.
When the `mbed-os` target is broken up into multiple libraries,
a library other than `mbed-os` might need to set the toolchain
options. This will be possible by simply including the module
and calling the function with the target and toolchain for which
to set the options.
2020-11-06 17:25:19 +00:00
Hugues Kamba cb9960cb08 CMake: Do not hard code target in toolchain CMake module
Provide a function in each toolchain module to set the toolchain
specific options. All the functions have the same interface
therefore the CMake source file including the module always calls
the same function regardless of which toolchain module is actually
included.
When the `mbed-os` target is broken up into multiple libraries, a
library other than `mbed-os` might need to set the toolchain options.
This will be possible by simply including the module and calling the
function with the target for which to set the options.
2020-11-06 17:25:19 +00:00
Hugues Kamba c8b4822ed7 CMake: Remove toolchain module dependency on cpu core CMake modules
Set `CMAKE_SYSTEM_PROCESSOR` in toolchain.cmake based on
`MBED_CPU_CORE`.
This information is needed by the ARM toolchain (and possibly other
toolchains), it therefore makes sense to set in `toolchain.cmake`.
2020-11-06 17:25:19 +00:00
Hugues Kamba 400211c490 CMake: Do not hard code target in CPU core CMake module
Provide a function in each CPU core module to set toolchain options.
All the functions have the same interface therefore the CMake source
file including the module always calls the same function regardless
of which cpu core module is actually included.
When the `mbed-os` target is broken up into multiple libraries, a
library other than `mbed-os` might need to set the toolchain options.
This will be possible by simply including the module and calling the
function with the target and toolchain for which to set the options.
2020-11-06 17:25:19 +00:00
Martin Kojtal 8b3cec2fa4 Update cmake/toolchain.cmake
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2020-11-06 17:25:18 +00:00
Martin Kojtal aac5e8082b CMake: Profile comments update
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2020-11-06 17:25:18 +00:00
Martin Kojtal 57f39aed01 CMake toolchain: fix options comment
Co-authored-by: Hugues Kamba <41612201+hugueskamba@users.noreply.github.com>
2020-11-06 17:25:18 +00:00
Martin Kojtal 1ebedf2709 CMake GCC ARM: use nosys specs for linker
Use retarged version (nosys.specs) for Mbed OS. To resolve an issue with debug/develop profiles.
Otherwise we get kill or getpid errors from linker, as we use nosys lib but no specs defined.
2020-11-06 17:25:18 +00:00
Martin Kojtal 90e5d3aa35 CMake toolchain: clear flags to be able to overwrite them
As Mbed uses different optimizations levels, we should be able to overwrite this via toolchain file.
2020-11-06 17:25:18 +00:00
Martin Kojtal 02c01547d1 CMake profile: fix comments 2020-11-06 17:25:18 +00:00
Martin Kojtal 18a13804c8 CMake profile: fix alignment 2020-11-06 17:25:18 +00:00
Martin Kojtal 2f89e99ee4 CMake build type: set default Develop profile
Adding also comments for multiconfig/property set.
2020-11-06 17:25:18 +00:00
Martin Kojtal 4f8568cd8e CMake: using CMAKE_BUILD_TYPE for choosing a profile
Select a profile using `-DCMAKE_BUILD_TYPE=<profile>`.
We support 3 profiles: Debug, Develop and Release.
2020-11-06 17:25:18 +00:00
Hugues Kamba 4af48a3425 CMake: Remove MCU core specific option from ARM ASM options 2020-11-06 17:25:18 +00:00
Hugues Kamba 1b52415336 CMake: Move MBED_STUDIO_ARM_COMPILER to ARM.cmake module
As its name implies, the flag is specific to the ARM toolchain.
2020-11-06 17:25:18 +00:00
Hugues Kamba ef11e06cfb CMake: Remove add_executable
Instead provide functions to set the pre and post link commands.
2020-11-06 17:25:17 +00:00
Hugues Kamba c05170fbc8 CMake: Remove app.cmake module
This module was doing things that mbed-os and the application were supposed to do.
Moved the statements form the module to `mbed-os/CMakeLists.txt` and to
`<APPLICATION_ROOT>/CMakeLists.txt` .
Mbed OS also ensures the executable produced uses whatever name the application has set.
2020-11-06 17:25:17 +00:00
Martin Kojtal fa8d9fd21a CMake GCC ARM: add -g3 to the common
Remove -g as g3 already provided
2020-11-06 17:25:17 +00:00
Martin Kojtal 67c364d281 CMake: set release optimizations 2020-11-06 17:25:17 +00:00
Martin Kojtal 5128b02686 CMake: set develop optimizations 2020-11-06 17:25:17 +00:00
Martin Kojtal d3d88e3be9 CMake: set debug optimizations 2020-11-06 17:25:17 +00:00
Martin Kojtal 2efe469645 CMake toolchain: set optimization in profiles 2020-11-06 17:25:17 +00:00
Martin Kojtal ecfee28517 CMake: move env to toolchain file (#13369)
Toolchain sets target toolchain related settings that were in env. We do not need env cmake.
See https://cmake.org/cmake/help/v3.8/manual/cmake-toolchains.7.html for details
2020-11-06 17:25:17 +00:00
Robert Walton 335dfddec1 Add tools generated definitions and properties 2020-11-06 17:25:17 +00:00
Robert Walton 0e1770daf5 Remove gen_config interface library target 2020-11-06 17:25:17 +00:00
Hugues Kamba 2d1508d9d0 CMake: Ensure targets creation before usage in `target_` functions
Move target creation statements before include statements. The targets
must be created before they can be used in `target_` functions.
2020-11-06 17:25:17 +00:00
Hugues Kamba e172eb33c9 CMake: Use modern CMake techniques to set toolchain options
Use target_compile_options(), target_compile_definitions(),
and target_link_options() to set toolchain options.
2020-11-06 17:25:17 +00:00
Devaraj Ranganna debffb6dd1 cmake: Armclang - Fix assembler and linker flags
For Armclang, change compiler flag to `-mcpu` and assembler and linker
flag to `--cpu`.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
2020-11-06 17:25:16 +00:00
Hugues Kamba 7dd73372d4 CMake: Remove unsupported ARM toolchain support 2020-11-06 17:25:16 +00:00
Martin Kojtal 1bb6be340c CMake util: fix copyright 2020-11-06 17:25:16 +00:00
Martin Kojtal 08eb1e3f94 CMake: fix missing copyright 2020-11-06 17:25:16 +00:00
Martin Kojtal e2f38abe6f CMake env: remove components, needs design first 2020-11-06 17:25:16 +00:00
Martin Kojtal b03e94f98b CMake env: fix copyright 2020-11-06 17:25:16 +00:00
Jaeden Amero 8dabb28cb6 cmake: Remove IAR support
IAR isn't supported anymore. Remove references to IAR from the CMake
build system generator scripts.
2020-11-06 17:25:16 +00:00
Devaraj Ranganna 10f421258d cmake: Using Arm compiler from Mbed Studio
Added a command line option `-DMBEDIDE=ON` which allows using Arm
compiler shipped with Mbed Studio on local machines.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
2020-11-06 17:25:16 +00:00
Devaraj Ranganna f18622e8d7 cmake: Fix arm compiler build failures
Update arm compiler flags which were causing build failures.

Remove `-MMD` flag as it is not recognised by the Arm compiler.

There are no common flags between compiler, assembler and linker. The
compiler expects `-mcpu` whereas assembler and linker expects `--cpu`.

The `COMMON_FLAGS` in `cmake/toolchains/ARM.cmake` are not recognised by
assembler and linker.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
2020-11-06 17:25:16 +00:00
Devaraj Ranganna 915d552cde cmake: Re-order cmake script inclusions
The script `cmake/env.cmake` enables languages and in the case of Arm
compiler, `CMAKE_SYSTEM_PROCESSOR` is expected to be set before a
language is enabled. `CMAKE_SYSTEM_PROCESSOR` is set in
`cmake/core.cmake`. Therefore, `cmake/core.cmake` is included before
`cmake/env.cmake`.

Similarly, `cmake/profile.cmake` sets compiler options, hence it is
included before enabling languages in `cmake/env.cmake`.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
2020-11-06 17:25:16 +00:00
Devaraj Ranganna 6b5ef8a9a7 cmake: Stringify develop.cmake
Cleanup develop.cmake to remove ARMC5 and uArm compiler flags and
stringify cmake variables.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
2020-11-06 17:25:16 +00:00
Hugues Kamba 71c48e0e8a CMake: remove version number from ARM toolchain
The version number was required previously when ARM Compiler 5
and ARM Compiler 6 were both supported. There was a significant
underlying change between the two that justified having distinct
build options settinfgs. It is very unlikely that such a major change will happen
between ARM Compiler 6 and future versions. It is therefore also very unlikely
that distinct option settings for future versions will be needed.
We should therefore avoid appending version number the same way we do not
append it to GCC toolchain configuration settings.
2020-11-06 17:25:16 +00:00
Hugues Kamba 6dc5f5a582 CMake: Add CMake scripts 2020-11-06 17:25:14 +00:00