164 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
		
		
			
		
	
	
			164 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| 
								 | 
							
								export disable_print=0
							 | 
						||
| 
								 | 
							
								export hw_platform_ver=2
							 | 
						||
| 
								 | 
							
								export gcc=riscv
							 | 
						||
| 
								 | 
							
								export target=kunlun3
							 | 
						||
| 
								 | 
							
								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]')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if [ "${PROTO_TYPE}" == "p12087" ]; then
							 | 
						||
| 
								 | 
							
								    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[ ]*PHY_PRIVATE_OFFSET_PHASE[ ]*\) .*$/\1 $no_sg_network_connection/g" $inc_ver/config/plc_config.h
							 | 
						||
| 
								 | 
							
								elif [ "${PROTO_TYPE}" == "p1901" ]; then
							 | 
						||
| 
								 | 
							
								    no_sg_network_connection=0
							 | 
						||
| 
								 | 
							
								    sed -i "s/\([ ]*#define[ ]*PHY_PRIVATE_OFFSET_PHASE[ ]*\) .*$/\1 $no_sg_network_connection/g" $inc_ver/config/plc_config.h
							 | 
						||
| 
								 | 
							
								fi
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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 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
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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 #########################################
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								fi
							 |