blob: 89edff789eae20c69b7418edd94e5d3a7678fec2 [file] [log] [blame]
Avinash Mehta788036c2018-03-15 12:38:43 +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 musca specific files in the application.
9
10#MUSCA-A has a Cortex M33 CPU.
11include("Common/CpuM33")
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/musca_a/Device/Source/armclang/musca_bl2.sct")
17set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/musca_a/Device/Source/armclang/musca_s.sct")
18set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/musca_a/Device/Source/armclang/musca_ns.sct")
19set (FLASH_LAYOUT "${PLATFORM_DIR}/target/musca_a/partition/flash_layout.h")
20set (SIGN_BIN_SIZE 0x30000)
21if (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
30embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
31embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a" ABSOLUTE)
32embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver/Config" ABSOLUTE)
33embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/Device/Config" ABSOLUTE)
34embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/Device/Include" ABSOLUTE)
35embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/Native_Driver" ABSOLUTE)
36embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/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/musca_a/Device/Source/system_cmsdk_musca.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/musca_a/Device/Source/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)
Miklos Balint6cbeba62018-04-12 17:31:34 +020054 if (NOT DEFINED SECURE_UART1)
55 message(FATAL_ERROR "Configuration variable SECURE_UART1 (true|false) is undefined!")
56 elseif(SECURE_UART1)
57 message(FATAL_ERROR "Configuration SECURE_UART1 TRUE is invalid for this target!")
58 endif()
Avinash Mehta788036c2018-03-15 12:38:43 +000059 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
60 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
61 set(BUILD_NATIVE_DRIVERS true)
62 set(BUILD_CMSIS_DRIVERS true)
63endif()
64
65if (NOT DEFINED BUILD_NATIVE_DRIVERS)
66 message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
67elseif(BUILD_NATIVE_DRIVERS)
68 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/Native_Driver/uart_pl011_drv.c")
69 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/Native_Driver/arm_scc_drv.c")
70
71 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_a/Native_Driver/mpc_sie200_drv.c"
72 "${PLATFORM_DIR}/target/musca_a/Native_Driver/ppc_sse200_drv.c")
73endif()
74
75if (NOT DEFINED BUILD_TIME)
76 message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
77elseif(BUILD_TIME)
78 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/Native_Driver/timer_cmsdk.c")
79 embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/Native_Driver" ABSOLUTE)
80endif()
81
82if (NOT DEFINED BUILD_STARTUP)
83 message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
84elseif(BUILD_STARTUP)
85 if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
86 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/musca_a/Device/Source/armclang/startup_cmsdk_musca_s.s")
87 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/musca_a/Device/Source/armclang/startup_cmsdk_musca_ns.s")
88 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/musca_a/Device/Source/armclang/startup_cmsdk_musca_bl2.s")
89 else()
90 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
91 endif()
92endif()
93
94if (NOT DEFINED BUILD_TARGET_CFG)
95 message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
96elseif(BUILD_TARGET_CFG)
97 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/target_cfg.c")
98endif()
99
100if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
101 message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
102elseif(BUILD_TARGET_HARDWARE_KEYS)
103 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/dummy_crypto_keys.c")
104endif()
105
106if (NOT DEFINED BUILD_CMSIS_DRIVERS)
107 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
108elseif(BUILD_CMSIS_DRIVERS)
109 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver/Driver_MPC.c"
110 "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver/Driver_PPC.c")
111 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver/Driver_USART.c")
112 embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver" ABSOLUTE)
113 embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
114endif()
115
116if (NOT DEFINED BUILD_FLASH)
117 message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
118elseif(BUILD_FLASH)
Avinash Mehta2e1b9bc2018-05-03 12:55:50 +0100119 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver/Driver_Flash.c")
120 # As the SST area is going to be in RAM, it is required to set SST_RAM_FS to be sure the
121 # SST service knows that when it starts the SST area does not contain any valid block and
122 # it needs to create an empty one.
123 set(SST_RAM_FS True)
124 embedded_include_directories(PATH "${PLATFORM_DIR}/target/musca_a/CMSIS_Driver" ABSOLUTE)
Avinash Mehta788036c2018-03-15 12:38:43 +0000125endif()