feature: 编译框架支持iccarm
close: #I5GL0C Signed-off-by: arvinzzz <zhaotianyu9@huawei.com> Change-Id: I94babac4d748b0c714835522a31f02b4f70de3e9
This commit is contained in:
parent
ad29f69777
commit
d92c10d92d
200
BUILD.gn
200
BUILD.gn
|
@ -38,156 +38,73 @@ declare_args() {
|
|||
|
||||
import("liteos.gni")
|
||||
|
||||
liteos_arch_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_cflags += [ "-mcpu=$mcpu" ]
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32) && defined(LOSCFG_ARCH_FPU)) {
|
||||
liteos_arch_cflags += [ "-mfpu=$LOSCFG_ARCH_FPU" ]
|
||||
}
|
||||
}
|
||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
import("config_iccarm.gni")
|
||||
} else {
|
||||
import("config.gni")
|
||||
|
||||
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
cc += " --target=$target_triple"
|
||||
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_config_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
cc += " --target=$target_triple"
|
||||
}
|
||||
}
|
||||
|
||||
config("arch_config") {
|
||||
cflags = liteos_arch_cflags
|
||||
asmflags = cflags
|
||||
ldflags = cflags
|
||||
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" ]
|
||||
}
|
||||
}
|
||||
cflags = arch_config_cflags
|
||||
asmflags = arch_config_asmflags
|
||||
ldflags = arch_config_ldflags
|
||||
}
|
||||
|
||||
config("stdinc_config") {
|
||||
std_include = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-file-name=include" ],
|
||||
"trim string")
|
||||
cflags = [
|
||||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
if (defined(LOSCFG_LIBC_MUSL)) {
|
||||
cflags += [ "-nostdinc" ]
|
||||
cflags = stdinc_config_cflags
|
||||
asmflags = stdinc_config_asmflags
|
||||
if (!defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
std_include = exec_script("//build/lite/run_shell_cmd.py",
|
||||
[ "$cc -print-file-name=include" ],
|
||||
"trim string")
|
||||
cflags += [
|
||||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("ssp_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) {
|
||||
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
|
||||
cflags = ssp_config_cflags
|
||||
asmflags = ssp_config_asmflags
|
||||
}
|
||||
|
||||
config("optimize_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_COMPILE_DEBUG)) {
|
||||
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
|
||||
cflags = optimize_config_cflags
|
||||
asmflags = optimize_config_asmflags
|
||||
}
|
||||
|
||||
config("kconfig_config") {
|
||||
cflags = [
|
||||
"-imacros",
|
||||
"$LITEOS_MENUCONFIG_H",
|
||||
]
|
||||
asmflags = cflags
|
||||
cflags_cc = cflags
|
||||
cflags = kconfig_config_cflags
|
||||
asmflags = kconfig_config_asmflags
|
||||
}
|
||||
|
||||
config("warn_config") {
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Winvalid-pch",
|
||||
"-Wno-address-of-packed-member",
|
||||
]
|
||||
asmflags = cflags
|
||||
cflags = warn_config_cflags
|
||||
asmflags = warn_config_asmflags
|
||||
}
|
||||
|
||||
config("dialect_config") {
|
||||
cflags_c = [ "-std=c99" ]
|
||||
cflags_cc = [ "-std=c++11" ]
|
||||
cflags_c = dialect_config_cflags
|
||||
cflags_cc = dialect_config_ccflags
|
||||
asmflags = dialect_config_asmflags
|
||||
}
|
||||
|
||||
config("misc_config") {
|
||||
defines = [ "__LITEOS__" ]
|
||||
defines += [ "__LITEOS_M__" ]
|
||||
if (!defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
defines = [ "__LITEOS__" ]
|
||||
defines += [ "__LITEOS_M__" ]
|
||||
}
|
||||
if (!defined(LOSCFG_DEBUG_VERSION)) {
|
||||
defines += [ "NDEBUG" ]
|
||||
}
|
||||
|
||||
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)) {
|
||||
cflags += [ "-fno-aggressive-loop-optimizations" ]
|
||||
}
|
||||
|
||||
asmflags = cflags
|
||||
asmflags += [ "-DCLZ=CLZ" ]
|
||||
cflags = misc_config_cflags
|
||||
asmflags = misc_config_asmflags
|
||||
}
|
||||
|
||||
config("los_config") {
|
||||
|
@ -257,7 +174,11 @@ not_needed([ "HAVE_DEVICE_SDK" ])
|
|||
|
||||
static_library("libkernel") {
|
||||
deps = [ ":modules" ]
|
||||
complete_static_lib = false
|
||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
complete_static_lib = true
|
||||
} else {
|
||||
complete_static_lib = false
|
||||
}
|
||||
}
|
||||
|
||||
group("kernel") {
|
||||
|
@ -273,11 +194,15 @@ executable("liteos") {
|
|||
":los_config",
|
||||
]
|
||||
|
||||
ldflags = [
|
||||
"-static",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-Map=$liteos_name.map",
|
||||
]
|
||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
ldflags = [ "--map=$liteos_name.map" ]
|
||||
} else {
|
||||
ldflags = [
|
||||
"-static",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-Map=$liteos_name.map",
|
||||
]
|
||||
}
|
||||
|
||||
output_dir = target_out_dir
|
||||
|
||||
|
@ -298,11 +223,20 @@ build_ext_component("build_kernel_image") {
|
|||
deps = [ ":copy_liteos" ]
|
||||
exec_path = rebase_path(root_out_dir)
|
||||
|
||||
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
|
||||
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
objcopy = "${compile_prefix}ielftool$toolchain_cmd_suffix"
|
||||
objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
|
||||
|
||||
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
|
||||
command +=
|
||||
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
|
||||
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"
|
||||
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
||||
|
||||
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
|
||||
command +=
|
||||
" && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
|
||||
}
|
||||
}
|
||||
|
|
3
Kconfig
3
Kconfig
|
@ -52,6 +52,9 @@ config LLVM_TARGET
|
|||
depends on COMPILER_CLANG_LLVM
|
||||
default "arm-liteos-ohos" if ARCH_ARM_AARCH32
|
||||
|
||||
config COMPILER_ICCARM
|
||||
bool "ICCARM"
|
||||
|
||||
endchoice
|
||||
|
||||
config COMPILE_DEBUG
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 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,
|
||||
# are permitted provided that the following conditions are met:
|
||||
|
@ -34,6 +34,10 @@ config("arm_config") {
|
|||
}
|
||||
|
||||
module_group("arm") {
|
||||
modules = [ "$board_cpu/gcc" ]
|
||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
modules = [ "$board_cpu/iar" ]
|
||||
} else {
|
||||
modules = [ "$board_cpu/gcc" ]
|
||||
}
|
||||
configs = [ ":arm_config" ]
|
||||
}
|
||||
|
|
|
@ -31,43 +31,61 @@ config ARCH_ARM_VER
|
|||
#
|
||||
# VFP Hardware
|
||||
#
|
||||
config ARCH_FPU_VFP_V3
|
||||
bool
|
||||
help
|
||||
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.
|
||||
choice
|
||||
prompt "Choose FPU type"
|
||||
depends on !ARCH_FPU_DISABLE
|
||||
|
||||
config ARCH_FPU_VFP_V4
|
||||
bool
|
||||
help
|
||||
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.
|
||||
VFPv4 and VFPv4U add both the Half-precision Extension and the fused multiply-add instructions to the features of VFPv3.
|
||||
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
|
||||
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.
|
||||
|
||||
config ARCH_FPU_VFP_D16
|
||||
bool
|
||||
depends on ARCH_ARM_AARCH32
|
||||
help
|
||||
VPU implemented with 16 doubleword registers (16 x 64-bit).
|
||||
config ARCH_FPU_VFP_V4
|
||||
bool "VFP_V4"
|
||||
help
|
||||
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.
|
||||
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_D32
|
||||
bool
|
||||
depends on ARCH_ARM_AARCH32
|
||||
help
|
||||
VPU implemented with 32 doubleword registers (32 x 64-bit).
|
||||
choice
|
||||
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_NEON
|
||||
bool
|
||||
help
|
||||
Advanced SIMD extension (NEON) support.
|
||||
config ARCH_FPU_VFP_D16
|
||||
bool "FPU_VFP_D16"
|
||||
depends on ARCH_ARM_AARCH32
|
||||
help
|
||||
VPU implemented with 16 doubleword registers (16 x 64-bit).
|
||||
|
||||
config ARCH_FPU_VFP_D32
|
||||
bool "FPU_VFP_D32"
|
||||
depends on ARCH_ARM_AARCH32
|
||||
help
|
||||
VPU implemented with 32 doubleword registers (32 x 64-bit).
|
||||
endchoice
|
||||
endchoice
|
||||
config ARCH_FPU
|
||||
string
|
||||
default "vfpv3" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D32
|
||||
default "vfpv3-d16" if ARCH_FPU_VFP_V3 && ARCH_FPU_VFP_D16
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -86,22 +104,16 @@ config ARCH_CORTEX_M7
|
|||
bool
|
||||
select ARCH_ARM_V7M
|
||||
select ARCH_ARM_AARCH32
|
||||
select ARCH_FPU_VFP_V4
|
||||
select ARCH_FPU_VFP_D32
|
||||
|
||||
config ARCH_CORTEX_M33
|
||||
bool
|
||||
select ARCH_ARM_V8M
|
||||
select ARCH_ARM_AARCH32
|
||||
select ARCH_FPU_VFP_V4
|
||||
select ARCH_FPU_VFP_D32
|
||||
|
||||
config ARCH_CORTEX_M55
|
||||
bool
|
||||
select ARCH_ARM_V8M
|
||||
select ARCH_ARM_AARCH32
|
||||
select ARCH_FPU_VFP_V4
|
||||
select ARCH_FPU_VFP_D32
|
||||
|
||||
config ARCH_ARM9
|
||||
bool
|
||||
|
@ -110,9 +122,14 @@ config ARCH_ARM9
|
|||
|
||||
config ARCH_CPU
|
||||
string
|
||||
default "cortex-m3" if ARCH_CORTEX_M3
|
||||
default "cortex-m4" if ARCH_CORTEX_M4
|
||||
default "cortex-m7" if ARCH_CORTEX_M7
|
||||
default "cortex-m33" if ARCH_CORTEX_M33
|
||||
default "cortex-m55" if ARCH_CORTEX_M55
|
||||
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 "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
|
||||
|
|
|
@ -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" ]
|
|
@ -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" ]
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -129,10 +129,10 @@ extern UINT32 LOS_MemPoolList(VOID);
|
|||
* <ul>
|
||||
* <li>This API is used to free all memory nodes allocated by the specified task.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @param pool [IN] The memory pool address.
|
||||
* @param taskID [IN] The task ID and all memory nodes allocated by this task will be freed.
|
||||
*
|
||||
*
|
||||
* @retval #OS_ERROR The memory pool is NULL or the task ID is invalid.
|
||||
* @retval #LOS_OK All memory nodes allocated by this task are freed successfully.
|
||||
* @par Dependency:
|
||||
|
@ -157,10 +157,10 @@ typedef struct {
|
|||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize multiple non-continuous memory regions. If the starting address of a pool is specified,
|
||||
* the memory regions will be linked to the pool as free nodes. Otherwise, the first memory region will be initialized as a
|
||||
* the memory regions will be linked to the pool as free nodes. Otherwise, the first memory region will be initialized as a
|
||||
* new pool, and the rest regions will be linked as free nodes to the new pool.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>If the starting address of a memory pool is specified, the start address of the non-continuous memory regions should be
|
||||
|
@ -168,12 +168,12 @@ typedef struct {
|
|||
* <li>The multiple non-continuous memory regions shouldn't conflict with each other.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param pool [IN] The memory pool address. If NULL is specified, the start address of first memory region will be
|
||||
* @param pool [IN] The memory pool address. If NULL is specified, the start address of first memory region will be
|
||||
* initialized as the memory pool address. If not NULL, it should be a valid address of a memory pool.
|
||||
* @param memRegions [IN] The LosMemRegion array that contains multiple non-continuous memory regions. The start address
|
||||
* of the memory regions are placed in ascending order.
|
||||
* @param memRegionCount [IN] The count of non-continuous memory regions, and it should be the length of the LosMemRegion array.
|
||||
*
|
||||
*
|
||||
* @retval #LOS_NOK The multiple non-continuous memory regions fails to be initialized.
|
||||
* @retval #LOS_OK The multiple non-continuous memory regions is initialized successfully.
|
||||
* @par Dependency:
|
||||
|
|
Loading…
Reference in New Issue