feature: 编译框架支持iccarm

close: #I5GL0C

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I94babac4d748b0c714835522a31f02b4f70de3e9
This commit is contained in:
arvinzzz 2022-07-11 22:27:24 +08:00
parent ad29f69777
commit d92c10d92d
7 changed files with 471 additions and 183 deletions

158
BUILD.gn
View File

@ -38,156 +38,73 @@ declare_args() {
import("liteos.gni") import("liteos.gni")
liteos_arch_cflags = [] if (defined(LOSCFG_COMPILER_ICCARM)) {
if (defined(LOSCFG_ARCH_ARM)) { import("config_iccarm.gni")
mcpu = LOSCFG_ARCH_CPU } else {
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) { import("config.gni")
mcpu += "+nofp"
}
liteos_arch_cflags += [ "-mcpu=$mcpu" ]
if (defined(LOSCFG_ARCH_ARM_AARCH32) && defined(LOSCFG_ARCH_FPU)) {
liteos_arch_cflags += [ "-mfpu=$LOSCFG_ARCH_FPU" ]
}
}
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags) cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_config_cflags)
if (ohos_build_compiler == "clang") { if (ohos_build_compiler == "clang") {
cc += " --target=$target_triple" cc += " --target=$target_triple"
}
} }
config("arch_config") { config("arch_config") {
cflags = liteos_arch_cflags cflags = arch_config_cflags
asmflags = cflags asmflags = arch_config_asmflags
ldflags = cflags ldflags = arch_config_ldflags
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-mthumb-interwork" ]
}
}
if (defined(LOSCFG_THUMB)) {
cflags += [ "-mthumb" ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-mimplicit-it=thumb" ]
} else {
cflags += [ "-Wa,-mimplicit-it=thumb" ]
}
}
} }
config("stdinc_config") { config("stdinc_config") {
cflags = stdinc_config_cflags
asmflags = stdinc_config_asmflags
if (!defined(LOSCFG_COMPILER_ICCARM)) {
std_include = exec_script("//build/lite/run_shell_cmd.py", std_include = exec_script("//build/lite/run_shell_cmd.py",
[ "$cc -print-file-name=include" ], [ "$cc -print-file-name=include" ],
"trim string") "trim string")
cflags = [ cflags += [
"-isystem", "-isystem",
std_include, std_include,
] ]
if (defined(LOSCFG_LIBC_MUSL)) {
cflags += [ "-nostdinc" ]
} }
asmflags = cflags
} }
config("ssp_config") { config("ssp_config") {
cflags = [] cflags = ssp_config_cflags
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) { asmflags = ssp_config_asmflags
cflags += [ "-fstack-protector-all" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) {
cflags += [ "-fstack-protector-strong" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR)) {
cflags += [
"-fstack-protector",
"--param",
"ssp-buffer-size=4",
]
} else {
cflags += [ "-fno-stack-protector" ]
}
asmflags = cflags
} }
config("optimize_config") { config("optimize_config") {
cflags = [] cflags = optimize_config_cflags
if (defined(LOSCFG_COMPILE_DEBUG)) { asmflags = optimize_config_asmflags
cflags += [
"-g",
"-gdwarf-2",
]
optimization_cflag = "-O0"
}
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
optimization_cflag = "-O2"
}
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
optimization_cflag = "-Oz"
} else {
optimization_cflag = "-Os"
}
}
if (defined(LOSCFG_COMPILE_LTO)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-flto=thin" ]
} else {
#cflags += [ "-flto" ]
}
}
cflags += [ optimization_cflag ]
asmflags = cflags
} }
config("kconfig_config") { config("kconfig_config") {
cflags = [ cflags = kconfig_config_cflags
"-imacros", asmflags = kconfig_config_asmflags
"$LITEOS_MENUCONFIG_H",
]
asmflags = cflags
cflags_cc = cflags
} }
config("warn_config") { config("warn_config") {
cflags = [ cflags = warn_config_cflags
"-Wall", asmflags = warn_config_asmflags
"-Werror",
"-Wpointer-arith",
"-Wstrict-prototypes",
"-Winvalid-pch",
"-Wno-address-of-packed-member",
]
asmflags = cflags
} }
config("dialect_config") { config("dialect_config") {
cflags_c = [ "-std=c99" ] cflags_c = dialect_config_cflags
cflags_cc = [ "-std=c++11" ] cflags_cc = dialect_config_ccflags
asmflags = dialect_config_asmflags
} }
config("misc_config") { config("misc_config") {
if (!defined(LOSCFG_COMPILER_ICCARM)) {
defines = [ "__LITEOS__" ] defines = [ "__LITEOS__" ]
defines += [ "__LITEOS_M__" ] defines += [ "__LITEOS_M__" ]
}
if (!defined(LOSCFG_DEBUG_VERSION)) { if (!defined(LOSCFG_DEBUG_VERSION)) {
defines += [ "NDEBUG" ] defines += [ "NDEBUG" ]
} }
cflags = misc_config_cflags
cflags = [ asmflags = misc_config_asmflags
"-fno-pic",
"-fno-builtin",
"-fms-extensions",
"-fno-strict-aliasing",
"-fno-common",
"-fsigned-char",
"-ffunction-sections",
"-fdata-sections",
"-fno-exceptions",
"-fno-omit-frame-pointer",
]
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-fno-aggressive-loop-optimizations" ]
}
asmflags = cflags
asmflags += [ "-DCLZ=CLZ" ]
} }
config("los_config") { config("los_config") {
@ -257,7 +174,11 @@ not_needed([ "HAVE_DEVICE_SDK" ])
static_library("libkernel") { static_library("libkernel") {
deps = [ ":modules" ] deps = [ ":modules" ]
if (defined(LOSCFG_COMPILER_ICCARM)) {
complete_static_lib = true
} else {
complete_static_lib = false complete_static_lib = false
}
} }
group("kernel") { group("kernel") {
@ -273,11 +194,15 @@ executable("liteos") {
":los_config", ":los_config",
] ]
if (defined(LOSCFG_COMPILER_ICCARM)) {
ldflags = [ "--map=$liteos_name.map" ]
} else {
ldflags = [ ldflags = [
"-static", "-static",
"-Wl,--gc-sections", "-Wl,--gc-sections",
"-Wl,-Map=$liteos_name.map", "-Wl,-Map=$liteos_name.map",
] ]
}
output_dir = target_out_dir output_dir = target_out_dir
@ -298,6 +223,14 @@ build_ext_component("build_kernel_image") {
deps = [ ":copy_liteos" ] deps = [ ":copy_liteos" ]
exec_path = rebase_path(root_out_dir) exec_path = rebase_path(root_out_dir)
if (defined(LOSCFG_COMPILER_ICCARM)) {
objcopy = "${compile_prefix}ielftool$toolchain_cmd_suffix"
objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
command = "$objcopy --bin --verbose $liteos_name $liteos_name.bin"
command +=
" && sh -c '$objdump --source --all $liteos_name -o $liteos_name.asm'"
} else {
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix" objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
@ -305,4 +238,5 @@ build_ext_component("build_kernel_image") {
command += command +=
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'" " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'" command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
}
} }

View File

@ -52,6 +52,9 @@ config LLVM_TARGET
depends on COMPILER_CLANG_LLVM depends on COMPILER_CLANG_LLVM
default "arm-liteos-ohos" if ARCH_ARM_AARCH32 default "arm-liteos-ohos" if ARCH_ARM_AARCH32
config COMPILER_ICCARM
bool "ICCARM"
endchoice endchoice
config COMPILE_DEBUG config COMPILE_DEBUG

View File

@ -1,5 +1,5 @@
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. # Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without modification, # Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: # are permitted provided that the following conditions are met:
@ -34,6 +34,10 @@ config("arm_config") {
} }
module_group("arm") { module_group("arm") {
if (defined(LOSCFG_COMPILER_ICCARM)) {
modules = [ "$board_cpu/iar" ]
} else {
modules = [ "$board_cpu/gcc" ] modules = [ "$board_cpu/gcc" ]
}
configs = [ ":arm_config" ] configs = [ ":arm_config" ]
} }

View File

@ -31,43 +31,61 @@ config ARCH_ARM_VER
# #
# VFP Hardware # VFP Hardware
# #
config ARCH_FPU_VFP_V3 choice
bool prompt "Choose FPU type"
depends on !ARCH_FPU_DISABLE
choice
prompt "Choose FPU version"
default ARCH_FPU_VFP_V4
depends on !ARCH_FPU_DISABLE
help
Choose FPU version.
config ARCH_FPU_VFP_V3
bool "VFP_V3"
help help
An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles. An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles.
VFPv3U is a variant of VFPv3 that supports the trapping of floating-point exceptions to support code. VFPv3U is a variant of VFPv3 that supports the trapping of floating-point exceptions to support code.
config ARCH_FPU_VFP_V4 config ARCH_FPU_VFP_V4
bool bool "VFP_V4"
help help
An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles. An optional extension to the Arm, Thumb, and ThumbEE instruction sets in the ARMv7-A and ARMv7-R profiles.
VFPv4U is a variant of VFPv4 that supports the trapping of floating-point exceptions to support code. VFPv4U is a variant of VFPv4 that supports the trapping of floating-point exceptions to support code.
VFPv4 and VFPv4U add both the Half-precision Extension and the fused multiply-add instructions to the features of VFPv3. VFPv4 and VFPv4U add both the Half-precision Extension and the fused multiply-add instructions to the features of VFPv3.
endchoice
config ARCH_FPU_VFP_D16 choice
bool prompt "Choose num of FPU doubleword registers"
default ARCH_FPU_VFP_D32
depends on !ARCH_FPU_DISABLE
help
Choose num of FPU doubleword registers.
config ARCH_FPU_VFP_D16
bool "FPU_VFP_D16"
depends on ARCH_ARM_AARCH32 depends on ARCH_ARM_AARCH32
help help
VPU implemented with 16 doubleword registers (16 x 64-bit). VPU implemented with 16 doubleword registers (16 x 64-bit).
config ARCH_FPU_VFP_D32 config ARCH_FPU_VFP_D32
bool bool "FPU_VFP_D32"
depends on ARCH_ARM_AARCH32 depends on ARCH_ARM_AARCH32
help help
VPU implemented with 32 doubleword registers (32 x 64-bit). VPU implemented with 32 doubleword registers (32 x 64-bit).
endchoice
config ARCH_FPU_VFP_NEON endchoice
bool
help
Advanced SIMD extension (NEON) support.
config ARCH_FPU config ARCH_FPU
string string
default "vfpv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32 default "vfpv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32 && !COMPILER_ICCARM
default "vfpv3-d16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16 default "vfpv3-d16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16 && !COMPILER_ICCARM
default "neon-vfpv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 && ARCH_FPU_VFP_NEON default "vfpv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 && !COMPILER_ICCARM
default "vfpv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 default "vfpv4-d16" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D16 && !COMPILER_ICCARM
default "vfpv4-d16" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D16 default "VFPv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32 && COMPILER_ICCARM
default "VFPv3_D16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16 && COMPILER_ICCARM
default "VFPv4" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D32 && COMPILER_ICCARM
default "VFPv4_D16" if ARCH_FPU_VFP_V4 && ARCH_FPU_VFP_D16 && COMPILER_ICCARM
# #
# Supported Processor Cores # Supported Processor Cores
@ -86,22 +104,16 @@ config ARCH_CORTEX_M7
bool bool
select ARCH_ARM_V7M select ARCH_ARM_V7M
select ARCH_ARM_AARCH32 select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
config ARCH_CORTEX_M33 config ARCH_CORTEX_M33
bool bool
select ARCH_ARM_V8M select ARCH_ARM_V8M
select ARCH_ARM_AARCH32 select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
config ARCH_CORTEX_M55 config ARCH_CORTEX_M55
bool bool
select ARCH_ARM_V8M select ARCH_ARM_V8M
select ARCH_ARM_AARCH32 select ARCH_ARM_AARCH32
select ARCH_FPU_VFP_V4
select ARCH_FPU_VFP_D32
config ARCH_ARM9 config ARCH_ARM9
bool bool
@ -110,9 +122,14 @@ config ARCH_ARM9
config ARCH_CPU config ARCH_CPU
string string
default "cortex-m3" if ARCH_CORTEX_M3 default "cortex-m3" if ARCH_CORTEX_M3 && !COMPILER_ICCARM
default "cortex-m4" if ARCH_CORTEX_M4 default "cortex-m4" if ARCH_CORTEX_M4 && !COMPILER_ICCARM
default "cortex-m7" if ARCH_CORTEX_M7 default "cortex-m7" if ARCH_CORTEX_M7 && !COMPILER_ICCARM
default "cortex-m33" if ARCH_CORTEX_M33 default "cortex-m33" if ARCH_CORTEX_M33 && !COMPILER_ICCARM
default "cortex-m55" if ARCH_CORTEX_M55 default "cortex-m55" if ARCH_CORTEX_M55 && !COMPILER_ICCARM
default "Cortex-M3" if ARCH_CORTEX_M3 && COMPILER_ICCARM
default "Cortex-M4" if ARCH_CORTEX_M4 && COMPILER_ICCARM
default "Cortex-M7" if ARCH_CORTEX_M7 && COMPILER_ICCARM
default "Cortex-M33" if ARCH_CORTEX_M33 && COMPILER_ICCARM
default "Cortex-M55" if ARCH_CORTEX_M55 && COMPILER_ICCARM
default "arm9" if ARCH_ARM9 default "arm9" if ARCH_ARM9

190
config.gni Normal file
View File

@ -0,0 +1,190 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
import("liteos.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
#
# arch_config
#
liteos_arch_config_cflags = []
if (defined(LOSCFG_ARCH_ARM)) {
mcpu = LOSCFG_ARCH_CPU
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
mcpu += "+nofp"
}
liteos_arch_config_cflags += [ "-mcpu=$mcpu" ]
if (defined(LOSCFG_ARCH_ARM_AARCH32) && defined(LOSCFG_ARCH_FPU)) {
liteos_arch_config_cflags += [ "-mfpu=$LOSCFG_ARCH_FPU" ]
}
}
arch_config_cflags = liteos_arch_config_cflags
arch_config_asmflags = []
arch_config_ldflags = liteos_arch_config_cflags
if (defined(LOSCFG_ARCH_ARM_AARCH32) && !defined(LOSCFG_COMPILER_CLANG_LLVM)) {
arch_config_cflags += [ "-mthumb-interwork" ]
}
if (defined(LOSCFG_THUMB)) {
arch_config_cflags += [ "-mthumb" ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
arch_config_cflags += [ "-mimplicit-it=thumb" ]
} else {
arch_config_cflags += [ "-Wa,-mimplicit-it=thumb" ]
}
}
arch_config_asmflags += arch_config_cflags
#
# stdinc_config
#
stdinc_config_cflags = []
stdinc_config_asmflags = []
if (defined(LOSCFG_LIBC_MUSL)) {
stdinc_config_cflags += [ "-nostdinc" ]
}
stdinc_config_asmflags += stdinc_config_cflags
#
# ssp_config
#
ssp_config_cflags = []
ssp_config_asmflags = []
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) {
ssp_config_cflags += [ "-fstack-protector-all" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) {
ssp_config_cflags += [ "-fstack-protector-strong" ]
} else if (defined(LOSCFG_CC_STACKPROTECTOR)) {
ssp_config_cflags += [
"-fstack-protector",
"--param",
"ssp-buffer-size=4",
]
} else {
ssp_config_cflags += [ "-fno-stack-protector" ]
}
ssp_config_asmflags += ssp_config_cflags
#
# optimize_config
#
optimize_config_cflags = []
optimize_config_asmflags = []
if (defined(LOSCFG_COMPILE_LTO)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
optimize_config_cflags += [ "-flto=thin" ]
} else {
#optimize_config_cflags += [ "-flto" ]
}
}
if (defined(LOSCFG_COMPILE_DEBUG)) {
optimize_config_cflags += [
"-g",
"-gdwarf-2",
]
optimize_config_cflags += [ "-O0" ]
}
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
optimize_config_cflags += [ "-O2" ]
}
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
optimize_config_cflags += [ "-Oz" ]
} else {
optimize_config_cflags += [ "-Os" ]
}
}
optimize_config_asmflags += optimize_config_cflags
#
# kconfig_config
#
kconfig_config_cflags = []
kconfig_config_asmflags = []
kconfig_config_cflags += [
"-imacros",
"$LITEOS_MENUCONFIG_H",
]
kconfig_config_asmflags += kconfig_config_cflags
#
# warn_config
#
warn_config_cflags = []
warn_config_asmflags = []
warn_config_cflags += [
"-Wall",
"-Werror",
"-Wpointer-arith",
"-Wstrict-prototypes",
"-Winvalid-pch",
"-Wno-address-of-packed-member",
]
warn_config_asmflags += warn_config_cflags
#
# dialect_config
#
dialect_config_cflags = []
dialect_config_ccflags = []
dialect_config_asmflags = []
dialect_config_cflags += [ "-std=c99" ]
dialect_config_ccflags += [ "-std=c++11" ]
#
# misc_config
#
misc_config_cflags = []
misc_config_asmflags = []
misc_config_cflags += [
"-fno-pic",
"-fno-builtin",
"-fms-extensions",
"-fno-strict-aliasing",
"-fno-common",
"-fsigned-char",
"-ffunction-sections",
"-fdata-sections",
"-fno-exceptions",
"-fno-omit-frame-pointer",
]
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
misc_config_cflags += [ "-fno-aggressive-loop-optimizations" ]
}
misc_config_asmflags += misc_config_cflags
misc_config_asmflags += [ "-DCLZ=CLZ" ]

