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
9# We introduce a variable to hold this long expression to prevent the
10# code styler from line-wrapping the declare_platform() statement.  We
11# want to keep that on one line so the `griddle` tool (or humans) can
12# easily `grep` a list of supported platforms.  As of 2019-08-07, this
13# platform is the only one requiring this workaround.
14set(AArch32OrArchArmHyp "KernelSel4ArchAarch32 OR KernelSel4ArchArmHyp")
15declare_platform(exynos5 KernelPlatExynos5 PLAT_EXYNOS5 ${AArch32OrArchArmHyp})
16unset(${AArch32OrArchArmHyp} CACHE)
17
18set(cmake_configs KernelPlatformExynos5250 KernelPlatformExynos5410 KernelPlatformExynos5422)
19set(c_configs PLAT_EXYNOS5250 PLAT_EXYNOS5410 PLAT_EXYNOS5422)
20set(plat_lists exynos5250 exynos5410 exynos5422)
21foreach(config IN LISTS cmake_configs)
22    unset(${config} CACHE)
23endforeach()
24unset(KernelPlatExynos54xx CACHE)
25if(KernelPlatExynos5)
26    if("${KernelSel4Arch}" STREQUAL aarch32)
27        declare_seL4_arch(aarch32)
28    elseif("${KernelSel4Arch}" STREQUAL arm_hyp)
29        declare_seL4_arch(arm_hyp)
30    else()
31        fallback_declare_seL4_arch_default(aarch32)
32    endif()
33    set(KernelArmCortexA15 ON)
34    set(KernelArchArmV7ve ON)
35    # v7ve is a superset of v7a, so we enable that as well
36    set(KernelArchArmV7a ON)
37    config_set(KernelArmMach MACH "exynos")
38    check_platform_and_fallback_to_default(KernelARMPlatform "exynos5250")
39
40    list(FIND plat_lists "${KernelARMPlatform}" index)
41    if("${index}" STREQUAL "-1")
42        message(FATAL_ERROR "Invalid exynos5 platform selected: \"${KernelARMPlatform}\"")
43    endif()
44    list(GET c_configs ${index} c_config)
45    list(GET cmake_configs ${index} cmake_config)
46    config_set(KernelARMPlatform ARM_PLAT ${KernelARMPlatform})
47    config_set(${cmake_config} ${c_config} ON)
48    if(KernelPlatformExynos5410 OR KernelPlatformExynos5422)
49        config_set(KernelPlatExynos54xx PLAT_EXYNOS54XX ON)
50    else()
51        config_set(KernelPlatExynos54xx PLAT_EXYNOS54XX OFF)
52    endif()
53
54    if(NOT KernelPlatformExynos5422)
55        set(KernelHardwareDebugAPIUnsupported ON CACHE INTERNAL "")
56    endif()
57
58    list(APPEND KernelDTSList "tools/dts/${KernelARMPlatform}.dts")
59    list(APPEND KernelDTSList "src/plat/exynos5/overlay-${KernelARMPlatform}.dts")
60    declare_default_headers(
61        TIMER_FREQUENCY 24000000
62        MAX_IRQ 254
63        NUM_PPI 32
64        TIMER drivers/timer/arm_generic.h
65        INTERRUPT_CONTROLLER arch/machine/gic_v2.h
66        CLK_MAGIC 2863311531llu
67        CLK_SHIFT 36u
68        KERNEL_WCET 10u
69    )
70endif()
71
72add_sources(
73    DEP "KernelPlatExynos5"
74    CFILES src/arch/arm/machine/gic_v2.c src/arch/arm/machine/l2c_nop.c
75)
76