1d6aed566Sopenharmony_ci# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
2d6aed566Sopenharmony_ci# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
3d6aed566Sopenharmony_ci#
4d6aed566Sopenharmony_ci# Redistribution and use in source and binary forms, with or without modification,
5d6aed566Sopenharmony_ci# are permitted provided that the following conditions are met:
6d6aed566Sopenharmony_ci#
7d6aed566Sopenharmony_ci# 1. Redistributions of source code must retain the above copyright notice, this list of
8d6aed566Sopenharmony_ci#    conditions and the following disclaimer.
9d6aed566Sopenharmony_ci#
10d6aed566Sopenharmony_ci# 2. Redistributions in binary form must reproduce the above copyright notice, this list
11d6aed566Sopenharmony_ci#    of conditions and the following disclaimer in the documentation and/or other materials
12d6aed566Sopenharmony_ci#    provided with the distribution.
13d6aed566Sopenharmony_ci#
14d6aed566Sopenharmony_ci# 3. Neither the name of the copyright holder nor the names of its contributors may be used
15d6aed566Sopenharmony_ci#    to endorse or promote products derived from this software without specific prior written
16d6aed566Sopenharmony_ci#    permission.
17d6aed566Sopenharmony_ci#
18d6aed566Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19d6aed566Sopenharmony_ci# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20d6aed566Sopenharmony_ci# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21d6aed566Sopenharmony_ci# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22d6aed566Sopenharmony_ci# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23d6aed566Sopenharmony_ci# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24d6aed566Sopenharmony_ci# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25d6aed566Sopenharmony_ci# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26d6aed566Sopenharmony_ci# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27d6aed566Sopenharmony_ci# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28d6aed566Sopenharmony_ci# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29d6aed566Sopenharmony_ci
30d6aed566Sopenharmony_ciimport("//drivers/hdf_core/adapter/khdf/liteos_m/hdf.gni")
31d6aed566Sopenharmony_ciimport("//kernel/liteos_m/liteos.gni")
32d6aed566Sopenharmony_ci
33d6aed566Sopenharmony_cihdf_driver("bsp_config") {
34d6aed566Sopenharmony_ci  asmflags = board_asmflags
35d6aed566Sopenharmony_ci  sources = [
36d6aed566Sopenharmony_ci    "driver/cfiflash/cfiflash.c",
37d6aed566Sopenharmony_ci    "driver/cfiflash/cfiflash_fs_hal.c",
38d6aed566Sopenharmony_ci    "driver/cfiflash/hdf_cfi.c",
39d6aed566Sopenharmony_ci    "driver/plic.c",
40d6aed566Sopenharmony_ci    "driver/uart.c",
41d6aed566Sopenharmony_ci    "driver/video/fb.c",
42d6aed566Sopenharmony_ci    "driver/video/fb_init.c",
43d6aed566Sopenharmony_ci    "driver/video/fb_mem.c",
44d6aed566Sopenharmony_ci    "driver/video/key_cache.c",
45d6aed566Sopenharmony_ci    "driver/virtgpu.c",
46d6aed566Sopenharmony_ci    "driver/virtinput.c",
47d6aed566Sopenharmony_ci    "driver/virtmmio.c",
48d6aed566Sopenharmony_ci    "driver/virtnet.c",
49d6aed566Sopenharmony_ci    "fs/ff_gen_drv.c",
50d6aed566Sopenharmony_ci    "los_start.S",
51d6aed566Sopenharmony_ci    "main.c",
52d6aed566Sopenharmony_ci    "riscv_hal.c",
53d6aed566Sopenharmony_ci  ]
54d6aed566Sopenharmony_ci  if (!defined(LOSCFG_TEST)) {
55d6aed566Sopenharmony_ci    # kernel's testsuites not enabled, use ower's
56d6aed566Sopenharmony_ci    sources += [ "test/test_demo.c" ]
57d6aed566Sopenharmony_ci  }
58d6aed566Sopenharmony_ci  include_dirs = [
59d6aed566Sopenharmony_ci    "driver/cfiflash",
60d6aed566Sopenharmony_ci    "driver/video",
61d6aed566Sopenharmony_ci    "hardware",
62d6aed566Sopenharmony_ci    "hardware/adapter",
63d6aed566Sopenharmony_ci    "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev",
64d6aed566Sopenharmony_ci    "$HDF_FRAMEWORKS_PATH/include/utils",
65d6aed566Sopenharmony_ci    "$HDF_FRAMEWORKS_PATH/model/input/driver",
66d6aed566Sopenharmony_ci    "$HDF_PERIPHERAL_PATH/base",
67d6aed566Sopenharmony_ci    "$HDF_PERIPHERAL_PATH/display/interfaces/include",
68d6aed566Sopenharmony_ci    "$HDF_PERIPHERAL_PATH/input/interfaces/include",
69d6aed566Sopenharmony_ci    "//drivers/hdf_core/adapter/khdf/liteos_m/osal/include",
70d6aed566Sopenharmony_ci    "//drivers/hdf_core/interfaces/inner_api/osal/shared",
71d6aed566Sopenharmony_ci    "//third_party/bounds_checking_function/include",
72d6aed566Sopenharmony_ci  ]
73d6aed566Sopenharmony_ci
74d6aed566Sopenharmony_ci  deps = [
75d6aed566Sopenharmony_ci    "hardware",
76d6aed566Sopenharmony_ci    "libc",
77d6aed566Sopenharmony_ci    "ui",
78d6aed566Sopenharmony_ci  ]
79d6aed566Sopenharmony_ci}
80d6aed566Sopenharmony_ci
81d6aed566Sopenharmony_ciconfig("public") {
82d6aed566Sopenharmony_ci  include_dirs = [
83d6aed566Sopenharmony_ci    ".",
84d6aed566Sopenharmony_ci    "include",
85d6aed566Sopenharmony_ci    "include/asm",
86d6aed566Sopenharmony_ci    "driver",
87d6aed566Sopenharmony_ci    "fs",
88d6aed566Sopenharmony_ci    "ui",
89d6aed566Sopenharmony_ci  ]
90d6aed566Sopenharmony_ci
91d6aed566Sopenharmony_ci  ldflags = [
92d6aed566Sopenharmony_ci    "-Wl,-mcmodel=medany",
93d6aed566Sopenharmony_ci    "-Wl,-melf32lriscv",
94d6aed566Sopenharmony_ci    "-nostartfiles",
95d6aed566Sopenharmony_ci    "-Wl,-T" + rebase_path("liteos.ld"),
96d6aed566Sopenharmony_ci    "-nostdlib",
97d6aed566Sopenharmony_ci  ]
98d6aed566Sopenharmony_ci
99d6aed566Sopenharmony_ci  # config force_link_libs from vendor/ohemu/qemu_riscv32_mini_system_demo/config.json
100d6aed566Sopenharmony_ci  ldflags += [ "-L./libs" ]
101d6aed566Sopenharmony_ci  ldflags += [ "-Wl,--whole-archive" ]
102d6aed566Sopenharmony_ci  foreach(force_link_lib, force_link_libs) {
103d6aed566Sopenharmony_ci    ldflags += [ "-l${force_link_lib}" ]
104d6aed566Sopenharmony_ci  }
105d6aed566Sopenharmony_ci  ldflags += [ "-Wl,--no-whole-archive" ]
106d6aed566Sopenharmony_ci
107d6aed566Sopenharmony_ci  libs = [
108d6aed566Sopenharmony_ci    "nosys",
109d6aed566Sopenharmony_ci    "gcc",
110d6aed566Sopenharmony_ci    "stdc++",
111d6aed566Sopenharmony_ci    "ui",
112d6aed566Sopenharmony_ci  ]
113d6aed566Sopenharmony_ci
114d6aed566Sopenharmony_ci  if (defined(LOSCFG_LIBC_NEWLIB)) {
115d6aed566Sopenharmony_ci    ldflags -= [ "-nostdlib" ]
116d6aed566Sopenharmony_ci
117d6aed566Sopenharmony_ci    libs -= [ "nosys" ]
118d6aed566Sopenharmony_ci    libs += [
119d6aed566Sopenharmony_ci      "c",
120d6aed566Sopenharmony_ci      "m",
121d6aed566Sopenharmony_ci    ]
122d6aed566Sopenharmony_ci
123d6aed566Sopenharmony_ci    cflags_c = [
124d6aed566Sopenharmony_ci      "-U__INT32_TYPE__",
125d6aed566Sopenharmony_ci      "-D__INT32_TYPE__=int",
126d6aed566Sopenharmony_ci      "-DLWIP_NO_CTYPE_H=1",
127d6aed566Sopenharmony_ci    ]
128d6aed566Sopenharmony_ci  }
129d6aed566Sopenharmony_ci}
130