FreeRTOS – PIC32 Crash log and System backup before restarting

Hi, We are using PIC32Mx MCU with Freertos version V6.0.2 on our product. We are planning to add a crash information logging and the required system back up(application related) into external flash memory(SPI Bus) before restarting the system whenever STACK over flow triggers . We need to add this functionlity in the production firmware for field monitoring purpose. Is there any better way to do this? Since vApplicationStackOverflowHook() function called from scheduler tick, is it possible to add this functionlity on that function with external flash memory read/write functionlity for this backup process? Thanks Muruganandam

FreeRTOS – PIC32 Crash log and System backup before restarting

For crash logging I would recommend adding your crash report function to the PIC32 exception handlers, and the configASSERT() macro (which would require updating to a later version of FreeRTOS, it is currently on V8). You can then add a call to configASSERT() in the malloc failed and stack overflow hook functions. There will be no problem in doing what you want from the kernel tick on the assumption you are not going to try and recover from the crash – so once you are inside the error handler (called from the interrupt) do whatever you need to do then just sit in a null loop or reset the system rather than trying to return from the error handler. Regards.

FreeRTOS – PIC32 Crash log and System backup before restarting

Thanks for the details. Can we add some new functions in the existing task.c file of freertos? we need to get the size of TCB, TOP of the stack, name etc.. during crash information logging. Since there is no hook function to get the TCB size, can we add a new function in the existing task.c file to get these details? or Is there any other way to achive this? Is there any issue on the GPL license when we add new functions in the task.c? Thanks, Muruganandam

FreeRTOS – PIC32 Crash log and System backup before restarting

If you add or modify code in the core kernel then technically you should offer to make those changes available to other people. The easiest way to do that is just to post them to the FreeRTOS Interactive site (http://interactive.freertos.org) so other people can just view them and download them if they want. Regards.