blob: 2a62c6b145e68b6978db3f441bfdb8460dd36beb [file] [log] [blame]
Mate Toth-Pal2e94d132018-01-26 17:27:52 +01001#-------------------------------------------------------------------------------
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/AN519 specific files in the application.
9
10#MPS2/AN519 has a Cortex M23 CPU.
11include("Common/CpuM23")
12
13set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
14
15#Specify the location of platform specific build dependencies.
16set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_bl2.sct")
17set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_s.sct")
18set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_ns.sct")
19set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an519/partition/flash_layout.h")
20if (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_V8MBN.lib")
23endif()
24
25if (BL2)
26 set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
27endif()
28
29embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
30embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE)
31embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519" ABSOLUTE)
32embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_core" ABSOLUTE)
33embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/retarget" ABSOLUTE)
34embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/native_drivers" ABSOLUTE)
35embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/partition" ABSOLUTE)
36
37#Gather all source files we need.
38if (NOT DEFINED BUILD_CMSIS_CORE)
39 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!")
40elseif(BUILD_CMSIS_CORE)
41 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/cmsis_core/system_cmsdk_mps2_an519.c")
42endif()
43
44if (NOT DEFINED BUILD_RETARGET)
45 message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!")
46elseif(BUILD_RETARGET)
47 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/retarget/platform_retarget_dev.c")
48endif()
49
50if (NOT DEFINED BUILD_UART_STDOUT)
51 message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
52elseif(BUILD_UART_STDOUT)
53 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
54 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
55 set(BUILD_NATIVE_DRIVERS true)
56 set(BUILD_CMSIS_DRIVERS true)
57endif()
58
59if (NOT DEFINED BUILD_NATIVE_DRIVERS)
60 message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
61elseif(BUILD_NATIVE_DRIVERS)
62 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/native_drivers/arm_uart_drv.c")
63
64 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/native_drivers/mpc_sie200_drv.c"
65 "${PLATFORM_DIR}/target/mps2/an519/native_drivers/ppc_sse200_drv.c"
66 )
67endif()
68
69if (NOT DEFINED BUILD_TIME)
70 message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
71elseif(BUILD_TIME)
72 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/native_drivers/timer_cmsdk/timer_cmsdk.c")
73 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/native_drivers/timer_cmsdk" ABSOLUTE)
74endif()
75
76if (NOT DEFINED BUILD_STARTUP)
77 message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
78elseif(BUILD_STARTUP)
79 if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
80 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s")
81 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_ns.s")
82 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_bl2.s")
83 else()
84 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
85 endif()
86endif()
87
88if (NOT DEFINED BUILD_TARGET_CFG)
89 message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
90elseif(BUILD_TARGET_CFG)
91 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/target_cfg.c")
92endif()
93
94if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
95 message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
96elseif(BUILD_TARGET_HARDWARE_KEYS)
97 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/dummy_crypto_keys.c")
98endif()
99
100if (NOT DEFINED BUILD_CMSIS_DRIVERS)
101 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
102elseif(BUILD_CMSIS_DRIVERS)
103 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_MPC.c"
104 "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_PPC.c")
105 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_USART.c")
106 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers" ABSOLUTE)
107 embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
108endif()
109
110if (NOT DEFINED BUILD_FLASH)
111 message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
112elseif(BUILD_FLASH)
113 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/flash_memory_mapped.c")
114 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
115endif()