Files
kunlun/build/env_flash_smart_kl2.sh

81 lines
2.7 KiB
Bash
Raw Permalink Normal View History

2024-09-28 14:24:04 +08:00
export disable_print=0
export hw_platform_ver=15
export gcc=riscv
export target=kunlun2
export ftm_build=0
export opt_build=1
export flash_build=1
export cpu1_build=0
export mpu_enable=0
#export psram_enable=1
export HW_CHIP_ID=NA
export release_build=0
export fatfs_enable=0
export product_line=PLC
export PLATFORM=CHIP
export PATH=/opt/kunlun2/bin/:$PATH
role=$(echo $1 | tr '[A-Z]' '[a-z]')
app=$2
type=$(echo $3 | tr '[A-Z]' '[a-z]')
flash=$(echo $4 | tr '[A-Z]' '[a-z]')
psram=$(echo $5 | tr '[A-Z]' '[a-z]')
echo role=$role, app=$app, type=$type, flash=$flash, psram=$psram
if [ "$role" == "" ] || [ "$app" == "" ] || [ "$type" == "" ] || [ "$flash" == "" ] || [ "$psram" == "" ]; then
echo invalid input, will not change macros.
else
inc_cfg=../export/inc/config
inc_ver=../inc
####################################### common release or debug build set macros start #########################################
org_printf=[0-9]*
org_assert=[0-9]*
org_version_type=[0-9]*
org_exception=[0-9]*
org_image_type=[0-9a-zA-Z_]*
if [ "$type" == "" ]; then
type=debug
fi
if [ "$type" == "debug" ]; then
export release_build=0
new_printf=1
new_assert=1
new_version_type=1
if [ "$role" == "cco" ]; then
new_exception=0
elif [ "$role" == "sta" ]; then
new_exception=1
fi
elif [ "$type" == "release" ]; then
export release_build=1
new_printf=0
new_assert=1
new_version_type=0
new_exception=0
fi
if [ "$app" == "4" ]; then
no_sg_network_connection=0
elif [ "$app" == "9" ]; then
no_sg_network_connection=0
else
no_sg_network_connection=1
fi
sed -i "s/[ ]*#define[ ]*IOT_PRINTF_DEBUG[ ]*$org_printf/#define IOT_PRINTF_DEBUG $new_printf/g" $inc_cfg/plc_config_api.h
sed -i "s/[ ]*#define[ ]*IOT_ASSERT_DEBUG[ ]*$org_assert/#define IOT_ASSERT_DEBUG $new_assert/g" $inc_cfg/plc_config_api.h
sed -i "s/[ ]*#define[ ]*IOT_EXCEPTION_DEBUG[ ]*$org_exception/#define IOT_EXCEPTION_DEBUG $new_exception/g" $inc_cfg/plc_config_api.h
sed -i "s/[ ]*#define[ ]*AP_FIRMWARE_VERSION_TYPE[ ]*($org_version_type)/#define AP_FIRMWARE_VERSION_TYPE ($new_version_type)/g" $inc_ver/iot_version.h
sed -i "s/[ ]*#define[ ]*PHY_PRIVATE_OFFSET_PHASE.*$/#define PHY_PRIVATE_OFFSET_PHASE $no_sg_network_connection/g" $inc_ver/config/plc_config.h
echo set : IOT_PRINTF_DEBUG=$new_printf/IOT_ASSERT_DEBUG=$new_assert/IOT_EXCEPTION_DEBUG=$new_exception/AP_FIRMWARE_VERSION_TYPE=$new_version_type/PHY_PRIVATE_OFFSET_PHASE=$no_sg_network_connection
####################################### common release or debug build end #########################################
fi