未验证 提交 0c8b7d2a 编写于 作者: O openharmony_ci 提交者: Gitee

!751 refactor:编译框架对不同工具链的解耦优化

Merge pull request !751 from Zhaotianyu/20220712buildframework_opt
...@@ -31,11 +31,6 @@ import("//build/lite/config/component/lite_component.gni") ...@@ -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") { ...@@ -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") { ...@@ -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'"
}
} }
...@@ -31,6 +31,9 @@ import("liteos.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)) { ...@@ -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") ...@@ -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 = [] ...@@ -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'"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册