※ 引述《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