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.

TMS320F28388D: stuck at asm(“ bkpt #0”)

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi Team,

There’s an issue from the customer need your help:

I now use the self-built project to realize the Enet communication of the udp protocol in the CM kernel, trigger interrupt the data collected by CPU1 to send it to CM through ibc3, and send the data out in the interrupt code. The sending cycle is 625us to achieve real-time uninterrupted collection. However, if the program that lasts for about 30s is interrupted, the pc pointer will jump to the code in the figure below, which is in the f2838xif.c file.

That is to say, the address returned when calling the mem_malloc function is 0. I don't know why it returns 0. Generally, it will be released after malloc space. There should be no shortage of memory.

The following figure shows the size of my current heap and stack settings.

Thanks & Regards,

Ben

  • Hello Ben,

    Can you check the amount of heap is being used by the program? Is their any chance that the amount being requested for would exceed this amount? I understand you stated there is no shortage of memory, I just want to double-check.

    Also, if possible can you step through the mem_malloc function to see what is causing it to return 0? Is there a specific condition that causes the return?

    Best regards,

    Omer Amir

  • Hi Omer,

    Can you check the amount of heap is being used by the program? Is their any chance that the amount being requested for would exceed this amount? I understand you stated there is no shortage of memory, I just want to double-check.

    So how big do I need to change? How to determine whether the stack size is enough?

    Also, if possible can you step through the mem_malloc function to see what is causing it to return 0?

    It is the 0 returned that this condition in the red box in the figure below in the f2838xif.c file mem_malloc function is not met.

    I checked the memory allocated from the array ram_heap.

    Best Regards,

    Ben

  • 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.

  • Hi Omer,

    Because I use the UDP protocol of LWIP to implement communication, the function definition of this mem_malloc is in the mem.c file, and indeed the heap of the connector does not affect the amount of memory of the function, but the memory that affects the memory is the memory heap of the ram_heap implemented by the LWIP protocol.

    Best Regards,

    Ben

  • 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.

    Because I use the UDP protocol of LWIP to implement communication, the function definition of this mem_malloc is in the mem.c file, and indeed the heap of the connector does not affect the amount of memory of the function, but the memory that affects the memory is the memory heap of the ram_heap implemented by the LWIP protocol.

    I'm not familiar with the LWIP protocol, 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)?

  • Hi Omer,

    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.

    I have debugged it and it is because the space is used, that is, the value of mem->used is 1.

    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)?

    The mem.c file is in the C2000Ware library. The specific location is: C2000Ware_4_03_00_00\libraries\communications\Ethernet\third_party\lwip\lwip-2.1.2\src\core\mem.c

    Best Regards,

    Ben

  • Hello Ben,

    I will try to get the Ethernet software owner to try to help with this, but they are currently out-of-office. Please expect a reply sometime after tomorrow.

  • Hi Omer,

    Is there any updates?

    Best Regards,

    Ben