This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使能uartlog串口打印问题

Other Parts Discussed in Thread: SYSBIOS

芯片:CC2652

工程:SimpleCentral

过程:以SimpleCentral为基础,觉得用Display_printf函数打印要输入行数不方便,想要那种不会覆盖上不行的打印函数,就把projectzero上的uartlog函数拿过来了,把Display_printf相关名柄及初始化等全部注释掉了,发现仍然打印不出数据,在ble_debug.cfg中添加了Idle.addFunc('&uartLog_flush');函数。但仍旧不行。。。想请教各位大神,我哪里没改对。。。

main.c中的串口相关

UART_init();
UartLog_init(UART_open(Board_UART0, NULL));
/* Initialize ICall module */
ICall_init();

/* Start tasks of external images - Priority 5 */
ICall_createRemoteTasks();
Log_info0("Init over0.\r\n");

ble_debug.cfg文件中的添加:

/* ================ Idle configuration ================ */
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
/*
* The Idle module is used to specify a list of functions to be called when no
* other tasks are running in the system.
*
* Functions added here will be run continuously within the idle task.
*
* Function signature:
* Void func(Void);
*/
//Idle.addFunc("&myIdleFunc");
/* Allow power management */
Idle.addFunc('&Power_idleFunc');
Idle.addFunc('&uartLog_flush');

  • /******************************************************************************
    
       @file  UartLog.h
    
       @brief   This file provides a replacement / override for the
              XDC Runtime Log.h API that stores Log_info et al in
              a circular buffer and renders the text strings over
              UART in the Idle loop.
    
              To enable this Log replacement, you must
                  1) Add the global precompiler define `UARTLOG_ENABLE`
                  2) #include <UartLog.h> *instead of* <xdc/runtime/Log.h>
                     if you have it in your application.
    
              If you want Log statements to be owned by xdc runtime, undefine
              UARTLOG_ENABLE globally and include <xdc/runtime/Log.h> instead.
    
              To remove all Log calls,
                  1) Add precompiler symbol `xdc_runtime_Log_DISABLE_ALL`
                  2) Remove precompiler symbol `UARTLOG_ENABLE`
    
       Group: CMCU, LPRF
       Target Device: CC2652
    
     ******************************************************************************

  • 你好,问题我解决了,但是我仍然不太理解。
    根据你的回答,添加predrfine我已经做了。但仍有问题。详见下面:
    我在ble5_simple_central_cc26x2r1lp_app_FlashROM_Debug.opt和ble5_simple_central_cc26x2r1lp_app_FlashROM_Release.opt中添加了预定义。在ble_debug.cfg中添加了Idle.addFunc('&uartLog_flush');下载后仍没有输出。
    我的问题在于没有在ble_release.cfg中添加Idle.addFunc('&uartLog_flush');
    请问添加功能必须在正确地包含.h后在以上四个地方添加宏定义或任务才行吗?
    以上四个文件分别负责什么呢?
  • 大神们看到我!这四个文件干啥滴,求说明~~扔链接也行啊!!!
  • 很抱歉未能及时给您回复!

    opt文件主要是用于存放compiler option的,即预编译选项的

    dev.ti.com/.../creating-a-custom-bluetooth-low-energy-application.html
  • 嗯,我看里面的内容也能猜到,但是
    1.这两个有区别吗?他们面向的对象不同?是否必须一样?
    2.ble_debug.cfg和在ble_release.cfg面向对象是否不同?为啥看起来内容一样的文件要弄俩啊,debug和release使用有啥区别?
    另,加复很及时啦,谢谢大神~
  • 大神看到我~~!!

  • Debug  通常称为调试版本,它包含调试信息,并且不作任何优化,便于程序员调试程序。Release  称为发布版本,它往往是进行了各种优化,使得程序在代码大小和运行速度上都是最优的,以便用户很好地使用。
  • 那是不是说,这两个是不相关的?例如,只要我修改了release文件中相关的设置,那么就算不修改debug文件,我烧写进去的程序也会按我期望的运行?
  • 默认是Release模式。具体您可以看一下