用户工具

站点工具


侧边栏

CC2640R2&BLE5.0开发

关于我们

入门开始

视频教程

外设驱动

开发BLE应用

工具集

其他

cc2640r2f:others:semi_hosting

SemiHosting

IAR和CCS都支持一种Semi-Hosting技术(半独立主机),这对产品早期开发的使用 printfSystem_printf 是非常方便的,轻易将调试信息打印在IDE的终端。但是一旦Semi-Hosting 使能,绝大的TI-RTOS例程在没有连接的IDE到时候不会运行,主要是因为类似 System_flush() API 需要等待IDE应答。区别其他IDE,CCS的握手机制不太一样,通过CCS编译生成的工程可以独立IDE运行。

对于Semi-Hosting,我们参考以下模型理解

本文以下CC2640R2F BLE5.0 SDK下面的 C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\sysbios\hello 工程为例,介绍如何使用SemiHosting支持的System_printf用以打印调试信息。

Console/Terminal

IAR

在IAR 导入Examples已经详细讲解如何导入Examples,参考它,导入Hello 例程。
在Main函数中,以下代码段实现主要功能:

int main()  {
    /* Call driver init functions */
    Board_initGeneral();

    System_printf("hello world\n");

    /*
     *  normal BIOS programs, would call BIOS_start() to enable interrupts
     *  and start the scheduler and kick BIOS into gear.  But, this program
     *  is a simple sanity test and calls BIOS_exit() instead.
     */
    BIOS_exit(0);  /* terminates program and dumps SysMin output */
    return(0);
}

对于以上代码的System_printf("hello world\n");需要借助仿真器Debug的时候在Terminal打印。

IAR-View->Terminal I/O

注意:这里的终端打印只有在借助仿真器在线调试打印,并且离开IAR,复位可能不能正常运行。

CCS

CCS的Console 比较明显

Window->Show View->Console.

CCS

对于Semi-Hosting我们如何使能和禁止

对于独立工程,我们又该怎么去禁止和使能呢?

使能/禁止

对于IAR,使能支持(Semihosted)或者禁止(None)

Project>Options>General Options>Library Configuration>Semihosted

IAR 使能禁止 SemiHost功能

CCS则通过以下选择;

Project>Properties>Debug>Enable Semihosting(requires a breadpoint at SVC_Hnadler)

CCS 使能/禁止 SemiHost功能)

同时需要工程配置文件hello.cfg使用 SysMin模块,同样地可以通过SysCallback重映射IO到我们指定的打印接口(比如串口)来禁止改功能;

/*
 * The System.SupportProxy defines a low-level implementation of System
 * functions such as System_printf(), System_flush(), etc.
 *
 * Pick one pair:
 *  - SysMin
 *      This module maintains an internal configurable circular buffer that
 *      stores the output until System_flush() is called.
 *      The size of the circular buffer is set via SysMin.bufSize.
 *  - SysCallback
 *      SysCallback allows for user-defined implementations for System APIs.
 *      The SysCallback support proxy has a smaller code footprint and can be
 *      used to supply custom System_printf services.
 *      The default SysCallback functions point to stub functions. See the
 *      SysCallback module's documentation.
 */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
SysMin.bufSize = 512;
System.SupportProxy = SysMin;
//var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
//System.SupportProxy = SysCallback;
//SysCallback.abortFxn = "&myUserAbort";
//SysCallback.exitFxn  = "&myUserExit";
//SysCallback.flushFxn = "&myUserFlush";
//SysCallback.putchFxn = "&myUserPutch";
//SysCallback.readyFxn = "&myUserReady";

依赖文件

如果使能了SemiHosting,需要#inlucde以下文件防止编译错误:

/* XDC Module Headers */
#include <xdc/std.h>
#include <xdc/runtime/System.h>

参考

What is semihosting?
TI-RTOS Examples SemiHosting

加入我们

文章所有代码、工具、文档开源。加入我们QQ群 591679055获取更多支持,共同研究CC2640R2F&BLE5.0。

CC2640R2F&BLE5.0-乐控畅联 © Copyright 2017, 成都乐控畅联科技有限公司.

评论

krgmpu, 2018/11/26 02:51

american gold viagra, viagra in cvs impact factor medical education http://vigrawithoutdoctor.com/ - viagra without a doctor prescription viagra without a doctor prescription http://viagrawithadoctorprescription.org/ viagra without a doctor prescription symptoms of std in men school medical

vissbv, 2018/11/29 02:21

viagra bc canada http://canadian-pharmacyus.com

bajkjm, 2018/11/30 07:00

preГ§o viagra rs affordable health plans viagra z internetu opinie http://www.vigrawithoutadoctorsprescription.com/ viagra without a doctor prescription red cross emergency first aid at work <a href=“http://www.vigrawithoutadoctorsprescription.com/#zprqd.html ”>viagra without a doctor prescription</a> largest medical school in us medical education canada

