TI中文支持网
TI专业的中文技术问题搜集分享网站

cc1310 + TI 15.4 二进制文件 导致 串口无法正常使用

TI大神,你好!

我们在项目中以TI15.4协议栈为基础进行开发,使用CCS编译器编译,

使用过程中编译出两个版本(逻辑代码有一些区别),生成二进制文件大小为:

1、

2、

第二个版本正常执行,

第一个版本 烧录运行中 串口无法正常打印和接收。

两个版本在串口相关基础代码和使用代码无任何区别。

请问这是什么原因,需要怎样解决。

Kevin Qiu1:

user5153918

第一个版本 烧录运行中 串口无法正常打印和接收。

两个版本在串口相关基础代码和使用代码无任何区别。

说明串口部分没问题,第一个版本有问题,是代码的问题,检查下逻辑是否有问题

user5153918:

回复 Kevin Qiu1:

两者代码完全相同区别仅仅是第一个版本在 Uart_ReadCallback()函数中多调用了一个用于封包字符串的函数。

user5153918:

回复 Kevin Qiu1:

虽然只是多调用了一个函数,但是编译出来后hex文件大小差距很大,会不会是代码段溢出?

Kevin Qiu1:

回复 user5153918:

单步运行看看是否执行了你所调用的函数// -----------------------------------------------------------------------------
//! \briefThis callback is invoked on Read completion of readSize/receive
//!timeout
//!
//! \param[in]handle - handle to the UART port
//! \param[in]ptr- pointer to buffer to read data into
//! \param[in]size- size of the data
//!
//! \returnvoid
// -----------------------------------------------------------------------------
static void NPITLUART_readCallBack(UART_Handle handle, void *ptr, size_t size)

user5153918:

回复 Kevin Qiu1:

 两个版本Release出来的文件内容完全一样  区别在于collector.c 中函数Uart_ReadCallback  在处理串口已读字符时调用了一个外部处理函数。

user5153918:

回复 Kevin Qiu1:

 执行中会在

/* Allocate message buffer space */ macStackInitParams_t *pMsg = (macStackInitParams_t *)OsalPort_msgAllocate( sizeof(macStackInitParams_t));

中报错,进入  Main_assertHandler。

但是单步可以过去。。。。。。。。。。过去后在执行  也会报错。

user5153918:

回复 Kevin Qiu1:

错误现场如下:

user5153918:

TI大神!

          ti15.4协议栈协调器 启动阶段,执行到  ApiMac_init时,分配地址空检报错,

uint8_t * OsalPort_msgAllocate(uint16_t len )
{uint8_t *pMsg = NULL;OsalPort_MsgHdr* pHdr;if ( len == 0 )return ( NULL );pHdr = (OsalPort_MsgHdr*) OsalPort_malloc( len + sizeof( OsalPort_MsgHdr ) );if ( pHdr ){pHdr->next = NULL;pHdr->len = len;pHdr->dest_id = OsalPort_TASK_NO_TASK;pMsg = (uint8_t *)((uint8_t *)pHdr + sizeof( OsalPort_MsgHdr ));}return pMsg;
}

估计是空间分配不够了,请问TI大神,这个空检配置在哪里调整呢?

Kevin Qiu1:

空间受RAM限制,具体报什么错?修改了哪些程序/********************************************************************** @fnOsalPort_msgAllocate** @brief**This function is called by a task to allocate a message buffer*into which the task will encode the particular message it wishes*to send.This common buffer scheme is used to strictly limit the*creation of message buffers within the system due to RAM size*limitations on the microprocessor.Note that all message buffers*are a fixed size (at least initially).The parameter len is kept*in case a message pool with varying fixed message sizes is later*created (for example, a pool of message buffers of size LARGE,*MEDIUM and SMALL could be maintained and allocated based on request*from the tasks).*** @paramuint8_t len- wanted buffer length*** @returnpointer to allocated buffer or NULL if allocation failed.*/
uint8_t * OsalPort_msgAllocate(uint16_t len )

Kevin Qiu1:

回复 user5153918:

看起来应该是溢出了

赞(0)
未经允许不得转载:TI中文支持网 » cc1310 + TI 15.4 二进制文件 导致 串口无法正常使用
分享到: 更多 (0)