Rocket - debug - Example: Read Memory

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rocket - debug - Example: Read Memory相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e5%a4%a7%e5%b0%8f' title='澶у皬'>澶у皬   鏍煎紡   get   杩斿洖   Once   gis   cpi   opera   adb   

https://mp.weixin.qq.com/s/ChXNTbx94WDC72GvmE9bGA

 

浠嬬粛riscv-debug鐨勪娇鐢ㄥ疄渚嬶細浣跨敤涓夌鏂规硶璇诲彇鍐呭瓨銆?/p>

 

1. Using System Bus Access

 

鎶€鏈浘鐗? src=

 

1) System Bus Access

 

闄や簡鎶借薄鍛戒护锛孭rogram Buffer涔嬪锛岃皟璇曟ā鍧楀彲浠ュ寘鍚竴涓郴缁熸€荤嚎璁块棶妯″潡锛屼互鍦ㄤ笉渚濊禆鏍稿績鐨勬儏鍐典笅锛岃闂郴缁熸€荤嚎锛堜娇鐢ㄧ墿鐞嗗湴鍧€锛夛細

鎶€鏈浘鐗? src=

 

璁块棶澶у皬鍙互鏄?/16/32/64/128浣嶏細

鎶€鏈浘鐗? src=

 

闇€瑕佽嚜宸变繚璇佽闂殑缂撳瓨涓€鑷存€э細

鎶€鏈浘鐗? src=

 

2) sbcs/sbaddress/sbdata

 

a. sbcs

 

鐢ㄤ簬鎺у埗绯荤粺鎬荤嚎璁块棶锛屼互鍙婅幏鍙栬闂姸鎬侊細

鎶€鏈浘鐗? src=

b. sbaddress0..3

 

瀛樺偍瑕佽闂殑绯荤粺鎬荤嚎鐗╃悊鍦板潃銆?/p>

 

鍐檚baddress瀵勫瓨鍣ㄥ彲鑳借Е鍙戝璇ュ湴鍧€鐨勮鎿嶄綔锛?/p>

鎶€鏈浘鐗? src=

 

c. sbdata0..3

 

淇濆瓨璇诲彇鍜岃鍐欏叆鐨勬暟鎹€?/p>

 

璇籹bdata0瀵勫瓨鍣ㄥ彲鑳借Е鍙戠郴缁熸€荤嚎鐨勮鎿嶄綔锛?/p>

鎶€鏈浘鐗? src=

 

鍐檚bdata0瀵勫瓨鍣ㄥ彲鑳借Е鍙戠郴缁熸€荤嚎鐨勫啓鎿嶄綔锛?/p>

鎶€鏈浘鐗? src=

 

3) 瀹炰緥锛歊ead a word from memory

 

鎶€鏈浘鐗? src=

A. 鍐檚bcs瀵勫瓨鍣細

a. sbaccess=2锛氳闂ぇ灏忎负32bit锛?/p>

b. sbreadonaddr=1锛歟very write to sbaddress0 automatically triggers a system bus read at the new address.

 

B. 鍐檚baddress0瀵勫瓨鍣細鍐欏叆瑕佽闂殑鍐呭瓨鐗╃悊鍦板潃锛涚敱浜嶢涓妸sbreadonaddr缃綅锛屾墍浠ヨ繖涓€姝ュ啓sbaddress0瀵勫瓨鍣ㄤ細瑙﹀彂瀵瑰垰鍐欏叆鐨勮繖涓唴瀛樺湴鍧€鐨勮鎿嶄綔锛岃鍙栫殑鍐呭瀛樻斁鍦╯bdata0瀵勫瓨鍣ㄤ腑锛?/p>

 

C. 璇籹bdata0瀵勫瓨鍣紝鑾峰彇鐩爣鍐呭瓨鍦板潃澶勭殑鍐呭锛?/p>

 

4) 瀹炰緥锛歊ead block of memory

 

鎶€鏈浘鐗? src=

A. 鍐檚bcs瀵勫瓨鍣細

