refactor: 编译框架对不同工具链的解耦优化
close: #I5GQ9A Signed-off-by: arvinzzz <zhaotianyu9@huawei.com> Change-Id: I3e371a67bdab75c53e769e08c1c54ec83c741a69
This commit is contained in:
parent
d92c10d92d
commit
009d2503fb
32
BUILD.gn
32
BUILD.gn
|
@ -31,11 +31,6 @@ import("//build/lite/config/component/lite_component.gni")
|
||||||
|
|
||||||
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
||||||
|
|
||||||
declare_args() {
|
|
||||||
liteos_name = "OHOS_Image"
|
|
||||||
liteos_kernel_only = false
|
|
||||||
}
|
|
||||||
|
|
||||||
import("liteos.gni")
|
import("liteos.gni")
|
||||||
|
|
||||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
||||||
|
@ -194,15 +189,7 @@ executable("liteos") {
|
||||||
":los_config",
|
":los_config",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (defined(LOSCFG_COMPILER_ICCARM)) {
|
ldflags = executable_config_ldflags
|
||||||
ldflags = [ "--map=$liteos_name.map" ]
|
|
||||||
} else {
|
|
||||||
ldflags = [
|
|
||||||
"-static",
|
|
||||||
"-Wl,--gc-sections",
|
|
||||||
"-Wl,-Map=$liteos_name.map",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
output_dir = target_out_dir
|
output_dir = target_out_dir
|
||||||
|
|
||||||
|
@ -223,20 +210,5 @@ 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)) {
|
command = toochain_config_command
|
||||||
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"
|
|
||||||
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'"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
20
config.gni
20
config.gni
|
@ -31,6 +31,9 @@ import("liteos.gni")
|
||||||
|
|
||||||
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
||||||
|
|
||||||
|
liteos_name = "OHOS_Image"
|
||||||
|
liteos_kernel_only = false
|
||||||
|
|
||||||
#
|
#
|
||||||
# arch_config
|
# arch_config
|
||||||
#
|
#
|
||||||
|
@ -188,3 +191,20 @@ if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||||
}
|
}
|
||||||
misc_config_asmflags += misc_config_cflags
|
misc_config_asmflags += misc_config_cflags
|
||||||
misc_config_asmflags += [ "-DCLZ=CLZ" ]
|
misc_config_asmflags += [ "-DCLZ=CLZ" ]
|
||||||
|
|
||||||
|
# ldflags for generating executable bin files
|
||||||
|
executable_config_ldflags = [
|
||||||
|
"-static",
|
||||||
|
"-Wl,--gc-sections",
|
||||||
|
"-Wl,-Map=$liteos_name.map",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Commands to generate kernel_image
|
||||||
|
toochain_config_objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
|
||||||
|
toochain_config_objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
||||||
|
|
||||||
|
toochain_config_command =
|
||||||
|
"$toochain_config_objcopy -O binary $liteos_name $liteos_name.bin"
|
||||||
|
toochain_config_command += " && sh -c '$toochain_config_objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||||
|
toochain_config_command +=
|
||||||
|
" && sh -c '$toochain_config_objdump -d $liteos_name >$liteos_name.asm'"
|
||||||
|
|
|
@ -31,6 +31,9 @@ import("liteos.gni")
|
||||||
|
|
||||||
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
||||||
|
|
||||||
|
liteos_name = "OHOS_Image"
|
||||||
|
liteos_kernel_only = false
|
||||||
|
|
||||||
#
|
#
|
||||||
# arch_config
|
# arch_config
|
||||||
#
|
#
|
||||||
|
@ -138,3 +141,14 @@ misc_config_cflags = []
|
||||||
misc_config_asmflags = []
|
misc_config_asmflags = []
|
||||||
|
|
||||||
misc_config_asmflags += [ "-DCLZ=CLZ" ]
|
misc_config_asmflags += [ "-DCLZ=CLZ" ]
|
||||||
|
|
||||||
|
# ldflags for generating executable bin files
|
||||||
|
executable_config_ldflags = [ "--map=$liteos_name.map" ]
|
||||||
|
|
||||||
|
# Commands to generate kernel_image
|
||||||
|
toochain_config_objcopy = "${compile_prefix}ielftool$toolchain_cmd_suffix"
|
||||||
|
toochain_config_objdump = "${compile_prefix}ielfdumparm$toolchain_cmd_suffix"
|
||||||
|
|
||||||
|
toochain_config_command =
|
||||||
|
"$toochain_config_objcopy --bin --verbose $liteos_name $liteos_name.bin"
|
||||||
|
toochain_config_command += " && sh -c '$toochain_config_objdump --source --all $liteos_name -o $liteos_name.asm'"
|
||||||
|
|
Loading…
Reference in New Issue