140
config_iccarm.gni Normal file
View File

@ -0,0 +1,140 @@
# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
import("liteos.gni")
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
#
# arch_config
#
liteos_arch_config_cflags = []
if (defined(LOSCFG_ARCH_ARM)) {
mcpu = LOSCFG_ARCH_CPU
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
mcpu += "+nofp"
}
liteos_arch_config_cflags += [ "--cpu=$mcpu" ]
if (defined(LOSCFG_ARCH_ARM_AARCH32) && defined(LOSCFG_ARCH_FPU)) {
liteos_arch_config_cflags += [ "--fpu=$LOSCFG_ARCH_FPU" ]
}
}
arch_config_cflags = liteos_arch_config_cflags
arch_config_asmflags = []
arch_config_ldflags = liteos_arch_config_cflags
if (defined(LOSCFG_THUMB)) {
arch_config_cflags += [ "--thumb" ]
}
arch_config_asmflags += arch_config_cflags
#
# stdinc_config
#
stdinc_config_cflags = []
stdinc_config_asmflags = []
if (defined(LOSCFG_LIBC_MUSL)) {
stdinc_config_cflags += [ "-nostdinc" ]
}
stdinc_config_asmflags += stdinc_config_cflags
#
# ssp_config
#
ssp_config_cflags = []
ssp_config_asmflags = []
if (!defined(LOSCFG_CC_NO_STACKPROTECTOR)) {
ssp_config_cflags += [ "--stack_protection" ]
}
#
# optimize_config
#
optimize_config_cflags = []
optimize_config_asmflags = []
if (defined(LOSCFG_COMPILE_DEBUG)) {
optimize_config_cflags += [
"-g",
"-gdwarf-2",
]
optimize_config_cflags += [ "-On" ]
} else {
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
optimize_config_cflags += [ "-Ohs" ]
} else {
optimize_config_cflags += [ "-Om" ]
}
}
}
#
# kconfig_config
#
kconfig_config_cflags = []
kconfig_config_asmflags = []
kconfig_config_cflags += [
"--preinclude",
"$LITEOS_MENUCONFIG_H",
]
#
# warn_config
#
warn_config_cflags = []
warn_config_asmflags = []
warn_config_cflags += [
"--warnings_affect_exit_code",
"--warnings_are_errors",
"--warn_about_c_style_casts",
"--warn_about_incomplete_constructors",
]
#
# dialect_config
#
dialect_config_cflags = []
dialect_config_ccflags = []
dialect_config_asmflags = []
dialect_config_ccflags += [ "-std=c++11" ]
#
# misc_config
#
misc_config_cflags = []
misc_config_asmflags = []
misc_config_asmflags += [ "-DCLZ=CLZ" ]

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. * Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met: