'file name: uart_update.vbsapp
Sub Main
'設置開發板IP地址
crt.Screen.Send chr(13)
crt.Screen.sendKeys ("setenv ipaddr 192.168.10.30;setenv serverip 192.168.10.5;")
crt.Screen.Send chr(13)
crt.Screen.WaitForString ("setenv ipaddr")
crt.Screen.sendKeys ("setenv gatewayip 192.168.10.1;setenv bootdelay 1;setenv phytype 0;")
crt.Screen.Send chr(13)
crt.Screen.WaitForString ("setenv gatewayip")
crt.Screen.Send chr(13)
'TFTP下載8M文件
'crt.Screen.sendKeys ("tftpboot xxx) app8M-gk7202-sc2232_v_1_0_0822.bin
crt.Screen.sendKeys ("tftpboot app8M-gk7205.bin")
crt.Screen.Send chr(13)
crt.Screen.WaitForString ("Bytes transferred = 8388608")
'8M文件寫入到flash
crt.Screen.sendKeys ("sf probe 0 0;sf erase 0x00000 0x800000;sf write 0xC1000000 0x00000 0x800000")
crt.Screen.Send chr(13)
'crt.Screen.sendKeys ("sf probe 1 0;sf erase 0x00000 0x800000;sf write 0xC1000000 0x00000 0x800000")
'重啓開發板,使用新的bootenv 參數,防止後面保存老的bootenv
crt.Screen.WaitForString ("abc")
crt.Screen.Send chr(13)
crt.Screen.sendKeys ("printenv")
crt.Screen.Send chr(13)
crt.Screen.WaitForString ("Environment size:")
'配置新的MAC和IP信息並保存參數
crt.Screen.sendKeys ("setenv ipaddr 192.168.10.")
crt.Screen.Send chr(13)
crt.Screen.WaitForString ("setenv ipaddr")
crt.Screen.sendKeys ("setenv ethaddr 3C:97:0E:22:E1:")
crt.Screen.WaitForString ("setenv ethaddr")
crt.Screen.Send chr(13)server
End Sub
ip