Bhavik Patel | 68c1f1b | 2020-07-29 12:28:18 +0200 | [diff] [blame] | 1 | # |
Davide Grohmann | 1cdbbda | 2022-02-15 15:49:08 +0100 | [diff] [blame] | 2 | # Copyright (c) 2019-2022 Arm Limited. All rights reserved. |
Bhavik Patel | 68c1f1b | 2020-07-29 12:28:18 +0200 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 7 | # not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | |
Per Åstrand | 3c60f14 | 2021-01-28 11:58:38 +0100 | [diff] [blame] | 19 | # Include FreeRTOS kernel |
| 20 | if(CORE_SOFTWARE_RTOS_LOWER STREQUAL "freertos" OR CORE_SOFTWARE_RTOS_LOWER STREQUAL "all") |
Bhavik Patel | 68c1f1b | 2020-07-29 12:28:18 +0200 | [diff] [blame] | 21 | set(FREERTOS_KERNEL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/freertos/freertos_kernel" CACHE PATH "Path to FreeRTOS kernel.") |
| 22 | add_subdirectory(freertos_config) |
Bhavik Patel | 68c1f1b | 2020-07-29 12:28:18 +0200 | [diff] [blame] | 23 | endif() |
liodek01 | 8e13f90 | 2021-06-24 12:14:47 +0300 | [diff] [blame] | 24 | |
| 25 | # Include ThreadX |
Per Åstrand | 10707e4 | 2022-02-21 12:01:06 +0100 | [diff] [blame^] | 26 | # Only enable cortex-m55 until cortex-m33 is sorted out upstream |
| 27 | if((CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m55") AND |
| 28 | (CORE_SOFTWARE_RTOS_LOWER STREQUAL "threadx" OR CORE_SOFTWARE_RTOS_LOWER STREQUAL "all")) |
liodek01 | 8e13f90 | 2021-06-24 12:14:47 +0300 | [diff] [blame] | 29 | #threadx build requires 2 defines: THREADX_ARCH (format: cortex_m4) and THREADX_TOOLCHAIN (ac5/ac6/gnu). |
| 30 | #set them according to existing defines CMAKE_SYSTEM_PROCESSOR and CMAKE_CXX_COMPILER_ID: |
| 31 | string(REPLACE "-" "_" THREADX_ARCH ${CMAKE_SYSTEM_PROCESSOR}) |
| 32 | string(TOLOWER ${CMAKE_CXX_COMPILER_ID} THREADX_TOOLCHAIN) |
| 33 | #if armclang, change the format to "ac6". |
| 34 | if(THREADX_TOOLCHAIN STREQUAL "armclang") |
| 35 | set(THREADX_TOOLCHAIN "ac6") |
| 36 | endif() |
Davide Grohmann | 1cdbbda | 2022-02-15 15:49:08 +0100 | [diff] [blame] | 37 | |
liodek01 | 8e13f90 | 2021-06-24 12:14:47 +0300 | [diff] [blame] | 38 | #if ThreadX supports this configuration, build ThreadX. |
| 39 | if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/threadx/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN}/CMakeLists.txt) |
| 40 | add_subdirectory(threadx) |
Davide Grohmann | 1cdbbda | 2022-02-15 15:49:08 +0100 | [diff] [blame] | 41 | if(THREADX_ARCH STREQUAL "cortex_m33" OR THREADX_ARCH STREQUAL "cortex_m55") |
| 42 | target_compile_definitions(threadx PUBLIC TX_SINGLE_MODE_SECURE) |
| 43 | endif() |
liodek01 | 8e13f90 | 2021-06-24 12:14:47 +0300 | [diff] [blame] | 44 | else() |
| 45 | message(STATUS "Skipping ThreadX build - doesn't support toolchain=${THREADX_TOOLCHAIN} and cpu=${THREADX_ARCH}") |
| 46 | endif() |
Per Åstrand | 10707e4 | 2022-02-21 12:01:06 +0100 | [diff] [blame^] | 47 | else() |
| 48 | message(STATUS "Disabling ThreadX for ${CMAKE_SYSTEM_PROCESSOR}, due to upstream issues") |
| 49 | # Disable cpu until upstream issue with missing files is sorted out |
liodek01 | 8e13f90 | 2021-06-24 12:14:47 +0300 | [diff] [blame] | 50 | endif() |