blob: 68beb5d8a4d6412f3f4c27613fe513f934b93345 [file] [log] [blame]
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +00001#-------------------------------------------------------------------------------
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-Pal48fc6a02018-01-24 09:50:14 +010010#MPS2/AN521 has a Cortex M33 CPU.
11include("Common/CpuM33")
12
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000013set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
14
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010015#Specify the location of platform specific build dependencies.
16set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_bl2.sct")
17set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_s.sct")
18set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_ns.sct")
19set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an521/partition/flash_layout.h")
Avinash Mehta788036c2018-03-15 12:38:43 +000020set (SIGN_BIN_SIZE 0x100000)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010021if (DEFINED CMSIS_5_DIR)
22 # not all project defines CMSIS_5_DIR, only the ones that use it.
23 set (RTX_LIB_PATH "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib")
24endif()
25
26if (BL2)
27 set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
28endif()
29
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000030embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
31embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE)
32embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE)
33embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE)
34embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE)
35embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE)
36embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE)
37
38#Gather all source files we need.
39if (NOT DEFINED BUILD_CMSIS_CORE)
40 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!")
41elseif(BUILD_CMSIS_CORE)
42 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c")
43endif()
44
45if (NOT DEFINED BUILD_RETARGET)
46 message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!")
47elseif(BUILD_RETARGET)
48 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c")
49endif()
50
51if (NOT DEFINED BUILD_UART_STDOUT)
52 message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
53elseif(BUILD_UART_STDOUT)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010054 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
Marc Moreno Berengue44af9272018-01-25 17:18:00 +000055 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000056 set(BUILD_NATIVE_DRIVERS true)
57 set(BUILD_CMSIS_DRIVERS true)
58endif()
59
60if (NOT DEFINED BUILD_NATIVE_DRIVERS)
61 message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
62elseif(BUILD_NATIVE_DRIVERS)
63 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/arm_uart_drv.c")
64
65 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/native_drivers/mpc_sie200_drv.c"
66 "${PLATFORM_DIR}/target/mps2/an521/native_drivers/ppc_sse200_drv.c"
67 )
68endif()
69
70if (NOT DEFINED BUILD_TIME)
71 message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
72elseif(BUILD_TIME)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010073 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk/timer_cmsdk.c")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000074 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk" ABSOLUTE)
75endif()
76
77if (NOT DEFINED BUILD_STARTUP)
78 message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
79elseif(BUILD_STARTUP)
80 if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
81 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s")
82 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_ns.s")
83 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_bl2.s")
84 else()
85 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
86 endif()
87endif()
88
89if (NOT DEFINED BUILD_TARGET_CFG)
90 message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
91elseif(BUILD_TARGET_CFG)
92 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c")
93endif()
94
95if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
96 message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
97elseif(BUILD_TARGET_HARDWARE_KEYS)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010098 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000099endif()
100
101if (NOT DEFINED BUILD_CMSIS_DRIVERS)
102 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
103elseif(BUILD_CMSIS_DRIVERS)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100104 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_MPC.c"
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000105 "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_PPC.c")
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100106 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_USART.c")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000107 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE)
108 embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
109endif()
110
111if (NOT DEFINED BUILD_FLASH)
112 message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
113elseif(BUILD_FLASH)
Marc Moreno Berengue44af9272018-01-25 17:18:00 +0000114 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/flash_memory_mapped.c")
115 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000116endif()