成功使用ninja编译ht.bin
This commit is contained in:
@@ -12,9 +12,7 @@ config("compiler_defaults") {
|
||||
cflags = [
|
||||
"-mabi=ilp32f",
|
||||
"-march=rv32imafc",
|
||||
"-Os",
|
||||
"-falign-functions=2",
|
||||
"-msave-restore",
|
||||
"-fno-optimize-strlen",
|
||||
"-freorder-blocks-algorithm=simple",
|
||||
"-fno-schedule-insns",
|
||||
@@ -27,12 +25,17 @@ config("compiler_defaults") {
|
||||
"-fdata-sections",
|
||||
"-fno-exceptions",
|
||||
"-fno-short-enums",
|
||||
"-D__LITEOS__M",
|
||||
"-nostartfiles",
|
||||
"-mstrict-align",
|
||||
"-Wno-error=unused-function",
|
||||
"-Wno-error=unused-but-set-variable",
|
||||
"-ffast-math",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-fno-common",
|
||||
"-fno-builtin-printf",
|
||||
"-Os",
|
||||
"-msave-restore",
|
||||
]
|
||||
cflags_cc = cflags
|
||||
ldflags = cflags
|
||||
|
@@ -687,6 +687,168 @@ build_prepare
|
||||
|
||||
export HW_CHIP_ID="${DEF_CHIP_ID}"
|
||||
|
||||
select_ld_script() {
|
||||
local LD_SCRIPT=""
|
||||
if [ "${target}" == "kunlun3" ]; then
|
||||
if [ "${flash_build}" == "1" ]; then
|
||||
# define plc only lds
|
||||
if [ "${build_amp_type}" == "0" ]; then
|
||||
if [ "${cco}" == "1" ]; then
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_cco_plc_only.lds
|
||||
else
|
||||
if [ "${flash_size}" == "2" ]; then
|
||||
LD_SCRIPT=link_flash_2m_cco_plc_only.lds
|
||||
else
|
||||
LD_SCRIPT=link_flash_4m_cco_plc_only.lds
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_sta_plc_only.lds
|
||||
else
|
||||
if [ "${flash_size}" == "2" ]; then
|
||||
LD_SCRIPT=link_flash_2m_sta_plc_only.lds
|
||||
else
|
||||
LD_SCRIPT=link_flash_4m_sta_plc_only.lds
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# define customer-core lds of AMP
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
if [ "${cco}" == "1" ]; then
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
# for fastboot-mode specialized
|
||||
if [ "${fastboot_mode}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_cus_cco_fb.lds
|
||||
# for normal mode
|
||||
else
|
||||
LD_SCRIPT=link_psram_8m_cus_cco.lds
|
||||
fi
|
||||
else
|
||||
LD_SCRIPT=link_flash_2m_cus_cco.lds
|
||||
fi
|
||||
else
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
# for fastboot-mode specialized
|
||||
if [ "${fastboot_mode}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_cus_sta_fb.lds
|
||||
# for normal mode
|
||||
else
|
||||
LD_SCRIPT=link_psram_8m_cus_sta.lds
|
||||
fi
|
||||
else
|
||||
LD_SCRIPT=link_flash_2m_cus_sta.lds
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# define plc-core lds of AMP
|
||||
if [ "${cco}" == "1" ]; then
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_cco.lds
|
||||
else
|
||||
LD_SCRIPT=link_flash_2m_cco.lds
|
||||
fi
|
||||
else
|
||||
if [ "${psram_enable}" == "1" ]; then
|
||||
LD_SCRIPT=link_psram_8m_sta.lds
|
||||
else
|
||||
LD_SCRIPT=link_flash_2m_sta.lds
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
LD_SCRIPT=link.lds
|
||||
fi
|
||||
fi
|
||||
echo ${LD_SCRIPT}
|
||||
}
|
||||
|
||||
build_use_ninja() {
|
||||
local BUILD_FOLDER=$(pwd)
|
||||
if [[ "${DEF_IMAGE_TYPE}" == *"cco"* ]]; then
|
||||
# cco is 3201
|
||||
local file_path="config.gni"
|
||||
local chip="htzd3201"
|
||||
local mode="cco"
|
||||
elif [ "${DEF_IMAGE_TYPE}" == "ckb" ]; then
|
||||
# ckb is 3201
|
||||
local file_path="config.gni"
|
||||
local chip="htzd3201"
|
||||
local mode="sta"
|
||||
elif [[ "${DEF_IMAGE_TYPE}" == *"sta"* ]]; then
|
||||
local file_path="config.gni"
|
||||
local chip="htzd3211"
|
||||
local mode="sta"
|
||||
elif [ "${DEF_IMAGE_TYPE}" == "ftm" ]; then
|
||||
# ftm is 3211
|
||||
local file_path="config.gni"
|
||||
local chip="htzd3211"
|
||||
local mode="ftm"
|
||||
else
|
||||
echo "wrong value with DEF_IMAGE_TYPE:${DEF_IMAGE_TYPE}"
|
||||
exit 1
|
||||
fi
|
||||
local ld_script=$(select_ld_script)
|
||||
if [ "${target}" == "kunlun3" ]; then
|
||||
local lds_path=$(realpath "${BUILD_FOLDER}/../startup/ldscripts/riscv3/${ld_script}")
|
||||
else
|
||||
echo "wrong value with target:${target}"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${build_amp_type}" == "1" ]; then
|
||||
local tmp_lds="../tools/gen_img/tmp_cus.lds"
|
||||
else
|
||||
local tmp_lds="../tools/gen_img/tmp_plc.lds"
|
||||
fi
|
||||
|
||||
echo "fastboot_mode=\"${fastboot_mode}\"" > ${file_path}
|
||||
echo "flash_size=\"${flash_size}\"" >> ${file_path}
|
||||
echo "psram_enable=\"${psram_enable}\"" >> ${file_path}
|
||||
echo "psram_size=\"${psram_size}\"" >> ${file_path}
|
||||
echo "layout_index=\"${layout_index}\"" >> ${file_path}
|
||||
echo "HW_CHIP_ID=\"${HW_CHIP_ID}\"" >> ${file_path}
|
||||
echo "PROTO_TYPE=\"${PROTO_TYPE}\"" >> ${file_path}
|
||||
echo "rf_enable=\"${rf_enable}\"" >> ${file_path}
|
||||
echo "dual_enable=\"${dual_enable}\"" >> ${file_path}
|
||||
echo "build_amp_type=\"${build_amp_type}\"" >> ${file_path}
|
||||
echo "sec_cpu_enable=\"${sec_cpu_enable}\"" >> ${file_path}
|
||||
echo "cco=\"${cco}\"" >> ${file_path}
|
||||
echo "os_type=\"${os_type}\"" >> ${file_path}
|
||||
echo "new_type_cco=\"${new_type_cco}\"" >> ${file_path}
|
||||
echo "soft_float_enable=\"${soft_float_enable}\"" >> ${file_path}
|
||||
echo "smart_cco_sta=\"${smart_cco_sta}\"" >> ${file_path}
|
||||
echo "ckb=\"${ckb}\"" >> ${file_path}
|
||||
echo "gdb_debug_enable=\"${gdb_debug_enable}\"" >> ${file_path}
|
||||
|
||||
echo "disable_print=\"${disable_print}\"" >> ${file_path}
|
||||
echo "hw_platform_ver=\"${hw_platform_ver}\"" >> ${file_path}
|
||||
echo "gcc=\"${gcc}\"" >> ${file_path}
|
||||
echo "target=\"${target}\"" >> ${file_path}
|
||||
echo "ftm_build=\"${ftm_build}\"" >> ${file_path}
|
||||
echo "opt_build=\"${opt_build}\"" >> ${file_path}
|
||||
echo "flash_build=\"${flash_build}\"" >> ${file_path}
|
||||
echo "cpu1_build=\"${cpu1_build}\"" >> ${file_path}
|
||||
echo "mpu_enable=\"${mpu_enable}\"" >> ${file_path}
|
||||
echo "release_build=\"${release_build}\"" >> ${file_path}
|
||||
echo "product_line=\"${product_line}\"" >> ${file_path}
|
||||
echo "PLATFORM=\"$1\"" >> ${file_path}
|
||||
echo "APP=\"$2\"" >> ${file_path}
|
||||
echo "FLASH_SIZE=\"$3\"" >> ${file_path}
|
||||
echo "kl_ld_script=\"${lds_path}\"" >> ${file_path}
|
||||
|
||||
echo "cp ${lds_path} to ${tmp_lds}"
|
||||
cp ${lds_path} ${tmp_lds}
|
||||
cd ../
|
||||
gn gen out/build
|
||||
ninja -C out/build
|
||||
|
||||
cd ${BUILD_FOLDER}
|
||||
}
|
||||
|
||||
|
||||
build_obj_func() {
|
||||
IMG_TYPE=$(echo $1 | tr '[A-Z]' '[a-z]')
|
||||
APP_SELECTION=$2
|
||||
@@ -787,10 +949,11 @@ build_obj_func() {
|
||||
else
|
||||
export cco=1
|
||||
. ${SRC_ENV_FILE}
|
||||
if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
fi
|
||||
./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=1 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
# if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
# ./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
# fi
|
||||
# ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=1 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM}
|
||||
if [ "${APP_SELECTION}" == "${DEF_CUS_APP}" ]; then
|
||||
#kl3 customer demo, cus_core.
|
||||
cp ../ap/.output/cus/lib/ht_cco.bin ../tools/gen_img/ht_cus.bin
|
||||
@@ -844,10 +1007,11 @@ build_obj_func() {
|
||||
else
|
||||
export cco=0
|
||||
. ${SRC_ENV_FILE}
|
||||
if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
fi
|
||||
./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
# if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
# ./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
# fi
|
||||
# ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM}
|
||||
fi
|
||||
|
||||
if [ "${APP_SELECTION}" == "${DEF_CUS_APP}" ]; then
|
||||
@@ -886,11 +1050,11 @@ build_obj_func() {
|
||||
export cco=0
|
||||
. ${SRC_ENV_FILE}
|
||||
|
||||
if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
fi
|
||||
|
||||
./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
# if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
# ./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
# fi
|
||||
# ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM}
|
||||
|
||||
cp ../ap/.output/plc/lib/ht_ftm.bin ../tools/gen_img/ht.bin
|
||||
cp ../ap/.output/plc/lib/ht_ftm.out ../tools/gen_img/ht.out
|
||||
@@ -902,11 +1066,11 @@ build_obj_func() {
|
||||
export ckb=1
|
||||
. ${SRC_ENV_FILE}
|
||||
|
||||
if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
fi
|
||||
|
||||
./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
# if [ "${DEF_CLEANUP}" == "true" ]; then
|
||||
# ./make.py -j APP=${APP_SELECTION} -C .. clobber
|
||||
# fi
|
||||
# ./make.py -j PLATFORM=${DEF_PLATFORM_TYPE} cco=0 APP=${APP_SELECTION} FLASH_SIZE=${FLASH_SIZE_nM} -C ..
|
||||
build_use_ninja ${DEF_PLATFORM_TYPE} ${APP_SELECTION} ${FLASH_SIZE_nM}
|
||||
|
||||
cp ../ap/.output/plc/lib/ht_sta.bin ../tools/gen_img/ht.bin
|
||||
cp ../ap/.output/plc/lib/ht_sta.out ../tools/gen_img/ht.out
|
||||
|
@@ -13,9 +13,12 @@ if __name__ == "__main__":
|
||||
cmd=f"{' '.join(sys.argv[1:])} > build_log.log"
|
||||
if not ('not_clean' in sys.argv[1:]):
|
||||
os.system("python3 ../clear_output.py > /dev/null")
|
||||
os.remove("../make_flags.txt")
|
||||
os.remove("../python_script_log.log")
|
||||
os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log")
|
||||
try:
|
||||
os.remove("../make_flags.txt")
|
||||
os.remove("../python_script_log.log")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# os.system("python3 ../praper_vscode.py clear >> ../python_script_log.log")
|
||||
path="../tools/gen_img/customer"
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
@@ -10,7 +10,7 @@ dual_enable="1"
|
||||
build_amp_type="0"
|
||||
sec_cpu_enable="1"
|
||||
cco="1"
|
||||
os_type="freertos"
|
||||
os_type=""
|
||||
new_type_cco=""
|
||||
soft_float_enable=""
|
||||
smart_cco_sta=""
|
||||
@@ -30,4 +30,4 @@ product_line="PLC"
|
||||
PLATFORM="CHIP"
|
||||
APP="0"
|
||||
FLASH_SIZE="4"
|
||||
kl_ld_script="//startup/ldscripts/riscv3/link_psram_8m_cco_plc_only.lds"
|
||||
kl_ld_script="/home/andy/source/clone/kunlun/startup/ldscripts/riscv3/link_psram_8m_cco_plc_only.lds"
|
||||
|
Reference in New Issue
Block a user