Mate Toth-Pal | 2e94d13 | 2018-01-26 17:27:52 +0100 | [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/AN519 specific files in the application. |
| 9 | |
| 10 | #MPS2/AN519 has a Cortex M23 CPU. |
| 11 | include("Common/CpuM23") |
| 12 | |
| 13 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 14 | |
| 15 | #Specify the location of platform specific build dependencies. |
Gabor Kertesz | d7d7d74 | 2018-07-04 11:50:05 +0200 | [diff] [blame] | 16 | set (BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_bl2.sct") |
| 17 | set (S_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_s.sct") |
| 18 | set (NS_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/mps2/an519/armclang/mps2_an519_ns.sct") |
| 19 | set (FLASH_LAYOUT "${PLATFORM_DIR}/target/mps2/an519/partition/flash_layout.h") |
| 20 | set (PLATFORM_LINK_INCLUDES "${PLATFORM_DIR}/target/mps2/an519/partition/") |
| 21 | set (SIGN_BIN_SIZE 0x100000) |
Mate Toth-Pal | 2e94d13 | 2018-01-26 17:27:52 +0100 | [diff] [blame] | 22 | if (DEFINED CMSIS_5_DIR) |
| 23 | # not all project defines CMSIS_5_DIR, only the ones that use it. |
| 24 | set (RTX_LIB_PATH "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MBN.lib") |
| 25 | endif() |
| 26 | |
| 27 | if (BL2) |
| 28 | set (BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME}) |
| 29 | endif() |
| 30 | |
| 31 | embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE) |
| 32 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE) |
| 33 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519" ABSOLUTE) |
| 34 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_core" ABSOLUTE) |
| 35 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/retarget" ABSOLUTE) |
| 36 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/native_drivers" ABSOLUTE) |
| 37 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/partition" ABSOLUTE) |
| 38 | |
| 39 | #Gather all source files we need. |
| 40 | if (NOT DEFINED BUILD_CMSIS_CORE) |
| 41 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!") |
| 42 | elseif(BUILD_CMSIS_CORE) |
| 43 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/cmsis_core/system_cmsdk_mps2_an519.c") |
| 44 | endif() |
| 45 | |
| 46 | if (NOT DEFINED BUILD_RETARGET) |
| 47 | message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!") |
| 48 | elseif(BUILD_RETARGET) |
| 49 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/retarget/platform_retarget_dev.c") |
| 50 | endif() |
| 51 | |
| 52 | if (NOT DEFINED BUILD_UART_STDOUT) |
| 53 | message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!") |
| 54 | elseif(BUILD_UART_STDOUT) |
Miklos Balint | 6cbeba6 | 2018-04-12 17:31:34 +0200 | [diff] [blame] | 55 | if (NOT DEFINED SECURE_UART1) |
| 56 | message(FATAL_ERROR "Configuration variable SECURE_UART1 (true|false) is undefined!") |
| 57 | elseif(SECURE_UART1) |
| 58 | add_definitions(-DSECURE_UART1) |
| 59 | endif() |
Mate Toth-Pal | 2e94d13 | 2018-01-26 17:27:52 +0100 | [diff] [blame] | 60 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c") |
| 61 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
| 62 | set(BUILD_NATIVE_DRIVERS true) |
| 63 | set(BUILD_CMSIS_DRIVERS true) |
| 64 | endif() |
| 65 | |
| 66 | if (NOT DEFINED BUILD_NATIVE_DRIVERS) |
| 67 | message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!") |
| 68 | elseif(BUILD_NATIVE_DRIVERS) |
| 69 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/native_drivers/arm_uart_drv.c") |
| 70 | |
| 71 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/native_drivers/mpc_sie200_drv.c" |
| 72 | "${PLATFORM_DIR}/target/mps2/an519/native_drivers/ppc_sse200_drv.c" |
| 73 | ) |
| 74 | endif() |
| 75 | |
| 76 | if (NOT DEFINED BUILD_TIME) |
| 77 | message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!") |
| 78 | elseif(BUILD_TIME) |
| 79 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/native_drivers/timer_cmsdk/timer_cmsdk.c") |
| 80 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/native_drivers/timer_cmsdk" ABSOLUTE) |
| 81 | endif() |
| 82 | |
| 83 | if (NOT DEFINED BUILD_STARTUP) |
| 84 | message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!") |
| 85 | elseif(BUILD_STARTUP) |
| 86 | if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG") |
| 87 | list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_s.s") |
| 88 | list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_ns.s") |
| 89 | list(APPEND ALL_SRC_ASM_BL2 "${PLATFORM_DIR}/target/mps2/an519/armclang/startup_cmsdk_mps2_an519_bl2.s") |
| 90 | else() |
| 91 | message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.") |
| 92 | endif() |
| 93 | endif() |
| 94 | |
| 95 | if (NOT DEFINED BUILD_TARGET_CFG) |
| 96 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!") |
| 97 | elseif(BUILD_TARGET_CFG) |
| 98 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/target_cfg.c") |
Mate Toth-Pal | 936c33b | 2018-04-10 14:02:07 +0200 | [diff] [blame^] | 99 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/spm_hal.c") |
| 100 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/native_drivers/mpu_armv8m_drv.c") |
| 101 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Mate Toth-Pal | 2e94d13 | 2018-01-26 17:27:52 +0100 | [diff] [blame] | 102 | endif() |
| 103 | |
| 104 | if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS) |
| 105 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!") |
| 106 | elseif(BUILD_TARGET_HARDWARE_KEYS) |
| 107 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/dummy_crypto_keys.c") |
| 108 | endif() |
| 109 | |
| 110 | if (NOT DEFINED BUILD_CMSIS_DRIVERS) |
| 111 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!") |
| 112 | elseif(BUILD_CMSIS_DRIVERS) |
| 113 | list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_MPC.c" |
| 114 | "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_PPC.c") |
| 115 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_USART.c") |
| 116 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers" ABSOLUTE) |
| 117 | embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE) |
| 118 | endif() |
| 119 | |
| 120 | if (NOT DEFINED BUILD_FLASH) |
| 121 | message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!") |
| 122 | elseif(BUILD_FLASH) |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 123 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers/Driver_Flash.c") |
Marc Moreno Berengue | 792fc68 | 2018-02-20 11:53:30 +0000 | [diff] [blame] | 124 | # There is no real flash memory for code on MPS2 board. Instead a code SRAM is |
| 125 | # used for code storage: ZBT SSRAM1. The Driver_Flash driver just emulates a flash |
| 126 | # interface and behaviour on top of the SRAM memory. |
| 127 | # As the SST area is going to be in RAM, it is required to set SST_RAM_FS to be sure the |
| 128 | # SST service knows that when it starts the SST area does not contain any valid block and |
| 129 | # it needs to create an empty one. |
| 130 | set(SST_RAM_FS True) |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 131 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an519/cmsis_drivers" ABSOLUTE) |
Mate Toth-Pal | 2e94d13 | 2018-01-26 17:27:52 +0100 | [diff] [blame] | 132 | endif() |