📄 9s08 rc rd re rg 60.loa
字号:
;----------------------------------------------------
;LOADER 9S08 RC RD RE RG 60 - command file
;(c) 2005-2006 Ing. Dubatti www.ingdubatti.com.ar
; Special thanks to David Payne
;----------------------------------------------------
;Command list:
; M: FLASH memory description: erased cell value and valid addresses
; format: "M:hh,FLASH range;CPU vectors range;RAM range"
; Range in the form: ffff-tttt[,ffff-tttt[,....]]
; hh=erased cell value
; ffff-tttt='from'-'to'
; P: FLASH protection address / value
; format: "P:hhhh,aaoo,aaoo" hhhh=address aa=AND oo=OR
; the first 'aaoo' value is for 'protection'
; the second is for 'unprotected'
; L: Number of bytes to write (used in [WRITE] section)
; format: "L:16"
; ?E: If command "?" fails, print a message and end the script
; S: Show status information
; T: Send all characters until the comma, wait for individual echo
; t: Send all characters until the comma (same as "T" but without waiting for echo)
; b: Send all characters until the comma in BINARY mode (2 digits => 1 byte)
; w: Wait for all characters (100msec maximum for each).
; W: Same as "w" but giving the timeout in 100msec units.
; ?: Wait for next character (same as "W"). The character is preserved.
; r: Read a number of characters and put them in a variable.
; R: Same as "r" but in BINARY mode (every byte is expanded as 2 hexadecimal digits)
; V: Send a variable value waiting for individual echo
; B: Send a variable value (without waiting for echo) in BINARY mode.
; C: Check a variable agains a mask and value pair; not equal means error
; format: "CE:VAR,MASK,VALUE,ERROR"
; I: Print an "interpretation" of a variable value.
; format: "I:VAR"
; c: Set checksum to 0
;debug+ Show executed commands in the status window
;debug- End debug+
;txrx+ Show bytes sent [..] and received <..> in the status window
;txrx- End txrx+
;
;Variables:
; BDMFREC = BDM frequency (delay measured by POD)
; (setting this var, sets FCDIV value also)
; BDCSCR = BDM status/control register
; FOPT = Security control register
; SDIDH = Processor ID register
; SDIDL = Processor ID register
; SDID = Processor ID register (SDIDH+SDIDL)
; FCDIV = FLASH controller frequency
; FSTAT = FLASH controller status
; FSTAT.BLANK = Erased: YES or NO
; ADDRESS = Address used to read/write FLASH memory (4 hex digits)
; DATA = Data used to read/write FLASH memory (2*N-bytes hex digits)
; CHKSUM = checksum in S19 format (2 hex digits)
; X, Y, Z = temporary vars
; REGA = CPU register: A
; REGCC = CPU register: CC
; REGHX = CPU register: HX
; REGPC = CPU register: PC
; REGSP = CPU register: SP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[INIT]
;---initialisation for all commands---
S:Script: 9S08 RC RD RE RG 60.LOA (c) 2005-2006 Ing. Dubatti\n\n
;---FLASH description---
;---erased cell value,FLASH range;CPU vectors range;RAM range---
M:ff,0846-17ff,182c-ffff;ffe0-ffff;0046-0845
;---To Protect/Unprotect change NVOPT=$FFBF---
;---xxxxxx11=> protected xxxxxx10=> unprotected---
P:ffbf,ff03,fe02
S:POD software version..............
TE: ,Invalid or no response. Check POD power.
wE:?,Invalid response. Check POD power.
TE:v,Error determining POD version. Check POD power.
rE:2,X,Error determining POD version.
I:X
S:\n
wE:\n,Error determining POD version.
CE:X,ff,02,This script needs POD version '02'
S:BDM frequency (bus frequency).....
;---HARD SYNC---
TE:h,No HARD SYNC response received.\nCheck target CPU power.
;---wait 2 seconds maximum for SYNC response---
?E:20,No HARD SYNC response received.\nCheck target CPU power.
rE:4,BDMFREC,No HARD SYNC response received.\nCheck target CPU power.
wE:\n,Invalid HARD SYNC response received.\nCheck target CPU power.
I:BDMFREC
;---reading BDMFREC sets FCDIV---
;---entering active debug mode---
S:\nBDM Status........................
TE:a,Echo not received entering active debug mode
wE:\n,Invalid response received entering active debug mode
TE:s,Echo not received reading BDM status
rE:2,BDCSCR,Invalid response received reading BDM status
wE:\n,Invalid response received reading BDM status
S:BDCSCR=
I:BDCSCR
S:\nFLASH controller frequency........
TE:W1820,Error adjusting FLASH controller frequency
VE:FCDIV,Error adjusting FLASH controller frequency
wE:\n,Error adjusting FLASH controller frequency
;---re-read controller value---
TE:D1820,Error reading FLASH controller frequency
rE:2,FCDIV,Error reading FLASH controller frequency
wE:\n,Error reading FLASH controller frequency
S:FCDIV=
I:FCDIV
;---change clock source (use internal oscillator)---
S:\nBDM Frequency (BDM oscillator)....
TE:c,No response received after changing BDM clock source.
;---wait 2 seconds maximum for SYNC response---
?E:20,No response received after changing BDM clock source.
rE:4,BDMFREC,No response received after changing BDM clock source.
wE:\n,No response received after changing BDM clock source.
I:BDMFREC
;---WARNING: BDMFREC equal BDM oscillator freq so FCDIV value is invalid---
S:\n\n
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[UNLOCK]
;---check if the processor is erased (if so, protection will be deactivated)---
S:FLASH memory is erased............
TE:W1824f8,Error unprotecting FLASH (FPROT)
wE:\n,Error unprotecting FLASH (FPROT)
TE:Wfff000,Error latching address in FLASH to check if erased
wE:\n,Error latching address in FLASH to check if erased
TE:W182605,Error sending command to check if erased
wE:\n,Error sending command to check if erased
TE:W182580,Error executing command to check if erased
wE:\n,Error executing command to check if erased
;---wait 100 miliseconds for command completion---
W:1,.
TE:D1825,Error reading FLASH controller status: FSTAT ($1825)
rE:2,FSTAT,Error reading FLASH controller status: FSTAT ($1825)
wE:\n,Error reading FLASH controller status: FSTAT ($1825)
I:FSTAT.BLANK
;---is protected?---
S:\nSecurity..........................
TE:D1821,Error determining if processor is protected: FOPT ($1821)
rE:2,FOPT,Error determining if processor is protected: FOPT ($1821)
wE:\n,Error determining if processor is protected: FOPT ($1821)
S:FOPT=
I:FOPT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[INFO]
;---Show processor additional information---
S:\nProcessor ID......................
TE:D1806,Error reading processor ID: SDIDH ($1806)
rE:2,SDIDH,Error reading processor ID: SDIDH ($1806)
wE:\n,Error reading processor ID: SDIDH ($1806)
TE:D1807,Error reading processor ID: SDIDL ($1807)
rE:2,SDIDL,Error reading processor ID: SDIDL ($1807)
wE:\n,Error reading processor ID: SDIDL ($1807)
S:SDID=
I:SDID
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[ERASE]
;---Mass erase FLASH memory---
S:Mass erase........................
TE:Wfff000,Error latching address in FLASH to mass erase it
wE:\n,Error latching address in FLASH to mass erase it
TE:W182641,Error sending command to mass erase
wE:\n,Error sending command to mass erase
TE:W182580,Error executing command: mass erase
wE:\n,Error executing command: mass erase
;---wait 300 miliseconds for command completion (maximum= 20kcycles @150kHz)
W:3,.
S:OK\n
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[SAVE]
;---save the S19 file in processor's FLASH---
;---check if it's protected---
CE:FOPT,03,02,The processor is protected. You must do a mass erase before writing.
S:Writing the S19 file in FLASH.....\n
;---Load code in RAM to save 16 bytes at once---
;---LoadS08.S19 (replace "S1..." for "bE:80...,Error"
bE:8013008020FE6E30FC45010235FE320100F6C71831,Error loading save code in RAM at 0080
wE:.,Error loading save code in RAM at 0080
bE:801300900055FEF1272CF641FF28B7FD320100F789,Error loading save code in RAM at 0090
wE:.,Error loading save code in RAM at 0090
bE:801300A0A620C71826A680C7182521FE21FEC6183B,Error loading save code in RAM at 00A0
wE:.,Error loading save code in RAM at 00A0
bE:801300B025A47027F94140043CFC2006F631FD02DA,Error loading save code in RAM at 00B0
wE:.,Error loading save code in RAM at 00B0
bE:801300C03CFC320100AF019601003CFFB6FFA112D7,Error loading save code in RAM at 00C0
wE:.,Error loading save code in RAM at 00C0
bE:800900D026BBB6FC20AAC9,Error loading save code in RAM at 00D0
wE:.,Error loading save code in RAM at 00D0
;---save 16 bytes at once---
L:16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[WRITE]
;---save 16 bytes from "DATA" in address "ADDRESS" in FLASH---
;---called by [SAVE]---
bE:80,Error loading in RAM data to save in FLASH
;set "CHKSUM" variable to 0
c:
bE:150100,Error loading in RAM data to save in FLASH
BE:ADDRESS,Error loading in RAM data to save in FLASH
BE:DATA,Error loading in RAM data to save in FLASH
BE:CHKSUM,Error loading in RAM data to save in FLASH
;---"." means checksum was verified, "?" means error
wE:.,Error loading in RAM data to save in FLASH
bE:AA,Error loading in RAM data to save in FLASH
wE:0,There was an error writing FLASH memory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[VERIFY]
;---check S19 file against processor's FLASH---
;---check if it's protected---
CE:FOPT,03,02,The processor is protected. You can't verify it.
S:Checking S19 file against processor's FLASH...\n
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[DUMP]
;---dump processor's memory---
;---check if it's protected---
CE:FOPT,03,02,\nThe processor is protected. You can't read it.
S:Reading processor's FLASH...\n
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[READ]
;---read 16 bytes from FLASH address "ADDRESS" in variable "DATA"---
;---called by [DUMP], [VERIFY] y [DEBUG]---
bE:90,Error reading FLASH memory
BE:ADDRESS,Error reading FLASH memory
RE:16,DATA,Error reading FLASH memory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[DEBUG]
;---Enter debug mode from reset---
;---check if it's protected---
CE:FOPT,03,02,\nThe processor is protected. You can't debug it.
S:\n<Debugger>\n
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[LOADREG]
;---read processor's registers---
;---read format "a:00 c:68 h:0000 p:F93B s:00FF b:0000 " (breakpoint is discarded)
;---called by [DEBUG] ---
TE:r,Error reading processor's registers
wE:a:,Error reading processor's registers
rE:2,REGA,Error reading processor's registers
wE: c:,Error reading processor's registers
rE:2,REGCC,Error reading processor's registers
wE: h:,Error reading processor's registers
rE:4,REGHX,Error reading processor's registers
wE: p:,Error reading processor's registers
rE:4,REGPC,Error reading processor's registers
wE: s:,Error reading processor's registers
rE:4,REGSP,Error reading processor's registers
wE: b:,Error reading processor's registers
rE:4,X,Error reading processor's registers
wE: \n,Error reading processor's registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[SAVEREG]
;---Modify processor's registers---
;---called by [DEBUG] ---
TE:ma,Error changing processor's registers
VE:REGA,Error changing processor's registers
wE:\n,Error changing processor's registers
TE:mc,Error changing processor's registers
VE:REGCC,Error changing processor's registers
wE:\n,Error changing processor's registers
TE:mh,Error changing processor's registers
VE:REGHX,Error changing processor's registers
wE:\n,Error changing processor's registers
TE:mp,Error changing processor's registers
VE:REGPC,Error changing processor's registers
wE:\n,Error changing processor's registers
TE:ms,Error changing processor's registers
VE:REGSP,Error changing processor's registers
wE:\n,Error changing processor's registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[MODIFY]
;---Change byte value in "ADDRESS" to "DATA" (RAM or register) ---
;---called by [DEBUG] ---
TE:W,Error changing data in memory
VE:ADDRESS,Error changing data in memory
VE:DATA,Error changing data in memory
wE:\n,Error changing data in memory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[STEP]
;---advance to next CPU opcode and read registers---
;---called by [DEBUG] ---
TE:t,Error trying to execute the current opcode
wE:a:,Error trying to execute the current opcode
rE:2,REGA,Error reading processor's registers
wE: c:,Error reading processor's registers
rE:2,REGCC,Error reading processor's registers
wE: h:,Error reading processor's registers
rE:4,REGHX,Error reading processor's registers
wE: p:,Error reading processor's registers
rE:4,REGPC,Error reading processor's registers
wE: s:,Error reading processor's registers
rE:4,REGSP,Error reading processor's registers
wE: b:,Error reading processor's registers
rE:4,X,Error reading processor's registers
wE: \n,Error reading processor's registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[RUN]
;---Run program from actual PC---
;---called by [DEBUG] ---
TE:g,Error trying to run
wE:\n,Error trying to run
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[ISRUNNING]
;---still running?---
;--read BDCSCR.BDMACT 0=>"user mode"="running" 1=>"debug mode"--
;---called by [DEBUG] ---
TE:s,Error determining if processor is running
rE:2,X,Error determining if processor is running
wE:\n,Error determining if processor is running
;OK => is running: set a flag
C:X,40,00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BREAKON]
;---set a breakpoint in address "ADDRESS"---
;---called by [DEBUG] ---
TE:mb,Error setting breakpoint
VE:ADDRESS,Error setting breakpoint
wE:\n,Error setting breakpoint
TE:b,Error activating the breakpoint
wE:\n,Error activating the breakpoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BREAKOFF]
;---turn off breakpoint---
;---called by [DEBUG] ---
TE:B,Error turning off the breakpoint
wE:\n,Error turning off the breakpoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[PAUSE]
;---stop execution---
;---called by [DEBUG] ---
TE:a,Error returning to active debug mode
wE:\n,Error returning to active debug mode
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -