Mostly I can see a “0x55AA55AA mark” on top. Is there any specification available how the xISRStack is working and what it is used for?
Is there a way of using a watermark to see the isrStack´s behaivior or if the stack overflowed ?
Is the Compilers usual Prologe/Epiloge left unaffectted by using freeRros ? Thank you for your reply
Is there any specification available how the xISRStack is working and what it is used for?Three things make it advantageous under most circumstances to use a separate interrupt (or ‘system’) stack on the M4K core: 1) The M4K has a large context, that has to be saved on a task by task basis.
2) The M4K does not automatically maintain more than one stack, so each task would have to otherwise maintain a stack that was large enough to hold the entire task and interrupt context. In other words, the interrupt context size would have to be multiplied by the number of tasks you have when working out the RAM usage.
3) The MIPS ABI is not exactly designed to minimise stack usage. That is, when it generates a function call stack frame quite a lot of RAM is required. Therefore the FreeRTOS port maintains a stack for each task onto which its own context (and no other) is saved, and xISRStack that is switched to each time an interrupt (with nesting count of zero) is accepted. xISRStack is used by the portSAVE_CONTEXT and portRESTORE_CONTEXT macros automatically and dramatically reduces the amount of RAM an application requires to execute were it not used, at the cost of a little extra code required to enter an interrupt.
Is there a way of using a watermark to see the isrStack´s behaivior or if the stack overflowed ?You could easily extend the code to fill the ISR stack with a known pattern, then check this from anywhere you like to ensure the end of the stack has not been overwritten. For example, from within portSAVE_CONTEXT(), the tick interrupt hook, the traceTASK_SWITCHED_IN() macro, etc, although portSAVE_CONTEXT() would be best as this will be called on each context saving interrupt which is where the overflow would actually occur. Alternatively you could check that there is sufficient space to save the context prior to the context actually being saved, but again this would not catch all overflows, checking for a pattern being overwritten at least demonstrates a historical overflow too.
Is the Compilers usual Prologe/Epiloge left unaffectted by using freeRros ?Not when using the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros. Read the “Interrupt Service Routines” section of the port documentation page: http://www.freertos.org/port_PIC32_MIPS_MK4.html
It has the ability of nested interrupts but this happens not very often over time.
This explains most of the trouble I have had while porting to MK4 Kernel. I wish I have had a close look at your “port_PIC32_MIPS_MK4.html” Document prior… Anyway, I have checked the stack-usage by filling it with a known pattern, that save me another 300 bytes aprox. Thank you Richard