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 adbhttps://mp.weixin.qq.com/s/ChXNTbx94WDC72GvmE9bGA
浠嬬粛riscv-debug鐨勪娇鐢ㄥ疄渚嬶細浣跨敤涓夌鏂规硶璇诲彇鍐呭瓨銆?/p>
1. Using System Bus Access
1) System Bus Access
闄や簡鎶借薄鍛戒护锛孭rogram Buffer涔嬪锛岃皟璇曟ā鍧楀彲浠ュ寘鍚竴涓郴缁熸€荤嚎璁块棶妯″潡锛屼互鍦ㄤ笉渚濊禆鏍稿績鐨勬儏鍐典笅锛岃闂郴缁熸€荤嚎锛堜娇鐢ㄧ墿鐞嗗湴鍧€锛夛細
璁块棶澶у皬鍙互鏄?/16/32/64/128浣嶏細
闇€瑕佽嚜宸变繚璇佽闂殑缂撳瓨涓€鑷存€э細
2) sbcs/sbaddress/sbdata
a. sbcs
鐢ㄤ簬鎺у埗绯荤粺鎬荤嚎璁块棶锛屼互鍙婅幏鍙栬闂姸鎬侊細
b. sbaddress0..3
瀛樺偍瑕佽闂殑绯荤粺鎬荤嚎鐗╃悊鍦板潃銆?/p>
鍐檚baddress瀵勫瓨鍣ㄥ彲鑳借Е鍙戝璇ュ湴鍧€鐨勮鎿嶄綔锛?/p>
c. sbdata0..3
淇濆瓨璇诲彇鍜岃鍐欏叆鐨勬暟鎹€?/p>
璇籹bdata0瀵勫瓨鍣ㄥ彲鑳借Е鍙戠郴缁熸€荤嚎鐨勮鎿嶄綔锛?/p>
鍐檚bdata0瀵勫瓨鍣ㄥ彲鑳借Е鍙戠郴缁熸€荤嚎鐨勫啓鎿嶄綔锛?/p>
3) 瀹炰緥锛歊ead a word from memory
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
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
1) abstractauto
鐢ㄤ簬瑙﹀彂鎶借薄鍛戒护鑷姩鎵ц鐨勯厤缃瘎瀛樺櫒锛屼袱绉嶈Е鍙戞柟寮忓強閰嶇疆锛?/p>
a. 淇敼Program Buffer锛?/p>
b. 璇诲彇sbdata瀵勫瓨鍣紱
2) 瀹炰緥锛歊ead a word from memory
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
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
1) Access Memory
鎶借薄鍛戒护鐨勪竴绉嶏細
鍏舵牸寮忓涓嬶細
鍏朵腑锛?/p>
aam鍓嶇紑鐨勬剰涔夋槸锛欰bstract command Access Memory锛涚浉杈冧箣涓嬶紝
aar鍓嶇紑鐨勬剰涔夋槸锛欰bstract command Access Register锛?/p>
2) 瀹炰緥锛歊ead a word from memory
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
杩欓噷鍙粙缁嶈鐐癸細
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 - TLDebugModuleOuter