如何理解Semihosting?(老帖重发,写得比较久了)

Semihosting,顾名思义,就是"半主控",意思就是说,运行在target board上的程序利用主机上的facilities的一种程序调试方式,主要是debug目标板时,利用主机的输入输出设备,例如在AxD的console上打印相应的调试信息或者用主机的键盘输入相应字符作为target上的程序的输入。
  C/C++ code默认是可以使用console的,例如,如果只包含C/C++的程序采用ARMulater模拟,就可以直接使用console作为程序的输出设备;如果程序包含有汇编代码,要使用主机设备的话,必须采用semihosting SWI方式。Semihosing SWI(以下简称SHS),必须有相应的debug agent的支持,才能截获SHS,并向software debugger(AxD)请求相应的服务,如打印字符或者接受字符输入,这样的agents包括:
 1)ARMulater
 2)debug monitor(Angel)
 3)MultiICE
  由于调试裸板或者没有Angel可以供目标板使用的时候,主要还是要借助仿真器进行调试,所以第三种方式最为常用,下面主要就这种方式进行介绍。当然,UART也是一种最常用的调试接口,但是,使用Semihosting,可以独立地调试各个硬件模块的逻辑功能,确保各段代码正确后再进行集成,相应地省去了每次都要配置UART和另开一个hyperterminal观察调试信息。所以,我在开发的时候倾向于使用semihosting来调试相关的代码,这些代码使用C或者C++编写,也就是说和硬件配置关系不大。

=================================Below from ADS help===============================
Multi-ICE
When using Multi-ICE in default configuration, semihosting is implemented as follows:
1. On ARM7 processors:
 a) A breakpoint is set on the SWI vector.
 b) When this breakpoint is hit, Multi-ICE examines the SWI number.
 c) If the SWI is recognized as a semihosting SWI, Multi-ICE emulates it and transparently restarts execution of the application. 
 If the SWI is not recognized as a semihosting SWI, Multi-ICE halts the processor and reports an error.
2. On other processors:
 a) Vector-catch logic traps SWIs.
 b) If the SWI is recognized as a semihosting SWI, Multi-ICE emulates it and transparently restarts execution of the application. 
 If the SWI is not recognized as a semihosting SWI, Multi-ICE halts the processor and reports an error.
 This semihosting mechanism can be disabled or changed by the following debugger internal variables:
  $semihosting_enabled
 Set this variable to 0 to disable semihosting. If you are debugging an application running from ROM, this allows you to use an  additional watchpoint unit.
 Set this variable to 1 to enable semihosting. This is the default.
 Set this variable to 2 to enable Debug Communications Channel semihosting.
 The S bit in $vector_catch has no effect unless semihosting is disabled.
 $semihosting_vector
This variable controls the location of the breakpoint set by Multi-ICE to detect a semihosted SWI. It is set to the SWI entry in the exception vector table (0x8) by default.
If your application requires semihosting as well as having its own SWI handler, set $semihosting_vector to an address in your SWI handler. This address must point to an instruction that is only executed if your SWI handler has identified a call to a semihosting SWI. All registers must already have been restored to whatever values they had on entry to your SWI handler.
Multi-ICE handles the semihosted SWI and then examines the contents of lr and returns to the instruction following the SWI instruction in your code. 
Regardless of the value of $vector_catch, all exceptions and interrupts are trapped and reported as an error condition.
For details of how to modify debugger internal variables, see the appropriate debugger documentation.

最后一次修改2006.3.14

转自:http://blog.csdn.net/zhtek/article/details/723869

