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.
大家好,
我现在使用自建工程,在CM内核实现udp协议的Enet通信,将CPU1采集的数据通过ipc3触发中断发送给CM,在中断代码中将数据发送出去,发送周期是625us,实现实时不间断的采集。但在发送持续了30s左右程序被打断,pc指针会跳到下面图中的代码,该代码是f2838xif.c文件中。
也就是在调用mem_malloc函数时返回的地址为0,不知道为啥会返回为0,一般在malloc空间后都会释放掉,应该不存在内存不够的情况啊
下图是我目前heap和stack设置的大小。
想请教大家给一些建议。
你好,能否查看你程序使用的堆栈大小?有没有可能堆栈还是小了?只是想再次确认下。
能否尝试单步调试mem_malloc 函数看看是什么导致了 返回0?是有什么特殊的条件才会返回0吗?
你好,能否查看你程序使用的堆栈大小?有没有可能堆栈还是小了?只是想再次确认下。
那我需要改多大?如何判断堆栈大小是否够用?
能否尝试单步调试mem_malloc 函数看看是什么导致了 返回0?是有什么特殊的条件才会返回0吗?
是f2838xif.c文件mem_malloc函数中下图红框中这个条件没满足导致返回的0
我查看是从ram_heap这个数组分配的内存
你好,参考下工程师的回复:
Can you please confirm where this mem_malloc is located file-wise? According the some compiler experts this is not part of the RTS compiler library, and linker settings for heap size does not affect the amount of memory available for this function.
因为我用的是lwip的udp协议来实现通信,所以该mem_malloc函数定义是在mem.c文件中的,确实连接器的heap不会影响该函数的内存量,影响该内存的是lwip协议定义的ram_heap来实现的内存堆。
参考下工程师的回复:
Would it be possible to debug step to line 886/887 in your screenshot to see how the values in the conditional are set and which one does not make sense per your understanding? There may be a way to narrow down the issue further from there.
因为我用的是lwip的udp协议来实现通信,所以该mem_malloc函数定义是在mem.c文件中的,确实连接器的heap不会影响该函数的内存量,影响该内存的是lwip协议定义的ram_heap来实现的内存堆。
Is this something being used on the Ethernet peripheral for this device? Is the mem.c something provided in a TI SDK (if you can tell me where it's from, I may be able to find an expert who can better debug this)?
Would it be possible to debug step to line 886/887 in your screenshot to see how the values in the conditional are set and which one does not make sense per your understanding? There may be a way to narrow down the issue further from there
我已经调试过,是由于该空间被使用了,也就是mem->used的值为1.
Is this something being used on the Ethernet peripheral for this device? Is the mem.c something provided in a TI SDK (if you can tell me where it's from, I may be able to find an expert who can better debug this)?
mem.c文件就是在C2000Ware的库里,具体位置为:C2000Ware_4_03_00_00\libraries\communications\Ethernet\third_party\lwip\lwip-2.1.2\src\core\mem.c