ssj75t, 2018/12/06 19:25

viagra without a doctor prescription walmart viagra cialis levitra safe con healthcare http://viagrawithoutadoctor.us/ - viagra without a doctor prescription medical education officer <a href=“http://www.viagrawithoutadoctor.us/#docs.leconiot.com-f ”>viagra without a doctor prescription</a> medical school admissions early symptoms of heat stroke

ftl54h, 2018/12/07 13:23

pfizer y el viagra std check up medical education theory http://viagra-withoutdoctor.org/ - viagra without doctor visit heat illness treatment <a href=“http://viagra-withoutdoctor.org/#laovp.html ”>viagra without insurance</a> what's vd disease venereal diseases and symptoms

DennisSef, 2018/12/07 23:40

<a href=http://www.biz-for-all.ru/user/poltfromaser1978/>surveysforcashvault.com</a>

ArchieCoomb, 2018/12/08 00:48

<a href=http://stereomanclub.ru/index/8-25902>paydayloansnearme</a>

Altonwag, 2018/12/08 02:33

<a href=http://dlaw-firm.com/index.php?option=com_k2&view=itemlist&task=user&id=403790>bestwebcam.us.com</a>

DennisSef, 2018/12/08 02:35

<a href=http://furius03.free.fr/forums/profile.php?mode=viewprofile&u=111221>onlinehomecashsystem.com</a>

Altonwag, 2018/12/08 05:57

<a href=http://dlaw-firm.com/index.php?option=com_k2&view=itemlist&task=user&id=403790>bestwebcam.us.com</a>

ArchieCoomb, 2018/12/08 06:17

<a href=http://droid-mod.ru/user/litinrymar1971/>datingsiteswithfreetrials.us.com</a>

Altonwag, 2018/12/08 09:58

<a href=http://dlaw-firm.com/index.php?option=com_k2&view=itemlist&task=user&id=403790>bestwebcam</a>

DennisSef, 2018/12/08 10:04

<a href=http://kazaly.mektebi.kz/user/franalilas1980/>mixeddatingsites.us.com</a>

DennisSef, 2018/12/08 14:26

<a href=https://fxfan.ru/user/adecforha1972/>girlmeetsbulgari</a>a

Altonwag, 2018/12/08 19:14

<a href=http://dlaw-firm.com/index.php?option=com_k2&view=itemlist&task=user&id=403790>bestwebcam</a>

DennisSef, 2018/12/08 19:21

<a href=http://shejot.com/index/8-17142>torssexdvd</a>

NordBuh, 2018/12/09 11:48

bc26 medicament viagra pri

http://ph-d860b-2-0.com/ - muestra barata 25 mg viagra

strength viagra best

zenz11, 2018/12/11 06:49

viagra 72 hs std herpes low cost family health insurance http://www.canadianpharmacylegit.com/ - canadian online pharmacy std symptoms men <a href=“http://www.canadianpharmacylegit.com/#xrisf.html ”>walmart pharmacy price check</a> all medical school rankings heat stroke symptoms in men

ArchieCoomb, 2018/12/11 08:31

<a href=http://sscds.com/home.php?mod=space&uid=374924>mixeddatingsites.us.com</a>

ArchieCoomb, 2018/12/11 13:39

<a href=http://malina-project.com/user/paytrasundual1972/>freesex.us.com</a>

wnja41, 2018/12/11 16:38

sildenafil no prescription works faster cialis viagra first aid cpr classes http://www.viagrawithoutadoctornote.org/ - viagra without a doctor prescription health insurance cost <a href=“http://viagrawithoutadoctornote.org/”>viagra without a doctor prescription</a> buy viagra medical education agency

ArchieCoomb, 2018/12/11 18:57

<a href=http://www.videobyte.ru/index/8-60304>yourcashgroup.com</a>

ArchieCoomb, 2018/12/12 00:45

<a href=http://coolparty.ucoz.ae/index/8-22277>herewomentalksocial.com</a>

Altonwag, 2018/12/12 05:48

<a href=http://dlaw-firm.com/index.php?option=com_k2&view=itemlist&task=user&id=403790>bestwebcam</a>

DennisSef, 2018/12/12 05:48

<a href=http://kuzyastory.esy.es/user/terdirave1971/>paydayloansbadcredit.us.com</a>

ArchieCoomb, 2018/12/12 06:45

<a href=http://ms.clanhosting.cz/profile.php?lookup=889851>paydayloansnearme</a>

请输入您的评论. 可以使用维基语法:
 
cc2640r2f/others/semi_hosting.txt · 最后更改: 2018/02/07 15:26 由 chen