248 lines
10 KiB
Bash
Executable File
248 lines
10 KiB
Bash
Executable File
export disable_print=0
|
|
export hw_platform_ver=15
|
|
export gcc=riscv
|
|
export ftm_build=0
|
|
export opt_build=1
|
|
export flash_build=1
|
|
export cpu1_build=0
|
|
export mpu_enable=0
|
|
export product_line=PLC
|
|
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]')
|
|
|
|
# config for ge ext lwip default build as client,if use as server, need change def_type_client to 0
|
|
def_type_client=1
|
|
|
|
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_val=[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
|
|
if [ "$psram" == "0m" ];then
|
|
new_printf=0
|
|
else
|
|
new_printf=1
|
|
fi
|
|
new_assert=1
|
|
new_version_type=0
|
|
new_exception=0
|
|
|
|
fi
|
|
|
|
if [ "$app" == "4" ]; then
|
|
#### ge ##########
|
|
no_sg_network_connection=0
|
|
elif [ "$app" == "8" ]; then
|
|
#### ge_ext lwip ######
|
|
no_sg_network_connection=0
|
|
elif [ "$app" == "9" ]; then
|
|
#### ge_ext ######
|
|
no_sg_network_connection=0
|
|
elif [ "$app" == "13" ]; then
|
|
#### ge + modbus ######
|
|
no_sg_network_connection=0
|
|
elif [ "$app" == "22" ]; then
|
|
#### ge micro cctt ######
|
|
no_sg_network_connection=0
|
|
else
|
|
no_sg_network_connection=1
|
|
fi
|
|
|
|
sed -i "s/\([ ]*#define[ ]*IOT_PRINTF_DEBUG[ ]*\) $org_printf/\1 $new_printf/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_ASSERT_DEBUG[ ]*\) $org_assert/\1 $new_assert/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_EXCEPTION_DEBUG[ ]*\) $org_exception/\1 $new_exception/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*AP_FIRMWARE_VERSION_TYPE[ ]*\) ($org_version_type)/\1 ($new_version_type)/g" $inc_ver/iot_version.h
|
|
sed -i "s/\([ ]*#define[ ]*PHY_PRIVATE_OFFSET_PHASE[ ]*\) .*$/\1 $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 #########################################
|
|
|
|
####################################### APP 7 build set macros start #########################################
|
|
if [ "$app" == "7" ]; then
|
|
src_ledc=../app/led_ctrl_app/controller
|
|
|
|
org_adc=[0-9]*
|
|
org_em=[0-9]*
|
|
org_hardware=[0-9]*
|
|
|
|
if [ "$psram" != "0m" ] && [ "$flash" == "2m" ]; then
|
|
new_adc=1
|
|
new_em=1
|
|
new_hardware=1
|
|
else
|
|
new_adc=0
|
|
new_em=0
|
|
new_hardware=0
|
|
fi
|
|
|
|
sed -i "\(s/[ ]*#define[ ]*IOT_ENERGE_METER_ENABLE[ ]*\) $org_em/\1 $new_em/g" $inc_cfg/plc_config_api.h
|
|
sed -i "\(s/[ ]*#define[ ]*ENABLE_LED_CTRL_HARDWARE[ ]*\) ($org_hardware)/\1 ($new_hardware)/g" $src_ledc/iot_light_ctrl_drv.c
|
|
sed -i "\(s/[ ]*#define[ ]*IOT_LIGHT_CTRL_ADC_MODULE_ENABLE[ ]*\) ($org_adc)/\1 ($new_adc)/g" $src_ledc/iot_light_ctrl_drv.c
|
|
|
|
echo set : IOT_LIGHT_CTRL_ADC_MODULE_ENABLE=$new_adc ENABLE_LED_CTRL_HARDWARE=$new_hardware IOT_ENERGE_METER_ENABLE=$new_em
|
|
fi #[ "$app" == "7" ]
|
|
####################################### APP 7 build end #########################################
|
|
|
|
####################################### APP 8 ge ext lwip build set macros start #########################################
|
|
if [ "$app" == "8" ]; then
|
|
inc_lwip_opt=../import/lwip/ports/include
|
|
org_dbg="LWIP_DBG_[A-Z]*"
|
|
|
|
if [ "$type" == "debug" ]; then
|
|
new_dbg="LWIP_DBG_ON"
|
|
else
|
|
new_dbg="LWIP_DBG_OFF"
|
|
fi
|
|
|
|
sed -i "s/\([ ]*#define[ ]*TCPIP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*NETIF_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*SOCKETS_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*IP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*UDP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*TCP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*ICMP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
echo set : TCPIP_DEBUG=$new_dbg NETIF_DEBUG=$new_dbg SOCKETS_DEBUG=$new_dbg IP_DEBUG=$new_dbg UDP_DEBUG=$new_dbg TCP_DEBUG=$new_dbg ICMP_DEBUG=$new_dbg
|
|
|
|
if [ $def_type_client == 1 ]; then
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_PLC_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_ETH_SUPPORT[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_UART_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
fi
|
|
sed -i "s/\([ ]*#define[ ]*IOT_CUS_PORT_ETH_ENABLE[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
|
|
mkdir -p ../app/iot_ge_lwip_app/ge_lwip
|
|
cp -fr ../app/iot_ge_ext_app/* ../app/iot_ge_lwip_app/ge_lwip/
|
|
fi #[ "$app" == "8" ]
|
|
####################################### APP 8 end #########################################
|
|
|
|
####################################### APP 12 demo_lwip build set macros start #########################################
|
|
if [ "$app" == "12" ]; then
|
|
inc_lwip_opt=../import/lwip/ports/include
|
|
org_dbg="LWIP_DBG_[A-Z]*"
|
|
|
|
if [ "$type" == "debug" ]; then
|
|
new_dbg="LWIP_DBG_ON"
|
|
else
|
|
new_dbg="LWIP_DBG_OFF"
|
|
fi
|
|
|
|
sed -i "s/\([ ]*#define[ ]*TCPIP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*NETIF_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*SOCKETS_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*IP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*UDP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*TCP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*ICMP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
sed -i "s/\([ ]*#define[ ]*LWIP_IPV6[ ]*\) 0/\1 1/g" $inc_lwip_opt/plc_lwipopts.h
|
|
echo set : TCPIP_DEBUG=$new_dbg NETIF_DEBUG=$new_dbg SOCKETS_DEBUG=$new_dbg IP_DEBUG=$new_dbg UDP_DEBUG=$new_dbg TCP_DEBUG=$new_dbg ICMP_DEBUG=$new_dbg
|
|
echo set : LWIP_IPV6=1
|
|
|
|
mkdir -p ../app/demo_lwip/demo
|
|
cp -f ../app/demo/* ../app/demo_lwip/demo/
|
|
fi #[ "$app" == "12" ]
|
|
####################################### APP 12 end #########################################
|
|
|
|
####################################### APP 22 micro cctt build set macros start #########################################
|
|
if [ "$app" == "22" ]; then
|
|
inc_lwip_opt=../import/lwip/ports/include
|
|
org_dbg="LWIP_DBG_[A-Z]*"
|
|
|
|
if [ "$type" == "debug" ]; then
|
|
new_dbg="LWIP_DBG_ON"
|
|
else
|
|
new_dbg="LWIP_DBG_OFF"
|
|
fi
|
|
|
|
sed -i "s/\([ ]*#define[ ]*TCPIP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*NETIF_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*SOCKETS_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*IP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*UDP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*TCP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
sed -i "s/\([ ]*#define[ ]*ICMP_DEBUG[ ]*\) $org_dbg/\1 $new_dbg/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
echo set : TCPIP_DEBUG=$new_dbg NETIF_DEBUG=$new_dbg SOCKETS_DEBUG=$new_dbg IP_DEBUG=$new_dbg UDP_DEBUG=$new_dbg TCP_DEBUG=$new_dbg ICMP_DEBUG=$new_dbg
|
|
|
|
if [ $def_type_client == 1 ]; then
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_PLC_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_ETH_SUPPORT[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_UART_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
fi
|
|
sed -i "s/\([ ]*#define[ ]*IOT_CUS_PORT_ETH_ENABLE[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
|
|
## set iic slave address of mcp23017 to 0x24 here ##
|
|
sed -i "s/\([ ]*#define[ ]*MCP23017_SLAVER_ADDR[ ]*\) ([0-9x]*)/\1 (0x24)/g" ../driver/extern/ext-io/src/iot_gpio_ex_mcp23017.c
|
|
|
|
## set dhcp diable
|
|
sed -i "s/\([ ]*#define[ ]*LWIP_DHCP[ ]*\) 1/\1 0/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
## enable dns function
|
|
sed -i "s/\([ ]*#define[ ]*LWIP_DNS[ ]*\) 0/\1 1/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
fi #[ "$app" == "22" ]
|
|
####################################### APP 22 end #########################################
|
|
|
|
####################################### APP 25 at micro cctt build set macros start #########################################
|
|
if [ "$app" == "25" ]; then
|
|
inc_lwip_opt=../import/lwip/ports/include
|
|
org_dbg="LWIP_DBG_[A-Z]*"
|
|
|
|
if [ $def_type_client == 1 ]; then
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_PLC_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_ETH_SUPPORT[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
sed -i "s/\([ ]*#define[ ]*IOT_LWIP_NETIF_UART_SUPPORT[ ]*\) $org_val/\1 0/g" $inc_cfg/plc_config_api.h
|
|
fi
|
|
sed -i "s/\([ ]*#define[ ]*IOT_CUS_PORT_ETH_ENABLE[ ]*\) $org_val/\1 1/g" $inc_cfg/plc_config_api.h
|
|
|
|
## set iic slave address of mcp23017 to 0x24 here ##
|
|
sed -i "s/\([ ]*#define[ ]*MCP23017_SLAVER_ADDR[ ]*\) ([0-9x]*)/\1 (0x24)/g" ../driver/extern/ext-io/src/iot_gpio_ex_mcp23017.c
|
|
|
|
## set dhcp diable
|
|
sed -i "s/\([ ]*#define[ ]*LWIP_DHCP[ ]*\) 1/\1 0/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
## enable dns function
|
|
sed -i "s/\([ ]*#define[ ]*LWIP_DNS[ ]*\) 0/\1 1/g" $inc_lwip_opt/plc_lwipopts.h
|
|
|
|
fi #[ "$app" == "25" ]
|
|
####################################### APP 25 end #########################################
|
|
|
|
fi
|