※ 引述《Hyozero (123)》之銘言:
原文恕刪
: 好奇wiki裡寫的:
: 1.An "emulator" gets its name because it emulates (imitates) the central
: processing unit of the embedded system's computer.
: 請問它是怎麼模擬CPU的阿?本來在板子上的CPU不是還在上面嗎?
那篇前面有提到一開始的emulator的確是可以插在板子上模擬CPU
不過以現在ICE的用途其實是誤稱(misnomer),我其實比較習慣講debugger
現在還是有些CPU可以用emulator模擬,不過都是比較小的MCU像是8051和AVR
: 2.Notably, when their program fails, most embedded systems simply become inert
: lumps of nonfunctioning electronics . Embedded systems often lack basic
: functions to detect signs of software failure, such as an MMU to catch memory
: access errors.
: 請問為何說Embedded system沒有可以檢查software failure的功能呢?
: 小弟的公司是用uart或I2C去讀code run時的print message或register值,這樣的功能
: 算是後來再附加上去的嗎?
用UART或I2C debug的前提是CPU還可以執行程式
如果因為一些原因bus hang住了,或是CPU讀到錯的指令跑飛了,就沒辦法這樣debug
這種情況就要靠ICE透過JTAG直接控制CPU來debug
: 3.With an ICE, the programmer can usually test pieces of code, then isolate the
: fault to a particular section of code, and then inspect the failing code and
: rewrite it to solve the problem.
: 這部份實在無法理解了,為何ICE能夠做到把code切分段去debug呢?
你可以在code裡面加break point,當CPU跑到break point的時候就會停下來
停下來之後可以透過ICE檢察系統狀態看是否正常
所以就可以知道跑到那段code前是沒問題的
另外也可以用step一步一步執行看程式會掛在那裡
以上是個人淺見,如有誤還請幫忙指正~
作者:
rockwho (FFForder)
0000-00-00 00:00:00推
作者: yuskeb (我想做一個好人) 0000-00-00 00:00:00
推
作者:
Hyozero (1)
0000-00-00 00:00:00謝謝您! 還有個認知上的問題想請教
作者:
Hyozero (1)
0000-00-00 00:00:00我把ICE想成是模擬CPU或控制CPU,所以它可以直接看code跑
作者:
Hyozero (1)
0000-00-00 00:00:00的情況,也可以直接access register值和週邊device狀況請問我這樣認知是正確的嗎?
是[控制CPU],你所有在debug tool上的動作(load code, 改值,single step)。都會透過ICE實際去access cpu。他算是一種侵入式的debug 手段
另外,為何ICE可以分段執行code 那是因為CPU裡面有跟ICE相關的電路來做control,因此可以做到想停就停的境界。
作者:
bxxl (bool)
0000-00-00 00:00:00現在的IC就是利用CPU本身提供的單步執行功能,
作者:
bxxl (bool)
0000-00-00 00:00:00所以不是用另一個東西來模擬,那是滿早以前的方法,很昂貴
作者:
odahawk (羊皮狼)
0000-00-00 00:00:00現代已經用 JTage 構造直接做在IC內了
現在都做成硬体的JTAG,所以都有限制只能設幾個breakpo