Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 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-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 10 | #MPS2/AN521 has a Cortex M33 CPU. |
| 11 | include("Common/CpuM33") |
| 12 | |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 13 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 14 | |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 15 | #Specify the location of platform specific build dependencies. |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 16 | #FIXME use CMAKE_C_COMPILER_ID here instead? |
| 17 | if(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() |
| 25 | elseif(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() |
| 33 | else() |
| 34 | message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.") |
| 35 | endif() |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 36 | set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an521/partition/flash_layout.h") |
Avinash Mehta | 788036c | 2018-03-15 12:38:43 +0000 | [diff] [blame] | 37 | set (SIGN_BIN_SIZE 0x100000) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 38 | |
| 39 | if (BL2) |
| 40 | set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME}) |
| 41 | endif() |
| 42 | |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 43 | embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE) |
| 44 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE) |
| 45 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE) |
| 46 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE) |
| 47 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE) |
| 48 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE) |
| 49 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE) |
| 50 | |
| 51 | #Gather all source files we need. |
| 52 | if (NOT DEFINED BUILD_CMSIS_CORE) |
| 53 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!") |
| 54 | elseif(BUILD_CMSIS_CORE) |
| 55 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c") |
| 56 | endif() |
| 57 | |
| 58 | if (NOT DEFINED BUILD_RETARGET) |
| 59 | message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!") |
| 60 | elseif(BUILD_RETARGET) |
| 61 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c") |
| 62 | endif() |
| 63 | |
| 64 | if (NOT DEFINED BUILD_UART_STDOUT) |
| 65 | message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!") |
| 66 | elseif(BUILD_UART_STDOUT) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 67 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c") |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame] | 68 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 69 | set(BUILD_NATIVE_DRIVERS true) |
| 70 | set(BUILD_CMSIS_DRIVERS true) |
| 71 | endif() |
| 72 | |
| 73 | if (NOT DEFINED BUILD_NATIVE_DRIVERS) |
| 74 | message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!") |
| 75 | elseif(BUILD_NATIVE_DRIVERS) |
| 76 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/arm_uart_drv.c") |
| 77 | |
| 78 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/native_drivers/mpc_sie200_drv.c" |
| 79 | "${PLATFORM_DIR}/target/mps2/an521/native_drivers/ppc_sse200_drv.c" |
| 80 | ) |
| 81 | endif() |
| 82 | |
| 83 | if (NOT DEFINED BUILD_TIME) |
| 84 | message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!") |
| 85 | elseif(BUILD_TIME) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 86 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk/timer_cmsdk.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 87 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers/timer_cmsdk" ABSOLUTE) |
| 88 | endif() |
| 89 | |
| 90 | if (NOT DEFINED BUILD_STARTUP) |
| 91 | message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!") |
| 92 | elseif(BUILD_STARTUP) |
| 93 | if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG") |
| 94 | list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_s.s") |
| 95 | list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_ns.s") |
| 96 | list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/armclang/startup_cmsdk_mps2_an521_bl2.s") |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 97 | elseif(CMAKE_C_COMPILER_ID STREQUAL "GNUARM") |
| 98 | list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_s.S") |
| 99 | list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_ns.S") |
| 100 | list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an521/gcc/startup_cmsdk_mps2_an521_bl2.S") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 101 | else() |
| 102 | message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.") |
| 103 | endif() |
| 104 | endif() |
| 105 | |
| 106 | if (NOT DEFINED BUILD_TARGET_CFG) |
| 107 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!") |
| 108 | elseif(BUILD_TARGET_CFG) |
| 109 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c") |
| 110 | endif() |
| 111 | |
| 112 | if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS) |
| 113 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!") |
| 114 | elseif(BUILD_TARGET_HARDWARE_KEYS) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 115 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 116 | endif() |
| 117 | |
| 118 | if (NOT DEFINED BUILD_CMSIS_DRIVERS) |
| 119 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!") |
| 120 | elseif(BUILD_CMSIS_DRIVERS) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 121 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_MPC.c" |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 122 | "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_PPC.c") |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 123 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_USART.c") |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 124 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE) |
| 125 | embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE) |
| 126 | endif() |
| 127 | |
| 128 | if (NOT DEFINED BUILD_FLASH) |
| 129 | message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!") |
| 130 | elseif(BUILD_FLASH) |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 131 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers/Driver_Flash.c") |
Marc Moreno Berengue | 792fc68 | 2018-02-20 11:53:30 +0000 | [diff] [blame^] | 132 | # There is no real flash memory for code on MPS2 board. Instead a code SRAM is |
| 133 | # used for code storage: ZBT SSRAM1. The Driver_Flash driver just emulates a flash |
| 134 | # interface and behaviour on top of the SRAM memory. |
| 135 | # As the SST area is going to be in RAM, it is required to set SST_RAM_FS to be sure the |
| 136 | # SST service knows that when it starts the SST area does not contain any valid block and |
| 137 | # it needs to create an empty one. |
| 138 | set(SST_RAM_FS True) |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 139 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_drivers" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 140 | endif() |