Commit Graph

171 Commits (c3f3ed7661d1d4de334f3bb6552caa856932e934)

Author SHA1 Message Date
Jaeden Amero c3f3ed7661 cmake: Use namespaced greentea client library
When using an exported or installed version of greentea, it's necessary
to use the greentea namespace.
2021-07-07 14:29:14 +01:00
Jaeden Amero 4e2206e482 Use standalone greentea-client
For CMake or Mbed CLI 2, use the standalone greentea-client.
2021-07-07 14:29:14 +01:00
Lingkai Dong f4d551e80e CMake: Replace MBED_TEST_LINK_LIBRARIES with MBED_TEST_BAREMETAL
Currently we have `MBED_TEST_LINK_LIBRARIES` for specifying
* Whether to link `mbed-os` or `mbed-baremetal`
* Any additional libraries we want tests to link

It's not fit for purpose anymore, because
* No flavor of Mbed OS is selected by default, but we should've
really defaulted to `mbed-os`, the full RTOS version. Build doesn't
work unless `-DMBED_TEST_LINK_LIBRARIES=<...>` is passed, which
is redundant.
* A test should never need additional libraries passed via command
line - its `CMakeLists.txt` should specify what it links.

This commit replaces `MBED_TEST_LINK_LIBRARIES` with a new option
`MBED_TEST_BAREMETAL` to build a test with either RTOS (default)
or without it (by passing `-DMBED_TEST_BAREMETAL=ON`).
2021-07-06 13:43:06 +01:00
Lingkai Dong 2a1d50f0fa app.cmake: Replace tabs with spaces
The coding standards of Mbed OS require indentation of four spaces.
2021-07-06 13:35:43 +01:00
Robert Walton dfb4e087e3 CMake: greentea: Remove dependency on global MBED_PATH
The mbed_greentea_add_test macro required a greentea test to set an
MBED_PATH variable to the path of the mbed-os root directory, which it
attempts to add as a 'subdirectory' of the test project. We can instead
use CMake's built in CMAKE_CURRENT_LIST_DIR variable to deduce the path
to mbed-os relative to the current list file directory, removing the
need for greentea tests to set MBED_PATH.
2021-07-06 10:53:32 +01:00
Robert Walton d5a4ad1fe9 CMake: greentea: Remove call to deprecated function
mbed_greentea::mbed_greentea_add_test was calling the deprecated
`mbed_configure_app_target` function, which is currently a no-op.
2021-07-05 22:53:35 +01:00
Robert Walton da6febf616 CMake: mbed_greentea: Remove trailing whitespace 2021-07-02 11:44:51 +01:00
Jaeden Amero b5c2f7079e
Merge pull request #14718 from Meano/develop
Feature: Make changes for Cortex-A5 support
2021-07-01 10:23:41 +01:00
Jaeden Amero 9b09cddf1d python: Update requirements
Update versions of urllib3, PyYAML, jinja2, cryptography.
2021-06-30 09:12:31 +01:00
Hari Limaye f95052cf6f CMake: Require TEST_SOURCES in greentea CMake file
Assumption that greentea test file is always named main.cpp is
incorrect. Updated mbed_greentea_add_test() macro to make TEST_SOURCES
parameter compulsory, which is used to specify greentea test
file(s). This allows tests to use C, or have a different name.
Therefore also updated all pre-existing greentea test CMake files to
explicity add main.cpp to TEST_SOURCES.
2021-06-29 13:33:42 +01:00
Hari Limaye defc80a13e CMake: Remove alias for TEST_NAME argument
The mbed_greentea_add_test macro previously set a variable in order to
use the un-prefixed TEST_NAME to refer to the argument in the macro
body. Whilst pair-programming with LDong, this was identified and
determined to be unecessary (maybe it was a failed attempt to fix
something, that was never reversed?) and so it has been removed.
2021-06-29 13:32:57 +01:00
Meano ff2188150a Make changes for Cortex-A5 support 2021-06-23 13:36:55 +08:00
Meano a57b892cb8 Unify the cores/Cortex-A.cmake 2021-06-23 13:36:54 +08:00
Meano d8917a47e5 Remove unused old symbols: __MBED_CMSIS_RTOS_CM/A9 2021-06-23 13:34:16 +08:00
Werner Lewis bef020b0c7 cmake: Remove armasm workaround for Cortex M55 2021-05-24 13:56:19 +01:00
Martin Kojtal e25e94e74a
Merge pull request #14538 from harmut01/cmake-test-mode
Cmake: Add MBED_TEST_MODE macro
2021-05-11 11:12:19 +02:00
Jaeden Amero a29a5e165a cortex-m55: Workaround armasm options bug
We use armclang with `-masm=auto` to auto-select which assembler to use
based on the syntax of the file. Cortex-M55 isn't supported by armasm,
but we don't yet have GCC-syntax asm files for ARM compiler
(1dd090bd1c/CMSIS/RTOS2/RTX/Source/ARM/irq_armv8mml.s).

    $ armclang --target=arm-arm-none-eabi -mcpu=cortex-m55 -mfpu=none -masm=auto -c cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S
    armclang: error: armasm does not support CPU 'cortex-m55'

In the mean time, we can build C and C++ files using the
`-mcpu=cortex-m55` option, and for armasm, cancel out that choice of CPU
with a known-supported CPU type, Cortex-R7, and provide the legacy
assembler-specific option `-Wa,armasm,--cpu=cortex-m55`.

After these changes, this works:

    $ armclang --target=arm-arm-none-eabi -mcpu=cortex-m55 -mcpu=cortex-r7 -Wa,--cpu=cortex-m55 -mfpu=none -masm=auto -c cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S
2021-05-05 16:58:24 +01:00
harmut01 c29b561784 CMake: Refactor MBED_TEST_MODE test application 2021-04-28 14:21:33 +01:00
harmut01 fa1d9c059d Cmake: Add backward compatibilty support for MBED_TEST_MODE
Fixes #14494

MBED_TEST_MODE is required for backward compatibilty with CLI1. This
adds a test to ensure that the macro is created when using CLI2 for
testing. This also adds a test in `.travis.yml` that checks whether
CMake defines the macro when BUILD_TESTING is on.

CLI1 Reference: https://os.mbed.com/docs/mbed-os/v6.9/debug-test/greentea-for-testing-applications.html

Also, explicitly create and set the macro BUILD_TESTING to allow for
MBED_TEST_MODE to be defined by CMake. MBED_TEST_MODE is required for
backward compatibilty with CLI1.  BUILD_TESTING is used to determine
whether to define MBED_TEST_MODE.  Normally, this would be automatically
done by CTest (which we intend to add for test automation) but this
hasn't yet been added to our Greentea tests.
2021-04-28 14:21:33 +01:00
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