blob: 1865d03933fd748205be2b68e6422da862d1f01c [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.
Mate Toth-Pal76867262018-03-09 13:15:36 +010016#FIXME use CMAKE_C_COMPILER_ID here instead?
17if(COMPILER STREQUAL "ARMCLANG")
18 set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_bl2.sct")
19 set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_s.sct")
20 set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/armclang/mps2_an521_ns.sct")
21 if (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")
24 endif()
25elseif(COMPILER STREQUAL "GNUARM")
26 set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/gcc/mps2_an521_bl2.ld")
27 set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/gcc/mps2_an521_s.ld")
28 set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an521/gcc/mps2_an521_ns.ld")
29 if (DEFINED CMSIS_5_DIR)
30 # not all project defines CMSIS_5_DIR, only the ones that use it.
31 set (RTX_LIB_PATH "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a")
32 endif()
33else()
34 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
35endif()
Gabor Kerteszd7d7d742018-07-04 11:50:05 +020036set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an521/partition/flash_layout.h")
37set (PLATFORM_LINK_INCLUDES "${PLATFORM_DIR}/target/mps2/an521/partition/")
38set (SIGN_BIN_SIZE 0x100000)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010039
40if (BL2)
41 set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
42endif()
43
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000044embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
45embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE)
46embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE)
47embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE)
48embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE)
49embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE)
50embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE)
51
52#Gather all source files we need.
53if (NOT DEFINED BUILD_CMSIS_CORE)
54 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!")
55elseif(BUILD_CMSIS_CORE)
56 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c")
57endif()
58
59if (NOT DEFINED BUILD_RETARGET)
60 message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!")
61elseif(BUILD_RETARGET)
62 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c")
63endif()
64
65if (NOT DEFINED BUILD_UART_STDOUT)
66 message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
67elseif(BUILD_UART_STDOUT)
Miklos Balint6cbeba62018-04-12 17:31:34 +020068 if (NOT DEFINED SECURE_UART1)
69 message(FATAL_ERROR "Configuration variable SECURE_UART1 (true|false) is undefined!")
70 elseif(SECURE_UART1)
71 add_definitions(-DSECURE_UART1)
72 endif()
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010073 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
Marc Moreno Berengue44af9272018-01-25 17:18:00 +000074 embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000075 set(BUILD_NATIVE_DRIVERS true)
76 set(BUILD_CMSIS_DRIVERS true)
77endif()
78
79if (NOT DEFINED BUILD_NATIVE_DRIVERS)
80 message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
81elseif(BUILD_NATIVE_DRIVERS)
82 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/arm_uart_drv.c")
83
84 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/native_drivers/mpc_sie200_drv.c"
85 "${PLATFORM_DIR}/target/mps2/an521/native_drivers/ppc_sse200_drv.c"
86 )
87endif()
88
89if (NOT DEFINED BUILD_TIME)
90 message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
91elseif(BUILD_TIME)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010092 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 +000093 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk" ABSOLUTE)
94endif()
95
96if (NOT DEFINED BUILD_STARTUP)
97 message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
98elseif(BUILD_STARTUP)
99 if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
100 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s")
101 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_ns.s")
102 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_bl2.s")
Mate Toth-Pal76867262018-03-09 13:15:36 +0100103 elseif(CMAKE_C_COMPILER_ID STREQUAL "GNUARM")
104 list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_s.S")
105 list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_ns.S")
106 list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_bl2.S")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000107 else()
108 message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
109 endif()
110endif()
111
112if (NOT DEFINED BUILD_TARGET_CFG)
113 message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
114elseif(BUILD_TARGET_CFG)
115 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c")
116endif()
117
118if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
119 message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
120elseif(BUILD_TARGET_HARDWARE_KEYS)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100121 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000122endif()
123
124if (NOT DEFINED BUILD_CMSIS_DRIVERS)
125 message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
126elseif(BUILD_CMSIS_DRIVERS)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100127 list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_MPC.c"
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000128 "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_PPC.c")
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100129 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_USART.c")
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000130 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE)
131 embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
132endif()
133
134if (NOT DEFINED BUILD_FLASH)
135 message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
136elseif(BUILD_FLASH)
Tamas Banc3828852018-02-01 12:24:16 +0000137 list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_Flash.c")
Marc Moreno Berengue792fc682018-02-20 11:53:30 +0000138 # There is no real flash memory for code on MPS2 board. Instead a code SRAM is
139 # used for code storage: ZBT SSRAM1. The Driver_Flash driver just emulates a flash
140 # interface and behaviour on top of the SRAM memory.
141 # As the SST area is going to be in RAM, it is required to set SST_RAM_FS to be sure the
142 # SST service knows that when it starts the SST area does not contain any valid block and
143 # it needs to create an empty one.
144 set(SST_RAM_FS True)
Tamas Banc3828852018-02-01 12:24:16 +0000145 embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000146endif()