How to set PC using usbdmscript.exe ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to set PC using usbdmscript.exe ?

跳至解决方案
3,060 次查看
Mindblaster
Contributor III

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.

 

0 项奖励
1 解答
3,047 次查看
Mindblaster
Contributor III

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

在原帖中查看解决方案

0 项奖励
4 回复数
3,048 次查看
Mindblaster
Contributor III

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
0 项奖励
3,021 次查看
pgo
Senior Contributor V

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

0 项奖励
3,005 次查看
Mindblaster
Contributor III

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.

0 项奖励
2,996 次查看
pgo
Senior Contributor V

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.

 

0 项奖励