; -------------------------------------------------------------------------------- ; @Title: Script for updating the firmware of a PowerDebug module ; @Description: Updates the firmware ; @Keywords: debugger, firmware, ICD, PowerDebug, update ; @Author: HLG ; @Board: PowerDebug USB; PowerDebug USB 2.0; PowerDebug USB 3.0 ; PowerDebug-II; PowerDebug Ethernet; PowerTrace; uTRACE ; PowerDebug PRO ; @Copyright: (C) 1989-2021 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Id: icd_firmwareupdate.cmm 20973 2023-06-07 06:52:54Z msandner $ PRIVATE &action ENTRY &action IF "&action"!="UPDATE" ( IF VERSION.BUILD.BASE()>=144507. ( IF ID.PODBUSDEVICE(0.)==0x40||ID.PODBUSDEVICE(0.)==0x41 ( ; 5th-generation PowerDebug: Use separate script DO ~~~~/icd_firmware5.cmx ENDDO ) ) PRIVATE &ppf &ppf=OS.PPF() DIALOG.view (&+ HEADER "Firmware Update" ICON ":config" HELP "__SUPPORT_REPS_" POS 0. 0. 58. 11. BOX "" POS 1. 1. 55. 1. TEXT "This will update the firmware of your" TEXT "PowerDebug module." TEXT "The device must be connected via USB or Ethernet." POS 1. 4.5 55. 1. TEXT "Although every firmware image is tested carefully" TEXT "a firmware update is on your own risk." POS 1. 7.5 55. 1. LTEXT "Ensure that your device remains powered" LTEXT "during the configuration!" POS 13. 11. 12. 1. OK_BUTTON: BUTTON "Update Firmware" "DO ""&ppf"" UPDATE" POS 33. 11. 12. 1. CANCEL_BUTTON: DEFBUTTON "Cancel" "DIALOG.END" ) ENDDO ) DIALOG.END PRIVATE &progfile &pbid &progfile="~~~~/icd_firmware1.bin" IF (SYSTEM.USEMASK()&1)==0 ( DIALOG.OK "Sorry, you must run this script inside the TRACE32 GUI connected to the" "first debug module of you PodBus chain to update its Firmware." ENDDO ) IF VERSION.BUILD()>13872. ( IF scu() GOTO unsupported ) IF FIRE() ( GOTO unsupported ) IF !(ICD()&&POWERDEBUG()) ( GOTO unsupported ) &pbid=BUS_PBREAD(0x7FFF0000); IF (&pbid==0x27) &progfile="~~~~/icd_firmware2.bin" ELSE IF ((&pbid==0x28)||(&pbid==0x29)||(&pbid==0x2b)) &progfile="~~~~/icd_firmware3.bin" ELSE IF (&pbid==0x2a)||(&pbid==0x2d) &progfile="~~~~/icd_firmware4.bin" ELSE IF (&pbid!=0x23)&&(&pbid!=0x25)&&(&pbid!=0x26) GOTO unsupported IF !OS.FILE("&progfile") ( &progfile=STRing.CUT("&progfile",5.) DIALOG.OK "Can't find programming file '&progfile'." ENDDO ) IF VERSION.BUILD()<7436. ( DIALOG.OK "Sorry, your TRACE32 software is too old." "Please Update t32m***.exe and fcc.t32 first." ENDDO ) ON ERROR GOTO ( AREA.view IF VERSION.BUILD()>13872. DIALOG.OK "Firmware update failed!" ELSE DIALOG.OK "Firmware update failed!" "" "Do you use a PodBus Ethernet Controller?" "This Firmware Update cannot be used together with a PodBus Ethernet Controller." ENDDO ) flashprog 3 0 "&progfile" IF DIAG.VALUE(1)==2 ( PRIVATE &result DIALOG.YESNO "Current firmware looks newer than the one you want to program." "Continue anyway?" ENTRY &result IF !&result ENDDO flashprog 1 0 "&progfile" ) IF DIAG.VALUE(1)==0 ( WinCLEAR VERSION.HARDWARE DIALOG.OK "Firmware update successful." "" "Please restart your debugger." ) ELSE ( AREA.view DIALOG.OK "Firmware update failed!" ) ENDDO unsupported: DIALOG.OK "Sorry, this Firmware Update is for a PowerDebug module" "directly connected via USB or Ethernet only." ENDDO