[D /LoadSW [P [A LoadFlag ] % LoadFlag = False -> Check only if Files exist /OSSWFileName 'UPOS_' def /OSTreeFileName 'OSTr1100_' def /Result #1 def /MissingFile '' def /SWFile FilePath OSDir add '\' add OSSWFileName add EloTypeExt add '_V' add OSSWVersion cvs add 'S' add OSSWSubVersion cvs add def OSSWBetaInfo '' ne [B /SWFile SWFile '_' add OSSWBetaInfo add def ] if /SWFile SWFile '.HX2' add def /TreeFile FilePath OSDir add '\' add OSTreeFileName add EloTypeExt add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def OSTreeBetaInfo '' ne [B /TreeFile TreeFile '_' add OSTreeBetaInfo add def ] if /TreeFile TreeFile '.HX2' add def /DefaultParFile FilePath OSDir add '\' add OSTreeFileName add EloTypeExt add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def OSTreeBetaInfo '' ne [B /DefaultParFile DefaultParFile '_' add OSTreeBetaInfo add def ] if /DefaultParFile DefaultParFile '.Gr3' add def 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 LoadFlag and [B TalkVersion $F0 and [B % B1100 $40 [B %ResetDevice %5000 wait PackInst:StopProgram 'Erasing OS firmware sector...' log $C04000 PackInst:EraseFlash 5000 wait $C06000 PackInst:EraseFlash 5000 wait $C08000 PackInst:EraseFlash 5000 wait $C10000 PackInst:EraseFlash 5000 wait 'Downloading OS...' log SWFile dup loadobj exch PackInst:DownloadHX2File 'Resetting Device...'log ResetDevice 5000 Wait 'Starting OS...' log $C08000 StartProgram 10000 wait %PackInst:StopProgram 'Erasing OS updater ...' log $C08000 PackInst:EraseFlash 5000 wait $C10000 PackInst:EraseFlash 5000 wait 'Downloading OS parameter tree...' log TreeFile dup loadobj exch PackInst:DownloadHX2File ResetDevice 1000 Wait PackInst:StopProgram 'Downloading OS default parameters ...' log DefaultParFile dup loadobj exch PackInst:DownloadGR3File 'Resetting Device...' log ResetDevice 1000 Wait ] % E1100 $20 [B ResetDevice 15000 wait ResetDevice 1000 wait PackInst:StopProgram 'Erasing OS firmware sector...' log $10000 PackInst:EraseFlash $30000 PackInst:EraseFlash $40000 PackInst:EraseFlash $D0000 PackInst:EraseFlash $E0000 PackInst:EraseFlash $F0000 PackInst:EraseFlash 'Downloading OS...' log SWFile dup loadobj exch PackInst:DownloadHX2File 'Resetting Device...'log ResetDevice 15000 Wait 'Starting OS...' log $10000 StartProgram 'Waiting for OS reply...' log [B 2000 Wait 0 ReadMemory 0 eq [B '...OS started...' log exitloop ] if ] loop 'Waiting until OS is ready...' log 5000 wait [B 2000 Wait $A2FE ReadMemory 0 eq [B '...OS is ready' log exitloop ] if ] loop 'Erasing OS parameter sector...' log $C0000 PackInst:EraseFlash 'Downloading OS parameter tree...' log TreeFile dup loadobj exch PackInst:DownloadHX2File ResetDevice 8000 Wait 'Downloading OS default parameters ...' log DefaultParFile dup loadobj exch PackInst:DownloadGR3File 'Resetting Device...' log ResetDevice [B 3000 Wait $A2FE ReadMemory 0 eq [B '...OS is ready' log exitloop ] if ] loop ] ] [B % ] case ] if [A /MissingFile /Result] ] ]