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.

AM5729: PRU: how to configure & take care of the stack & heap

Part Number: AM5729

Hi all,

I had an issue where code was crashing etc, and had to increase both the stack and heap.

In future, how my I check those 2 to know if they are big enough during runtime?

I know roughly what a stack is but what about the heap?

Are there maybe status registers which help me understand if there are issues with the stack etc, or some other part?

Thanks,

Fisher

  • Hi Fisher,

    Which OS is it ? For TI-RTOS you can use ROV

    For Linux, generic programming principles apply. Check your memory while doing runtime allocations etc.

    Regards

    Vineet

  • Hi Vineet,

    I'm using Linux.

    I was unsure if the stack was internal to the PRU, though I knew it's a compiler setting, so I wanted to know if the PRU has an event or debug info when the stack is full.

    I've just learned last night that the stack and heap are allocated in RAM.  I've found this mentioned in the "PRU Cookbook" by Mark Yoder: markayoder.github.io/.../

    I don't have a lot of microcontroller experience, just the basics, plus, the PRU seems not as documented, especially for examples and troubleshooting scenarios.

    I'll speak to my supervisors about checking allocations in general programming, though I've not been dynamically allocating memory.

    This was a C++ program about 500k bytes in size without any dynamic allocation, though its likely running constructors etc.  The PRU would crash and I assumed it was my code.

    I've put a separate post up relating to 2 messages I've been getting during this crash event, and also when interrupts weren't previously cleared:

    https://e2e.ti.com/support/processors/f/processors-forum/992869/am5729-pru-how-to-debug-l3-main-errors-and-configure-them

    Fisher