[D /RebootWithoutStart [P [A counts ] 1 RebootDevice %8000 wait /Stopped #0 def counts [B 150 wait PIVar:TalkIntf.StopProgram PIVar:TalkIntf.GetResult 0 eq PIVar:TalkIntf.GetResult $DA eq or [B /Stopped #1 def ExitLoop ] if ] repeat Stopped not [B 'StopProgram' '' PIVar:TalkIntf.GetResult PackInst:_RaiseTalkError ] if [A ] ] /LoadSW [P [A LoadFlag ChangeInterface ] % LoadFlag = False -> Check only if Files exist // ChangeInterface = True -> Curve and CMD Table will not be deleted /OSSWFileName 'EOSSW_' def /OSBareSWFileName 'OSSW_' def /SWUPROSFile '' def /Result #1 def /MissingFile '' def % Build SW File name /SWFile FilePath OSDir add '\' add OSSWFileName add OSExt add '_V' add OSSWVersion cvs add 'S' add OSSWSubVersion cvs add def % for 7.0 no decition is needed OSSWBetaInfo '' ne [B /SWFile SWFile '_' add OSSWBetaInfo add def ] if /SWFile SWFile '.HX3' add def % Build Tree File name OSTypeExt '' ne [B /TreeFile FilePath OSDir add '\' add OSTreeFileName add OSTypeExt add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def ] [B /TreeFile FilePath OSDir add '\' add OSTreeFileName add EloTypeExt add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def ] ifelse OSTreeBetaInfo '' ne [B /TreeFile TreeFile '_' add OSTreeBetaInfo add def ] if /TreeFile TreeFile '.HX2' add def % Build 2S Tree File name OSTreeFileName2S '' ne [B _2SOSTypeExt '' ne [B /TreeFile2S FilePath SafetyFWDir add '\' add OSTreeFileName2S add _2SOSTypeExt add '_V' add OSTreeVersion2S cvs add 'S' add OSTreeSubVersion2S cvs add def ][B /TreeFile2S FilePath SafetyFWDir add '\' add OSTreeFileName2S add EloTypeExt add '_V' add OSTreeVersion2S cvs add 'S' add OSTreeSubVersion2S cvs add def ] ifelse OSTreeBetaInfo2S '' ne [B /TreeFile2S TreeFile2S '_' add OSTreeBetaInfo2S add def ] if /TreeFile2S TreeFile2S '.HX2' add def ] if % check if files are existing Result [B SWFile FileExist not [B /Result #0 def /MissingFile SWFile def ] if ] if Result [B TreeFile FileExist not [B /Result #0 def /MissingFile TreeFile def ] if ] if Result [B % DefaultParFile FileExist not [B % /Result #0 def % /MissingFile DefaultParFile def % ] if ] if Result [B OSTreeFileName2S '' ne [B TreeFile2S FileExist not [B /Result #0 def /MissingFile TreeFile2S def ] if ] if ] if Result LoadFlag and [B PIVar:TalkVersion $F0 and [B %F1250 $80 [B ChangeInterface OSLoader:DownloadOS_SG89 /Result exch def ] %F1150 $A0 [B ChangeInterface OSLoader:DownloadOS_SG89 /Result exch def ] ] [B % ] case % Write new Firmware message to controller /OSInstallCommand OSInstallCommandAddress ReadMemory def /OSInstallCommand OSInstallCommand $0001 or def OSInstallCommandAddress OSInstallCommand WriteWordToElo ] if [A /MissingFile /Result] ] /DownloadOS_SG89 [P [A ] /Result #0 def PIVar:PortType 'ETH' eq ProgFlag not and [B /IPConfigMode IPConfigModeAddr ReadMemory def % read the static IP address, network mask and gateway /IPAddressLo IPAddressAddr ReadMemory def /IPAddressHi IPAddressAddr 2 add ReadMemory def /NetMaskLo NetMaskAddr ReadMemory def /NetMaskHi NetMaskAddr 2 add ReadMemory def /DefaultGatewayLo DefaultGatewayAddr ReadMemory def /DefaultGatewayHi DefaultGatewayAddr 2 add ReadMemory def % read the working IP address, network mask and gateway /IPAddressWorkLo IPAddressAddrWorking ReadMemory def /IPAddressWorkHi IPAddressAddrWorking 2 add ReadMemory def /NetMaskWorkLo NetMaskAddrWorking ReadMemory def /NetMaskWorkHi NetMaskAddrWorking 2 add ReadMemory def /DefaultGatewayWorkLo DefaultGatewayAddrWorking ReadMemory def /DefaultGatewayWorkHi DefaultGatewayAddrWorking 2 add ReadMemory def % write the static IP address, network mask and gateway IPAddressAddr IPAddressWorkLo WriteWordToElo IPAddressAddr 2 add IPAddressWorkHi WriteWordToElo NetMaskAddr NetMaskWorkLo WriteWordToElo NetMaskAddr 2 add NetMaskWorkHi WriteWordToElo DefaultGatewayAddr DefaultGatewayWorkLo WriteWordToElo DefaultGatewayAddr 2 add DefaultGatewayWorkHi WriteWordToElo % set the config mode to static IPConfigModeAddr 2 WriteWordToElo ] if /InstVal OSInstallValidAddr PackInst:ReadMemory def InstVal InstallationValid ne [B OSInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' SWFile add log OSSoftwareUpdateAddr InstallationValid WriteWordToElo SystGen 8 eq[B % erase old data in serial flash first 21 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem 'Downloading ' TreeFile add log OSTreeUpdateAddr InstallationValid WriteWordToElo SystGen 8 eq[B % erase old data in serial flash first 22 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File /Result #1 def ][B /Result #1 def % Read drive % Get SW CRC /CRC_drive_SW OS_SW_CRC_Addr PackInst:_GetBlock def % Get Tree CRC /CRC_drive_Tr OS_Tr_CRC_Addr PackInst:_GetBlock def % Get SW file name /Filename_read_SW OS_SW_FileName_Addr GetInstalledFileName uppercase def % Get Tree file name /Filename_read_Tr OS_Tr_FileName_Addr GetInstalledFileName uppercase def % Read file % Get SW CRC getcurrentdir '\' add SWFile add OS_SW_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_SW exch def getcurrentdir '\' add SWFile add OS_SW_CRC_EEPROM_Addr SystGen crcfromfile /Res exch def /CRC_file_EEPROM_SW exch def % Get Tree CRC getcurrentdir '\' add TreeFile add OS_Tr_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_Tr exch def getcurrentdir '\' add TreeFile add OS_Tr_CRC_EEPROM_Addr SystGen crcfromfile /Res exch def /CRC_file_EEPROM_Tr exch def % Get SW file name /Filename_file_SW SWFile extfilename '' chfileext uppercase def % Get Tree file name /Filename_file_Tr TreeFile extfilename '' chfileext uppercase def % Check CRC CRC_file_SW CRC_invalid1 eq CRC_file_SW CRC_invalid2 eq CRC_file_SW CRC_file_EEPROM_SW ne or or [B 'File: ' SWFile extfilename add ' is corrupted!' add log /Result #0 def ] if CRC_file_Tr CRC_invalid1 eq CRC_file_Tr CRC_invalid2 eq CRC_file_Tr CRC_file_EEPROM_Tr ne or or [B 'File: ' TreeFile extfilename add ' is corrupted!' add log /Result #0 def ] if Result [B /InstallSW /StrLength Filename_file_SW length def %remove the E from the filename to compare /StrLength StrLength 1 sub def /Filename_file_SW Filename_file_SW 1 StrLength getsubstr def Filename_file_SW Filename_read_SW ne CRC_file_SW CRC_drive_SW ne or def /InstallTr /StrLength Filename_file_Tr length def %remove the E from the filename to compare /StrLength StrLength 1 sub def /Filename_file_Tr Filename_file_Tr 1 StrLength getsubstr def Filename_file_Tr Filename_read_Tr ne CRC_file_Tr CRC_drive_Tr ne or def InstallSW [B OSSoftwareUpdateAddr InstallationValid WriteWordToElo OSInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' SWFile add log SystGen 8 eq[B % erase old data in serial flash first 21 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem ][B 'Download OS SW firmware skipped. Already up to date...' log ] ifelse InstallTr [B OSTreeUpdateAddr InstallationValid WriteWordToElo OSInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' TreeFile add log SystGen 8 eq[B % erase old data in serial flash first 22 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File ][B 'Download OS Tree firmware skipped. Already up to date...' log ] ifelse ] if ] ifelse OSTreeFileName2S '' ne [B % Get Tree file name /Filename_read_Tr SAFE_Tr_FileName_Addr GetInstalledFileName uppercase def % Get Tree file name /Filename_file_Tr TreeFile2S extfilename '' chfileext uppercase def Result [B /InstallTr Filename_file_Tr Filename_read_Tr ne CRC_file_Tr CRC_drive_Tr ne or def InstallTr [B 'Downloading ' TreeFile2S add log TreeFile2S dup loadobj exch PackInst:DownloadHX2File ][B 'Download 2S Tree firmware skipped. Already up to date...' log ] ifelse ] if ] if % download second stage bootloader for netX netX90Based not[B netXBased [B /netXBootloaderData_lw $808C0004 ReadMemory def /netXBootloaderData_hw $808C0006 ReadMemory def netXBootloaderData_lw $AF00 ne netXBootloaderData_hw $F8BE ne or [B 'Erasing netX bootloader sector...' log $808C0000 PackInst:EraseFlash % netX second stage bootloader 250 wait % give switch some time to process eth frames received while erasing flash which is blocking /MissingFile '' def /ModuleParFile FilePath OSDir add '\netX\NETX52-BSL_V1_4_18_0_FM09_2_1_0.HX2' add def ModuleParFile FileExist not [B /MissingFile ModuleParFile def ] if 'Downloading ' ModuleParFile add log ModuleParFile dup loadobj exch PackInst:DownloadHX2File ][B 'Download netX bootloader skipped. Already up to date...' log ] ifelse ] if ] if PIVar:PortType 'ETH' eq ProgFlag not and [B IPAddressAddr IPAddressLo WriteWordToElo IPAddressAddr 2 add IPAddressHi WriteWordToElo NetMaskAddr NetMaskLo WriteWordToElo NetMaskAddr 2 add NetMaskHi WriteWordToElo DefaultGatewayAddr DefaultGatewayLo WriteWordToElo DefaultGatewayAddr 2 add DefaultGatewayHi WriteWordToElo % set the config modes to the old values IPConfigModeAddr IPConfigMode WriteWordToElo ] if [A /Result] ] ]