a. sbaccess=2锛氳闂ぇ灏忎负32bit锛?/p>

b. sbreadonaddr=1锛歟very write to sbaddress0 automatically triggers a system bus read at the new address.

c. sbreadondata=1锛歟very read from sbdata0 automatically triggers a system bus read at the (possibly auto-incremented) address.

d. sbautoincrement=1锛歴baddress is incremented by the access size (in bytes) selected in sbaccess after every system bus access.

 

B. 鍐檚baddress0瀵勫瓨鍣細鍐欏叆瑕佽鍙栫殑鍐呭瓨鐨勭墿鐞嗗湴鍧€锛涜繖涓啓鍏ュ姩浣滀細瑙﹀彂閽堝鐩爣鍦板潃鐨勮鍙栨搷浣滐紝璇诲彇鐨勫唴瀹瑰瓨鏀惧湪sbdata0瀵勫瓨鍣紱璇诲彇涔嬪悗sbaddress0涓殑鍐呭瓨鍦板潃鑷姩澧炲姞4涓瓧鑺傦紱

 

C. 璇籹bdata0瀵勫瓨鍣細璇诲彇鐩爣鍦板潃澶勭殑鍐呭锛涜繖涓鍙栧姩浣滀細瑙﹀彂閽堝sbaddress0涓湴鍧€鐨勮鍙栧姩浣滐紝璇诲彇鐨勫唴瀹瑰瓨鏀惧湪sbdata0瀵勫瓨鍣ㄤ腑锛岃鍙栦箣鍚巗baddress0涓殑鍐呭瓨鍦板潃鑷姩澧炲姞4涓瓧鑺傦紱

 

D. 杩炵画璇诲彇sbdata0瀵勫瓨鍣紝浠ヨ幏鍙栫洰鏍囧唴瀛樺湴鍧€鐨勫唴瀹癸紱

 

E. 鍐檚bcs瀵勫瓨鍣細sbcs=0锛屼害鍗硈breadondata=0锛屼笅涓€娆¤鍙杝bdata0鏃讹紝涓嶄細鍐嶅嚭鍙戦拡瀵箂baddress0涓湴鍧€鐨勮鍙栧姩浣滐紱

 

F. 璇籹bdata0瀵勫瓨鍣細鑾峰彇鏈€鍚庝竴涓渶瑕佺殑鍐呭瓨鏁版嵁锛?/p>

 

2. Using Program Buffer

 

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

 

1) abstractauto

 

鐢ㄤ簬瑙﹀彂鎶借薄鍛戒护鑷姩鎵ц鐨勯厤缃瘎瀛樺櫒锛屼袱绉嶈Е鍙戞柟寮忓強閰嶇疆锛?/p>

a. 淇敼Program Buffer锛?/p>

b. 璇诲彇sbdata瀵勫瓨鍣紱

鎶€鏈浘鐗? src=

 

2) 瀹炰緥锛歊ead a word from memory

 

鎶€鏈浘鐗? src=

A. 鍑嗗Program Buffer锛?/p>

a. 鍐檖rogbuf0涓烘寚浠わ細lw s0 0(s0)锛屽嵆璇诲彇s0涓湴鍧€鐨勫唴瀹癸紝瀛樺叆s0涓紱

b. 鍐檖rogbuf1涓烘寚浠わ細ebreak锛屽嵆鍋滄鎵ц锛岃繑鍥炶皟璇曠幆澧冿紱

 

B. 鍐檇ata0瀵勫瓨鍣細瀛樺叆瑕佽鍙栫殑鐩爣鍐呭瓨鍦板潃锛?/p>

 

C. 鍐檆ommand瀵勫瓨鍣細鍐欏叆瑕佹墽琛岀殑鎶借薄鍛戒护锛?/p>

a. regno=0x1008锛氬嵆璁块棶鐨勫璞″瘎瀛樺櫒涓簊0锛?/p>

b. write=1锛氳闂搷浣滀负鍐欐搷浣滐紝鍗虫妸sbdata0瀵勫瓨鍣ㄤ腑鐨勬暟鎹啓鍏ュ埌瀵勫瓨鍣╯0涓紱

