Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hi,
Mi name is Julian and I've been working with a TMS570LC4357 for quite a while now. Long story short, I have a setup where I'm using a TMS570LC4357 with a FreeRTOS and a custom code that processes whatever the serial port gives as input, and then sends its output via EMAC to another board. I'm feeding data to the first board via serial port with my terminal.
All in all, I have tried this setup WITHOUT any custom code that processes the input. I have connected both boards (incidentaly, both of the same model) and they communicate well with a periodically generated frame that is sent via EMAC. Now, once I introduce my processing code, I get up to a few (totally random) executions without problems. But after a certain number of executions, the board stops operating, as a Stack Overflow has ocurred. I'm managing the overflow by using the Stack Overflow Hook task from FreeRTOS.
Now, up until here it seems pretty normal. I introduce a new function in a system that works, and now it has an overflow problem, ergo the function is at fault. But the code should have more than enough space in the RAM in order to not cause a Stack Overflow. Even then, I have increased the User Stack Length to 0x1A000 (106496), which is already a fifth of my RAM (it is a lot!). Even then, the same error occurs.
This brings me to my question: how can I determine WHO caused the overflow? It seems obvious that the fault is of my processing function,yet... how can I trace it? Simply, the Stack Overflow occurs, and I'm sent to the Data Entry interrupt (basically an error!) and I'm left to find out via the LR. And the LR sends me to "portSAVE_CONTEXT" (saves the context of the current task in the OS) which to me does not mean too much (why would an overflow ocurr when saving a task?).
And lastly: there are several different types of stacks, as evidenced by Halcogen (total stack, user stack, supervisor stack, fiq stack, irq stack, abort stack, undefined stack). Am I increasing the size of the wrong stack?
I very much apologize for being vague, as the system has a lot of different elements. But I think that narrowing it down to a working OS + custom code, it can be solved. Yet, I'm unsure about the types of stacks and who has caused the overflow (inside of my function, of course), which obviously has brought me here.
Best regards and thank you for reading,
Julian
edit: phrasing.