这里会显示出您选择的修订版和当前版本之间的差别。
cc2640r2f:semi_hosting [2018/02/07 15:26] chen 已恢复为旧版 (2018/02/07 14:06) |
cc2640r2f:semi_hosting [2021/06/22 23:14] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | < | ||
- | # SemiHosting # | ||
- | IAR和CCS都支持一种Semi-Hosting技术(半独立主机),这对产品早期开发的使用 `printf`和 `System_printf` 是非常方便的,轻易将调试信息打印在IDE的终端。但是一旦Semi-Hosting 使能,绝大的TI-RTOS例程在没有连接的IDE到时候不会运行,主要是因为类似 `System_flush()` API 需要等待IDE应答。区别其他IDE,CCS的握手机制不太一样,通过CCS编译生成的工程可以独立IDE运行。 | ||
- | |||
- | 对于Semi-Hosting,我们参考以下模型理解 | ||
- | |||
- | ![](http:// | ||
- | |||
- | |||
- | 本文以下CC2640R2F BLE5.0 SDK下面的 `C: | ||
- | |||
- | ## Console/ | ||
- | |||
- | ### IAR ### | ||
- | 在IAR [导入Examples](http:// | ||
- | 在Main函数中,以下代码段实现主要功能: | ||
- | |||
- | ```C | ||
- | int main() | ||
- | /* Call driver init functions */ | ||
- | Board_initGeneral(); | ||
- | |||
- | System_printf(" | ||
- | |||
- | /* | ||
- | | ||
- | | ||
- | | ||
- | */ | ||
- | BIOS_exit(0); | ||
- | return(0); | ||
- | } | ||
- | ``` | ||
- | 对于以上代码的` System_printf(" | ||
- | |||
- | **IAR-View-> | ||
- | |||
- | ![](http:// | ||
- | |||
- | > | ||
- | |||
- | ### CCS ### | ||
- | |||
- | CCS的Console 比较明显 | ||
- | |||
- | **Window-> | ||
- | |||
- | ![CCS](http:// | ||
- | |||
- | ## 对于Semi-Hosting我们如何使能和禁止 ## | ||
- | |||
- | 对于独立工程,我们又该怎么去禁止和使能呢? | ||
- | |||
- | ### 使能/ | ||
- | |||
- | 对于IAR,使能支持(Semihosted)或者禁止(None) | ||
- | |||
- | **Project> | ||
- | |||
- | ![IAR 使能禁止 SemiHost功能](http:// | ||
- | |||
- | CCS则通过以下选择; | ||
- | |||
- | **Project> | ||
- | |||
- | ![CCS 使能/ | ||
- | |||
- | 同时需要工程配置文件`hello.cfg`使用 `SysMin`模块,同样地可以通过`SysCallback`重映射IO到我们指定的打印接口(比如串口)来禁止改功能; | ||
- | |||
- | ```C | ||
- | /* | ||
- | * The System.SupportProxy defines a low-level implementation of System | ||
- | * functions such as System_printf(), | ||
- | * | ||
- | * Pick one pair: | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | */ | ||
- | var SysMin = xdc.useModule(' | ||
- | SysMin.bufSize = 512; | ||
- | System.SupportProxy = SysMin; | ||
- | //var SysCallback = xdc.useModule(' | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | // | ||
- | ``` | ||
- | ### 依赖文件 ### | ||
- | |||
- | 如果使能了SemiHosting,需要`# | ||
- | ``` | ||
- | /* XDC Module Headers */ | ||
- | #include < | ||
- | #include < | ||
- | ``` | ||
- | ## 参考 ## | ||
- | |||
- | [What is semihosting? | ||
- | [TI-RTOS Examples SemiHosting](http:// | ||
- | |||
- | |||
- | ## 加入我们 ## | ||
- | 文章所有代码、工具、文档开源。加入我们[**QQ群 591679055**](http:// | ||
- | <div> | ||
- | <p align=" | ||
- | <a target=" | ||
- | © Copyright 2017, 成都乐控畅联科技有限公司. | ||
- | </p> | ||
- | </ | ||
- | |||
- | |||
- | </ | ||
- | |||
- | ~~DISCUSSION~~ |