Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #This file gathers all MPS2/AN521 specific files in the application. |
| 9 | |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 10 | #MPS2/AN521 has a Cortex M33 CPU. |
| 11 | include("Common/CpuM33") |
| 12 | |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 13 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 14 | |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 15 | #Specify the location of platform specific build dependencies. |
| 16 | set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_bl2.sct") |
| 17 | set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_s.sct") |
| 18 | set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_ns.sct") |
| 19 | set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an521/partition/flash_layout.h") |
| 20 | if (DEFINED CMSIS_5_DIR) |
| 21 | # not all project defines CMSIS_5_DIR, only the ones that use it. |
| 22 | set (RTX_LIB_PATH "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib") |
| 23 | endif() |
| 24 | |
| 25 | if (BL2) |
| 26 | set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME}) |
| 27 | endif() |
| 28 | |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 29 | embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE) |
| 30 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE) |
| 31 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE) |
| 32 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE) |
| 33 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE) |
| 34 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE) |
| 35 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE) |
| 36 | |
| 37 | #Gather all source files we need. |
| 38 | if (NOT DEFINED BUILD_CMSIS_CORE) |
| 39 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!") |
| 40 | elseif(BUILD_CMSIS_CORE) |
| 41 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c") |
| 42 | endif() |
| 43 | |
| 44 | if (NOT DEFINED BUILD_RETARGET) |
| 45 | message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!") |
| 46 | elseif(BUILD_RETARGET) |
| 47 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c") |
| 48 | endif() |
| 49 | |
| 50 | if (NOT DEFINED BUILD_UART_STDOUT) |
| 51 | message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!") |
| 52 | elseif(BUILD_UART_STDOUT) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 53 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c") |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame] | 54 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 55 | set(BUILD_NATIVE_DRIVERS true) |
| 56 | set(BUILD_CMSIS_DRIVERS true) |
| 57 | endif() |
| 58 | |
| 59 | if (NOT DEFINED BUILD_NATIVE_DRIVERS) |
| 60 | message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!") |
| 61 | elseif(BUILD_NATIVE_DRIVERS) |
| 62 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/arm_uart_drv.c") |
| 63 | |
| 64 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/native_drivers/mpc_sie200_drv.c" |
| 65 | "${PLATFORM_DIR}/target/mps2/an521/native_drivers/ppc_sse200_drv.c" |
| 66 | ) |
| 67 | endif() |
| 68 | |
| 69 | if (NOT DEFINED BUILD_TIME) |
| 70 | message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!") |
| 71 | elseif(BUILD_TIME) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 72 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk/timer_cmsdk.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 73 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk" ABSOLUTE) |
| 74 | endif() |
| 75 | |
| 76 | if (NOT DEFINED BUILD_STARTUP) |
| 77 | message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!") |
| 78 | elseif(BUILD_STARTUP) |
| 79 | if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG") |
| 80 | list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s") |
| 81 | list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_ns.s") |
| 82 | list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_bl2.s") |
| 83 | else() |
| 84 | message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.") |
| 85 | endif() |
| 86 | endif() |
| 87 | |
| 88 | if (NOT DEFINED BUILD_TARGET_CFG) |
| 89 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!") |
| 90 | elseif(BUILD_TARGET_CFG) |
| 91 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c") |
| 92 | endif() |
| 93 | |
| 94 | if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS) |
| 95 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!") |
| 96 | elseif(BUILD_TARGET_HARDWARE_KEYS) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 97 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 98 | endif() |
| 99 | |
| 100 | if (NOT DEFINED BUILD_CMSIS_DRIVERS) |
| 101 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!") |
| 102 | elseif(BUILD_CMSIS_DRIVERS) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 103 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_MPC.c" |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 104 | "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_PPC.c") |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame^] | 105 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_USART.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 106 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE) |
| 107 | embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE) |
| 108 | endif() |
| 109 | |
| 110 | if (NOT DEFINED BUILD_FLASH) |
| 111 | message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!") |
| 112 | elseif(BUILD_FLASH) |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame] | 113 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/flash_memory_mapped.c") |
| 114 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 115 | endif() |