c. postexec=1锛欵xecute the program in the Program Buffer exactly once after performing the transfer, if any.

 

D. 鍐檆ommand瀵勫瓨鍣細鍐欏叆瑕佹墽琛岀殑鎶借薄鍛戒护锛?/p>

a. regno=0x1008锛氬嵆璁块棶鐨勫璞″瘎瀛樺櫒涓簊0锛?/p>

b. (琛?transfer=1锛欴o the operation specied by write锛?/p>

c. write=0锛氬嵆璁块棶鎿嶄綔涓鸿鎿嶄綔锛汣opy data from the specified register into arg0 portion of data锛?/p>

 

E. 璇籨ata0瀵勫瓨鍣細璇诲彇浠巗0鎷疯礉杩囨潵鐨勬暟鎹紝鍗崇洰鏍囧唴瀛樺湴鍧€澶勭殑鍐呭锛?/p>

 

3) 瀹炰緥锛歊ead block of memory

 

鎶€鏈浘鐗? src=

A. 鍑嗗Program Buffer锛?/p>

a. 鍐檖rogbuf0涓烘寚浠わ細lw s1, 0(s0)锛屽嵆璇诲彇s0涓湴鍧€鐨勫唴瀹癸紝瀛樺叆s1涓紱

b. 鍐檖rogbuf1涓烘寚浠わ細addi s0, s0, 4锛屽嵆鍦板潃澧炲姞4锛?/p>

c. 鍐檖rogbuf2涓烘寚浠わ細ebreak锛屽嵆鍋滄鎵ц锛岃繑鍥炶皟璇曠幆澧冿紱

 

B. 鍐檇ata0瀵勫瓨鍣細鍐欏叆鐩爣鍐呭瓨璧峰鍦板潃锛?/p>

C. 鍐檆ommand瀵勫瓨鍣細鍐欏叆瑕佹墽琛岀殑鎶借薄鍛戒护锛?/p>

a. regno=0x1008锛氬嵆璁块棶鐨勫璞″瘎瀛樺櫒涓簊0锛?/p>

b. write=1锛氳闂搷浣滀负鍐欐搷浣滐紝鍗虫妸sbdata0瀵勫瓨鍣ㄤ腑鐨勬暟鎹啓鍏ュ埌瀵勫瓨鍣╯0涓紱

c. postexec=1锛欵xecute the program in the Program Buffer exactly once after performing the transfer, if any.

 

璇ュ懡浠ょ殑鏁堟灉濡備笅锛?/p>

a. 鎶奷ata0涓殑鐩爣鍐呭瓨鍦板潃锛屽啓鍏ュ埌s0瀵勫瓨鍣紱

b. 瑙﹀彂Program Buffer鎵ц锛?/p>

 

D. 鍐檆ommand瀵勫瓨鍣細鍐欏叆瑕佹墽琛岀殑鎶借薄鍛戒护锛?/p>

a. regno=0x1009锛氬嵆璁块棶鐨勫璞″瘎瀛樺櫒涓簊1锛?/p>

