• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without modification,
4# are permitted provided that the following conditions are met:
5#
6# 1. Redistributions of source code must retain the above copyright notice, this list of
7#    conditions and the following disclaimer.
8#
9# 2. Redistributions in binary form must reproduce the above copyright notice, this list
10#    of conditions and the following disclaimer in the documentation and/or other materials
11#    provided with the distribution.
12#
13# 3. Neither the name of the copyright holder nor the names of its contributors may be used
14#    to endorse or promote products derived from this software without specific prior written
15#    permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29import("//build/lite/config/component/lite_component.gni")
30import("liteos.gni")
31
32LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
33
34liteos_name = "OHOS_Image"
35liteos_kernel_only = false
36
37#
38# arch_config
39#
40liteos_arch_config_cflags = []
41if (defined(LOSCFG_ARCH_ARM)) {
42  mcpu = LOSCFG_ARCH_CPU
43  if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
44    mcpu += "+nofp"
45  }
46  liteos_arch_config_cflags += [ "--cpu=$mcpu" ]
47  if (defined(LOSCFG_ARCH_ARM_AARCH32) && defined(LOSCFG_ARCH_FPU)) {
48    liteos_arch_config_cflags += [ "--fpu=$LOSCFG_ARCH_FPU" ]
49  }
50}
51
52arch_config_cflags = liteos_arch_config_cflags
53arch_config_asmflags = []
54arch_config_ldflags = liteos_arch_config_cflags
55
56if (defined(LOSCFG_THUMB)) {
57  arch_config_cflags += [ "--thumb" ]
58}
59arch_config_asmflags += arch_config_cflags
60
61#
62# stdinc_config
63#
64stdinc_config_cflags = []
65stdinc_config_asmflags = []
66
67if (defined(LOSCFG_LIBC_MUSL)) {
68  stdinc_config_cflags += [ "-nostdinc" ]
69}
70stdinc_config_asmflags += stdinc_config_cflags
71
72#
73# ssp_config
74#
75ssp_config_cflags = []
76ssp_config_asmflags = []
77
78if (!defined(LOSCFG_CC_NO_STACKPROTECTOR)) {
79  ssp_config_cflags += [ "--stack_protection" ]
80}
81
82#
83# optimize_config
84#
85optimize_config_cflags = []
86optimize_config_asmflags = []
87
88if (defined(LOSCFG_COMPILE_DEBUG)) {
89  optimize_config_cflags += [ "-On" ]
90} else {
91  if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
92    if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
93      optimize_config_cflags += [ "-Ohs" ]
94    } else {
95      optimize_config_cflags += [ "-Om" ]
96    }
97  }
98}
99
100#
101# kconfig_config
102#
103kconfig_config_cflags = []
104kconfig_config_asmflags = []
105
106kconfig_config_cflags += [
107  "--preinclude",
108  "$LITEOS_MENUCONFIG_H",
109]
110
111#
112# warn_config
113#
114warn_config_cflags = []
115warn_config_asmflags = []
116
117if (!defined(LOSCFG_TEST)) {
118  warn_config_cflags += [
119    "--warnings_affect_exit_code",
120    "--warnings_are_errors",
121    "--warn_about_c_style_casts",
122    "--warn_about_incomplete_constructors",
123  ]
124}
125
126#
127# dialect_config
128#
129dialect_config_cflags = []
130dialect_config_ccflags = []
131dialect_config_asmflags = []
132
133dialect_config_ccflags += [ "-std=c++11" ]
134
135#
136# misc_config
137#
138misc_config_cflags = []
139misc_config_asmflags = []
140
141misc_config_asmflags += [ "-DCLZ=CLZ" ]
142
143# ldflags for generating executable bin files
144executable_config_ldflags = [ "--map=$liteos_name.map" ]
145
146# Commands to generate kernel_image
147toochain_config_objcopy = "${compile_prefix}ielftool$toolchain_cmd_suffix"
148toochain_config_objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
149
150toochain_config_command =
151    "$toochain_config_objcopy --bin --verbose $liteos_name $liteos_name.bin"
152
153toochain_asm_command = " && sh -c '$toochain_config_objdump --source --all $liteos_name -o $liteos_name.asm'"
154