学习笔记-Semihosting相关推荐

  1. PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 call

    您的位置 首页 PyTorch 学习笔记系列 PyTorch 学习笔记(六):PyTorch hook 和关于 PyTorch backward 过程的理解 发布: 2017年8月4日 7,195阅读 ...

  2. 容器云原生DevOps学习笔记——第三期:从零搭建CI/CD系统标准化交付流程

    暑期实习期间,所在的技术中台-效能研发团队规划设计并结合公司开源协同实现符合DevOps理念的研发工具平台,实现研发过程自动化.标准化: 实习期间对DevOps的理解一直懵懵懂懂,最近观看了阿里专家带 ...

  3. 容器云原生DevOps学习笔记——第二期:如何快速高质量的应用容器化迁移

    暑期实习期间,所在的技术中台-效能研发团队规划设计并结合公司开源协同实现符合DevOps理念的研发工具平台,实现研发过程自动化.标准化: 实习期间对DevOps的理解一直懵懵懂懂,最近观看了阿里专家带 ...

  4. 2020年Yann Lecun深度学习笔记(下)

    2020年Yann Lecun深度学习笔记(下)

  5. 2020年Yann Lecun深度学习笔记(上)

    2020年Yann Lecun深度学习笔记(上)

  6. 知识图谱学习笔记(1)

    知识图谱学习笔记第一部分,包含RDF介绍,以及Jena RDF API使用 知识图谱的基石:RDF RDF(Resource Description Framework),即资源描述框架,其本质是一个 ...

  7. 计算机基础知识第十讲,计算机文化基础(第十讲)学习笔记

    计算机文化基础(第十讲)学习笔记 采样和量化PictureElement Pixel(像素)(链接: 采样的实质就是要用多少点(这个点我们叫像素)来描述一张图像,比如,一幅420x570的图像,就表示 ...

  8. Go 学习推荐 —(Go by example 中文版、Go 构建 Web 应用、Go 学习笔记、Golang常见错误、Go 语言四十二章经、Go 语言高级编程)

    Go by example 中文版 Go 构建 Web 应用 Go 学习笔记:无痕 Go 标准库中文文档 Golang开发新手常犯的50个错误 50 Shades of Go: Traps, Gotc ...

  9. MongoDB学习笔记(入门)

    MongoDB学习笔记(入门) 一.文档的注意事项: 1.  键值对是有序的,如:{ "name" : "stephen", "genda" ...

最新文章

  1. 进军ABP第一天:ABP理论知识
  2. Sqlite3数据库之第三方库FMDB学习心得
  3. Hyper-V虚拟机快照占用磁盘空间过多,导致虚拟机不能启动怎么办
  4. linux获取命令的返回值,怎样获取shell函数的返回值及shell命令的返回值?
  5. apache属于什么类型的软件
  6. 100.X86的寻址方式
  7. 2019春第四周作业软件
  8. leetcode面试题 10.05. 稀疏数组搜索(二分法)
  9. 递归算法经典实例python-递归案例python
  10. JAVA之CRC校验算法
  11. Ubuntu/Debian怎么在命令行开启远程桌面共享
  12. Win10桌面点鼠标右键一直转圈的解决方法
  13. “Your Firefox profile cannot be loaded. It may be missing or inaccessible.“
  14. 演示笔记本重装系统win7教程,笔记本电脑安装win7系统
  15. 镜头camera shot
  16. 看看 NF_HOOK 宏
  17. My QQ Show
  18. linux使wifi进去低功耗,WiFi232低功耗系列模块加入路由器设置方法
  19. 那些年我们在spark SQL上踩过的坑
  20. IOS学习之UISwitch控件两种使用方法和监听

热门文章

  1. 电力电子技术笔记-三相半波可控整流电路
  2. 走马观花看西门子公司自动控制软件
  3. oracle us7ascii zhs16gbk,数据库的编码浅谈(ZHS16GBK与US7ASCII)
  4. 【BI软件】零编程构建财务分析模型(行计算模型)
  5. java计算机毕业设计智能道路交通管理系统源代码+系统+数据库+lw文档
  6. 使用Excel和翻译api批量翻译字符串
  7. 制造业仓库很乱,该如何有效的管理呢?
  8. 解决俄罗斯Lopatkin精简版Win10无法远程的问题及同类精简版系统无法远程问题
  9. 【Android开发】三种方法实现Button点击事件响应
  10. 快讯:每日优鲜回应3天关闭9城业务;名创优品将在港交所上市