• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//build/lite/config/component/lite_component.gni")
31import("//build/lite/config/subsystem/lite_subsystem.gni")
32import("//kernel/liteos_m/liteos.gni")
33
34out_product_path = "${ohos_root_path}out/${board_name}/${product_name}"
35
36# build sdk into lib
37build_ext_component("build_sdk_into_lib") {
38  exec_path = rebase_path(".")
39
40  print("product_name:", product_name)
41  build_tz = "false"
42  build_mini = "false"
43
44  foreach(bsp_bin, bsp_bin_list) {
45    if (bsp_bin.bsp_bin_name == "best2600w_liteos_se") {
46      build_tz = bsp_bin.enable
47    }
48    if (bsp_bin.bsp_bin_name == "best2600w_liteos_mini") {
49      build_mini = bsp_bin.enable
50    }
51  }
52  print("product_path:", product_path)
53  command = "./tools/build_lib_into_hmos_out.sh ${build_tz} ${build_mini} ${ohos_build_type} ${product_path} ${flash_size}"
54}
55
56foreach(bin_file, bin_list) {
57  build_enable = bin_file.enable
58  exe_bin = "${bin_file.elf_name}_${board_name}"
59  if (build_enable == "true") {
60    bsp_target_name = bin_file.bsp_target_name
61
62    # copy lib generate by bsp target to out directory.
63    copy_lib_name = "gen_bsp_lib_${exe_bin}"
64    print("copy_lib_name:", copy_lib_name)
65    build_ext_component(copy_lib_name) {
66      exec_path = rebase_path(".")
67      out_lib_path = "${out_product_path}/libs/"
68      bsp_lib_path = "./bsp/out/${bsp_target_name}/libbsp${bsp_target_name}.a"
69      command = "cp -rf ${bsp_lib_path} ${out_lib_path}"
70      deps = [ ":build_sdk_into_lib" ]
71    }
72  }
73}
74
75module_name = "bsp_config"
76
77kernel_module(module_name) {
78  deps = []
79  foreach(bin_file, bin_list) {
80    build_enable = bin_file.enable
81    exe_bin = "${bin_file.elf_name}_${board_name}"
82    if (build_enable == "true") {
83      # copy lib generate by bsp target to out directory.
84      copy_lib_name = "gen_bsp_lib_${exe_bin}"
85      deps += [ ":${copy_lib_name}" ]
86    }
87  }
88}
89
90config("public") {
91  include_dirs = [
92    "bsp/rtos/liteos/liteos_m",
93    "bsp/rtos/liteos/liteos_m/kal/cmsis",
94    "bsp/platform/cmsis/inc",
95    "bsp/platform/hal",
96    "bsp/platform/drivers/ana",
97    "bsp/services/wifi_app/wifi_console",
98    "bsp/utils/crc32",
99    "bsp/utils/kfifo",
100    "bsp/net/wifi",
101    "bsp/platform/hal/best2003",
102  ]
103  ldflags = [ "-Wl,-T" + rebase_path("bsp/out/best2600w_liteos/_best2001.lds") ]
104  libs = [
105    "bspbest2600w_liteos",
106    "c",
107    "m",
108    "stdc++",
109  ]
110}
111