1# 2# Copyright 2017, Data61 3# Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4# ABN 41 687 119 230. 5# 6# This software may be distributed and modified according to the terms of 7# the BSD 2-Clause license. Note that NO WARRANTY is provided. 8# See "LICENSE_BSD2.txt" for details. 9# 10# @TAG(DATA61_BSD) 11# 12 13cmake_minimum_required(VERSION 3.7.2) 14 15project(libplatsupport C) 16 17# HACK: This is a stop-gap measure for now to allow projects that don't 18# use the CMake modules feature of our build system to build properly. 19# Some projects in particular that need to be fixed: 20# - rumprun-sel4-demoapps 21if(NOT ${PLATSUPPORT_HELPERS} STREQUAL "") 22 include(${PLATSUPPORT_HELPERS}) 23endif() 24 25set(configure_string "") 26 27config_choice( 28 LibPlatSupportX86ConsoleDevice 29 LIB_PLAT_SUPPORT_X86_CONSOLE_DEVICE 30 "X86 console device. The serial port that libplatsupport will use for communication \ 31 com1 -> 0x3f8 \ 32 com2 -> 0x2f8 \ 33 com3 -> 0x3e8 \ 34 com4 -> 0x2e8 \ 35 ega -> 80x25 text mode ega screen" 36 "com1;LibPlatSupportX86ConsoleDeviceCom1;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM1;KernelPlatPC99" 37 "com2;LibPlatSupportX86ConsoleDeviceCom2;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM1;KernelPlatPC99" 38 "com3;LibPlatSupportX86ConsoleDeviceCom3;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM1;KernelPlatPC99" 39 "com4;LibPlatSupportX86ConsoleDeviceCom4;LIB_PLAT_SUPPORT_SERIAL_PORT_X86_COM1;KernelPlatPC99" 40 "ega;LibPlatSupportX86ConsoleDeviceEGA;LIB_PLAT_SUPPORT_SERIAL_TEXT_EGA;KernelPlatPC99" 41) 42 43file( 44 GLOB 45 deps 46 src/mach/${KernelArmMach}/*.c 47 src/plat/${KernelPlatform}/*.c 48 src/*.c 49 src/plat/${KernelPlatform}/acpi/*.c 50) 51 52if(${KernelArch} STREQUAL "arm") 53 list(APPEND deps src/arch/arm/clock.c) 54 list(APPEND deps src/arch/arm/delay.c) 55 list(APPEND deps src/arch/arm/dma330.c) 56 list(APPEND deps src/arch/arm/i2c.c) 57 list(APPEND deps src/arch/arm/i2c_bitbang.c) 58 list(APPEND deps src/arch/arm/generic_timer.c) 59 list(APPEND deps src/arch/arm/irqchip/gic.c) 60 list(APPEND deps src/arch/arm/irqchip/tegra.c) 61 list(APPEND deps src/arch/arm/irqchip/gicv3.c) 62 list(APPEND deps src/arch/arm/irqchip/avic.c) 63 list(APPEND deps src/arch/arm/irqchip/omap3.c) 64 # Link the IRQ chip parser modules 65 list( 66 APPEND 67 irqchip_modules 68 "-Wl,--undefined=arm_gic_ptr,--undefined=tegra_ictlr_ptr,--undefined=arm_gicv3_ptr,\ 69--undefined=fsl_avic_ptr,--undefined=ti_omap3_ptr" 70 ) 71elseif(${KernelArch} STREQUAL "x86") 72 list(APPEND deps src/arch/x86/delay.c) 73 list(APPEND deps src/arch/x86/tsc.c) 74elseif(${KernelArch} STREQUAL "riscv") 75 list(APPEND deps src/arch/riscv/irqchip/plic.c) 76 list(APPEND irqchip_modules "-Wl,--undefined=riscv_plic_ptr") 77endif() 78 79if(KernelPlatformQEMUArmVirt) 80 if(KernelArmExportPCNTUser AND KernelArmExportPTMRUser) 81 list(APPEND deps src/arch/arm/generic_ltimer.c) 82 endif() 83endif() 84 85if(KernelPlatformExynos5422) 86 list(APPEND deps src/mach/${KernelArmMach}/clock/exynos_5422_clock.c) 87elseif(KernelPlatformExynos4 OR KernelPlatformExynos5410 OR KernelPlatformExynos5250) 88 list(APPEND deps src/mach/${KernelArmMach}/clock/exynos_common_clock.c) 89endif() 90 91if( 92 KernelPlatImx6 93 OR KernelPlatformImx7Sabre 94 OR KernelPlatformKZM 95 OR KernelPlatformImx8mq-evk 96 OR KernelPlatformImx8mm-evk 97) 98 if(NOT (KernelPlatformImx8mq-evk OR KernelPlatformImx8mm-evk)) 99 list(APPEND deps src/mach/${KernelArmMach}/epit/epit.c) 100 endif() 101 if(NOT KernelPlatformKZM) 102 list(APPEND deps src/mach/${KernelArmMach}/serial/serial.c) 103 endif() 104endif() 105if(KernelPlatformImx8mq-evk OR KernelPlatformImx8mm-evk) 106 list(APPEND deps src/plat/imx8m/chardev.c) 107 # There's no clock driver at the moment, but this is to allow the libethdrivers to build for imx8mq 108 list(APPEND deps src/plat/imx8m/clock.c) 109endif() 110 111list(SORT deps) 112 113add_config_library(platsupport "${configure_string}") 114 115add_library(platsupport EXCLUDE_FROM_ALL ${deps}) 116target_include_directories(platsupport PRIVATE src/plat_include/${KernelPlatform}) 117 118if(KernelPlatformImx8mq-evk OR KernelPlatformImx8mm-evk) 119 target_include_directories(platsupport PUBLIC plat_include/imx8m) 120endif() 121target_include_directories( 122 platsupport 123 PUBLIC include plat_include/${KernelPlatform} arch_include/${KernelArch} 124) 125if(NOT "${KernelArmMach}" STREQUAL "") 126 target_include_directories(platsupport PUBLIC mach_include/${KernelArmMach}) 127endif() 128if("${KernelArch}" STREQUAL "arm") 129 set(sel4_arch "${KernelSel4Arch}") 130 if("${KernelSel4Arch}" STREQUAL "arm_hyp") 131 set(sel4_arch "aarch32") 132 endif() 133 target_include_directories(platsupport PUBLIC sel4_arch_include/${sel4_arch}) 134endif() 135target_link_libraries( 136 platsupport 137 muslc 138 utils 139 fdt 140 sel4_autoconf 141 platsupport_Config 142 ${irqchip_modules} 143) 144