1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
2# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without modification,
5# are permitted provided that the following conditions are met:
6#
7# 1. Redistributions of source code must retain the above copyright notice, this list of
8#    conditions and the following disclaimer.
9#
10# 2. Redistributions in binary form must reproduce the above copyright notice, this list
11#    of conditions and the following disclaimer in the documentation and/or other materials
12#    provided with the distribution.
13#
14# 3. Neither the name of the copyright holder nor the names of its contributors may be used
15#    to endorse or promote products derived from this software without specific prior written
16#    permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30import("//kernel/liteos_a/liteos.gni")
31
32module_name = LOSCFG_ARCH_CPU
33kernel_module(module_name) {
34  sources = [
35    "src/arm_generic_timer.c",
36    "src/clear_user.S",
37    "src/hw_user_get.S",
38    "src/hw_user_put.S",
39    "src/jmp.S",
40    "src/los_arch_mmu.c",
41    "src/los_asid.c",
42    "src/los_dispatch.S",
43    "src/los_exc.c",
44    "src/los_hw.c",
45    "src/los_hw_exc.S",
46    "src/los_hw_runstop.S",
47    "src/los_hw_tick.c",
48    "src/los_hwi.c",
49    "src/smp.c",
50    "src/strncpy_from_user.c",
51    "src/strnlen_user.c",
52    "src/user_copy.c",
53  ]
54
55  if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
56    sources += [ "src/armv7a/cache.S" ]
57  }
58
59  if (defined(LOSCFG_KERNEL_SMP)) {
60    sources += [ "src/startup/reset_vector_mp.S" ]
61  } else {
62    sources += [ "src/startup/reset_vector_up.S" ]
63  }
64
65  include_dirs = [ "src/include" ]
66
67  if (defined(LOSCFG_PERF_HW_PMU)) {
68    sources += [ "src/pmu/armv7_pmu.c" ]
69  }
70
71  if (defined(LOSCFG_GDB)) {
72    configs += [ ":as_objs_libc_flags" ]
73  }
74
75  public_configs = [ ":public" ]
76}
77
78config("public") {
79  include_dirs = [
80    "include",
81    "src/include",
82  ]
83}
84
85config("as_objs_libc_flags") {
86  defines = [ "__ASSEMBLY__" ]
87
88  # linux style macros
89  if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) ||
90      defined(LOSCFG_ARCH_ARM_V7M)) {
91    defines += [ "__LINUX_ARM_ARCH__=7" ]
92  } else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) ||
93             defined(LOSCFG_ARCH_ARM_V8M)) {
94    defines += [ "__LINUX_ARM_ARCH__=8" ]
95  }
96}
97