HI, i want to set program counter (PC register) to a given value.
I guess this can be done using the rreg/wreg commands, but i don't know the register-number to enter.
Solved! Go to Solution.
For some reason i do not understand, i found out that PC is register number "3", so
wreg 3 0x8000
did the job
% wreg 3 0x8000
:wReg r=0x3(PC)<-0x00008000
For some reason i do not understand, i found out that PC is register number "3", so
wreg 3 0x8000
did the job
% wreg 3 0x8000
:wReg r=0x3(PC)<-0x00008000
UsbdmScript uses internal register numbers defined in:
https://github.com/podonoghue/usbdm-eclipse-makefiles-build/blob/master/Shared/src/USBDM_API.h
There are also some special commands such as wpc.
wc <value> - Write control register
wpc <value> - Write to PC
wreg <regNo><value> - Write core register
wdreg <regNo><value> - Write debug register
wcreg <regNo><value> - Write control register
Registers vary by target type
You can use the following to give names to registers (HCS12 example):
proc hcs12regs { } {
set PC 3 ;# PC reg
set D 4 ;# D reg
set X 5 ;# X reg
set Y 6 ;# Y reg
set SP 7 ;# SP reg
set CCR 0x80 ;# CCR reg - redirected to USBDM_ReadDReg()
return
}
You can then add the above to usbdm_rc.tcl. Then commands will be more readable:
hcs12regs ;# once only or add to usbdm_rc.tcl if this is the only target you use.
...
wreg $Y 100
bye
Veeery cool! This is an extremely good tool, i used it a lot. Also many thanks for the new, advanced GUI and the option to also read back EEPROM pages, save/load setup and more address-fields, that was really missing
Maybe you could also add a setting to access paged RAM?
I also wonder why the "regs" command of usbdmscript does not tell CCR flags, this would be very helpfull for branch commands an such.
Hi,
It would probably be sensible to add CCR to regs for HCS12. The only reason it wasn't is that the CCR is accessed differently to the other registers in the BDM interface.
You can read the CCR by either:
rreg 0x80 ;# it reports unknown register but it gives the correct value (same as below command).
rdreg 0xff06 ;# this is a special debug command to access the temporary register containing the CCR value.