b. (琛?transfer=1锛欴o the operation specied by write锛?/p>

c. write=0锛氬嵆璁块棶鎿嶄綔涓鸿鎿嶄綔锛汣opy data from the specified register into arg0 portion of data锛?/p>

d. postexec=1锛欵xecute the program in the Program Buffer exactly once after performing the transfer, if any.

 

璇ュ懡浠ょ殑鏁堟灉濡備笅锛?/p>

a. 鎶妔1鐨勫€艰鍏ata0瀵勫瓨鍣紱

b. 瑙﹀彂Program Buffer鎵ц锛?/p>

 

E. 鍐檃bstractauto瀵勫瓨鍣細

a. autoexecdata=1锛歳ead or write accesses to the corresponding data word cause the command in command to be executed again.

 

鏁堟灉鏄細姣忔璇诲啓data0瀵勫瓨鍣ㄩ兘浼氳Е鍙慏涓懡浠ょ殑鎵ц锛?/p>

 

F. 璇籨ata0瀵勫瓨鍣細

a. 鑾峰彇鐩爣鍐呭瓨鍦板潃澶勭殑鍊硷紱

b. 瑙﹀彂鎶借薄鍛戒护鐨勬墽琛岋細鎶妔1鐨勫€艰鍏ata0瀵勫瓨鍣?

c. 瑙﹀彂Program Buffer鎵ц锛氳鍙杝0涓湴鍧€鐨勫唴瀹瑰苟鍐欏叆s1锛宻0涓殑鍦板潃鍔?锛?/p>

 

G. 璇籨ata0瀵勫瓨鍣細瑙﹀彂杩炵画璇诲彇锛?/p>

 

H. 鍐檃bstractauto瀵勫瓨鍣細

a. autoexecdata=0锛氳鍙杁ata0瀵勫瓨鍣紝涓嶄細瑙﹀彂鎶借薄鍛戒护鐨勬墽琛岋紱

 

I. 璇籨ata0瀵勫瓨鍣細鑾峰彇鏈€鍚庝竴涓暟鎹紱

 

3. Using Abstract Memory Access

 

鎶€鏈浘鐗? src=

 

1) Access Memory

 

鎶借薄鍛戒护鐨勪竴绉嶏細

鎶€鏈浘鐗? src=

 

鍏舵牸寮忓涓嬶細

鎶€鏈浘鐗? src=

鍏朵腑锛?/p>

aam鍓嶇紑鐨勬剰涔夋槸锛欰bstract command Access Memory锛涚浉杈冧箣涓嬶紝

aar鍓嶇紑鐨勬剰涔夋槸锛欰bstract command Access Register锛?/p>

 

2) 瀹炰緥锛歊ead a word from memory

 

鎶€鏈浘鐗? src=

A. 鍐檇ata1瀵勫瓨鍣細瀛樺叆鐩爣鍐呭瓨鍦板潃锛?/p>

B. 鍐檆ommand瀵勫瓨鍣細瀛樺叆瑕佹墽琛岀殑鎶借薄鍛戒护锛?/p>

a. cmdtype=2锛氳〃绀哄懡浠ょ殑绫诲瀷涓篈ccess Memory锛?/p>

b. aamsize=2锛欰ccess the lowest 32 bits of the memory location.

c. aamvirtual=0锛欰ddresses are physical (to the hart they are performed on).

d. write=0锛欳opy data from the memory location specified in arg1 into arg0 portion of data.

 

杩欐潯鍛戒护鐨勬晥鏋滄槸锛氳鍙杁ata1涓湴鍧€鐨勫唴瀹癸紝骞跺瓨鍏ata0瀵勫瓨鍣紱

 

C. 璇籨ata0瀵勫瓨鍣細鑾峰彇浠庡唴瀛樺湴鍧€涓鍒扮殑鍐呭锛?/p>

 

3) 瀹炰緥锛歊ead block of memory

 

鎶€鏈浘鐗? src=

杩欓噷鍙粙缁嶈鐐癸細

a. abstractauto=1锛氳鍙杁ata0瀵勫瓨鍣ㄥ悗锛岃Е鍙戞娊璞″懡浠ゆ墽琛岋紱

b. aampostincrement=1锛欰fter a memory access has completed, if this bit is 1, increment arg1 (which contains the address used) by the number of bytes encoded in aamsize. 鍗虫瘡娆¤鍙栧唴瀛樹箣鍚庯紝閮芥妸鐩爣鍐呭瓨鍦板潃鍔?锛屽嵆data1瀵勫瓨鍣ㄧ殑鍊煎姞4锛?/p>

 

以上是关于Rocket - debug - Example: Read Memory的主要内容,如果未能解决你的问题,请参考以下文章

Rocket - debug - Example: Read Memory

Rocket - debug - Periphery

Rocket - debug - TLDebugModuleOuter

Rocket - debug - DebugTransport

Rocket - debug - Custom

Rocket - debug - DebugCustomXbar