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 | |
| 10 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 11 | |
| 12 | embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE) |
| 13 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2" ABSOLUTE) |
| 14 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521" ABSOLUTE) |
| 15 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/cmsis_core" ABSOLUTE) |
| 16 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/retarget" ABSOLUTE) |
| 17 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/native_drivers" ABSOLUTE) |
| 18 | embedded_include_directories(PATH "${PLATFORM_DIR}/target/mps2/an521/partition" ABSOLUTE) |
| 19 | |
| 20 | #Gather all source files we need. |
| 21 | if (NOT DEFINED BUILD_CMSIS_CORE) |
| 22 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_CORE (true|false) is undefined!") |
| 23 | elseif(BUILD_CMSIS_CORE) |
| 24 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/cmsis_core/system_cmsdk_mps2_an521.c") |
| 25 | endif() |
| 26 | |
| 27 | if (NOT DEFINED BUILD_RETARGET) |
| 28 | message(FATAL_ERROR "Configuration variable BUILD_RETARGET (true|false) is undefined!") |
| 29 | elseif(BUILD_RETARGET) |
| 30 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/retarget/platform_retarget_dev.c") |
| 31 | endif() |
| 32 | |
| 33 | if (NOT DEFINED BUILD_UART_STDOUT) |
| 34 | message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!") |
| 35 | elseif(BUILD_UART_STDOUT) |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame^] | 36 | LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c") |
| 37 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 38 | set(BUILD_NATIVE_DRIVERS true) |
| 39 | set(BUILD_CMSIS_DRIVERS true) |
| 40 | endif() |
| 41 | |
| 42 | if (NOT DEFINED BUILD_NATIVE_DRIVERS) |
| 43 | message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!") |
| 44 | elseif(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 | ) |
| 50 | endif() |
| 51 | |
| 52 | if (NOT DEFINED BUILD_TIME) |
| 53 | message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!") |
| 54 | elseif(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) |
| 57 | endif() |
| 58 | |
| 59 | if (NOT DEFINED BUILD_STARTUP) |
| 60 | message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!") |
| 61 | elseif(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() |
| 69 | endif() |
| 70 | |
| 71 | if (NOT DEFINED BUILD_TARGET_CFG) |
| 72 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!") |
| 73 | elseif(BUILD_TARGET_CFG) |
| 74 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/target_cfg.c") |
| 75 | endif() |
| 76 | |
| 77 | if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS) |
| 78 | message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!") |
| 79 | elseif(BUILD_TARGET_HARDWARE_KEYS) |
| 80 | LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/mps2/an521/dummy_crypto_keys.c") |
| 81 | endif() |
| 82 | |
| 83 | if (NOT DEFINED BUILD_CMSIS_DRIVERS) |
| 84 | message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!") |
| 85 | elseif(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) |
| 91 | endif() |
| 92 | |
| 93 | if (NOT DEFINED BUILD_FLASH) |
| 94 | message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!") |
| 95 | elseif(BUILD_FLASH) |
Marc Moreno Berengue | 44af927 | 2018-01-25 17:18:00 +0000 | [diff] [blame^] | 96 | list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/flash_memory_mapped.c") |
| 97 | embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 98 | endif() |