blob: 80190f4ad7b16a800d02c52124113d81b6796186 [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
10set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
11
12embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
13embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE)
14embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE)
15embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE)
16embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE)
17embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE)
18embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE)
19
20#Gather all source files we need.
21if (NOT DEFINED BUILD_CMSIS_CORE)
22 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!")
23elseif(BUILD_CMSIS_CORE)
24 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c")
25endif()
26
27if (NOT DEFINED BUILD_RETARGET)
28 message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!")
29elseif(BUILD_RETARGET)
30 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c")
31endif()
32
33if (NOT DEFINED BUILD_UART_STDOUT)
34 message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
35elseif(BUILD_UART_STDOUT)
Marc Moreno Berengue44af9272018-01-25 17:18:00 +000036 LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
37 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000038 set(BUILD_NATIVE_DRIVERS true)
39 set(BUILD_CMSIS_DRIVERS true)
40endif()
41
42if (NOT DEFINED BUILD_NATIVE_DRIVERS)
43 message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
44elseif(BUILD_NATIVE_DRIVERS)
45 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/arm_uart_drv.c")
46
47 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/native_drivers/mpc_sie200_drv.c"
48 "${PLATFORM_DIR}/target/mps2/an521/native_drivers/ppc_sse200_drv.c"
49 )
50endif()
51
52if (NOT DEFINED BUILD_TIME)
53 message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
54elseif(BUILD_TIME)
55 LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk/timer_cmsdk.c")
56 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk" ABSOLUTE)
57endif()
58
59if (NOT DEFINED BUILD_STARTUP)
60 message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
61elseif(BUILD_STARTUP)
62 if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
63 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s")
64 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_ns.s")
65 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_bl2.s")
66 else()
67 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
68 endif()
69endif()
70
71if (NOT DEFINED BUILD_TARGET_CFG)
72 message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
73elseif(BUILD_TARGET_CFG)
74 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c")
75endif()
76
77if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
78 message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
79elseif(BUILD_TARGET_HARDWARE_KEYS)
80 LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c")
81endif()
82
83if (NOT DEFINED BUILD_CMSIS_DRIVERS)
84 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
85elseif(BUILD_CMSIS_DRIVERS)
86 LIST(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_MPC.c"
87 "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_PPC.c")
88 LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_USART.c")
89 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE)
90 embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
91endif()
92
93if (NOT DEFINED BUILD_FLASH)
94 message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
95elseif(BUILD_FLASH)
Marc Moreno Berengue44af9272018-01-25 17:18:00 +000096 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/flash_memory_mapped.c")
97 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000098endif()