1#
2# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3#
4# SPDX-License-Identifier: GPL-2.0-only
5#
6
7cmake_minimum_required(VERSION 3.7.2)
8
9declare_platform(zynqmp KernelPlatformZynqmp PLAT_ZYNQMP KernelArchARM)
10
11set(c_configs PLAT_ZYNQMP_ZCU102 PLAT_ZYNQMP_ULTRA96)
12set(cmake_configs KernelPlatformZynqmpZcu102 KernelPlatformZynqmpUltra96)
13set(plat_lists zcu102 ultra96)
14foreach(config IN LISTS cmake_configs)
15    unset(${config} CACHE)
16endforeach()
17
18if(KernelPlatformZynqmp)
19    set(KernelHardwareDebugAPIUnsupported ON CACHE INTERNAL "")
20    if("${KernelSel4Arch}" STREQUAL aarch32)
21        declare_seL4_arch(aarch32)
22    elseif("${KernelSel4Arch}" STREQUAL aarch64)
23        declare_seL4_arch(aarch64)
24    elseif("${KernelSel4Arch}" STREQUAL arm_hyp)
25        declare_seL4_arch(arm_hyp)
26    else()
27        fallback_declare_seL4_arch_default(aarch64)
28    endif()
29
30    check_platform_and_fallback_to_default(KernelARMPlatform "zcu102")
31
32    list(FIND plat_lists ${KernelARMPlatform} index)
33    if("${index}" STREQUAL "-1")
34        message(FATAL_ERROR "Which zynqmp platform not specified")
35    endif()
36    list(GET c_configs ${index} c_config)
37    list(GET cmake_configs ${index} cmake_config)
38    config_set(KernelARMPlatform ARM_PLAT ${KernelARMPlatform})
39    config_set(${cmake_config} ${c_config} ON)
40
41    set(KernelArmCortexA53 ON)
42    set(KernelArchArmV8a ON)
43
44    config_set(KernelArmMach MACH "zynq")
45
46    if(KernelPlatformZynqmpUltra96)
47        list(APPEND KernelDTSList "tools/dts/ultra96.dts")
48    elseif(KernelPlatformZynqmpZcu102)
49        list(APPEND KernelDTSList "tools/dts/zynqmp.dts")
50    else()
51        message(FATAL_ERROR "unknown platform")
52    endif()
53
54    if(KernelSel4ArchAarch32)
55        list(APPEND KernelDTSList "src/plat/zynqmp/overlay-zynqmp32.dts")
56    else()
57        list(APPEND KernelDTSList "src/plat/zynqmp/overlay-zynqmp.dts")
58    endif()
59
60    declare_default_headers(
61        TIMER_FREQUENCY 100000000
62        MAX_IRQ 187
63        NUM_PPI 32
64        TIMER drivers/timer/arm_generic.h
65        INTERRUPT_CONTROLLER arch/machine/gic_v2.h
66        CLK_MAGIC 1374389535llu
67        CLK_SHIFT 37u
68        KERNEL_WCET 10u
69    )
70endif()
71
72add_sources(
73    DEP "KernelPlatformZynqmp"
74    CFILES src/arch/arm/machine/gic_v2.c src/arch/arm/machine/l2c_nop.c
75)
76