DBPRINTF() and FreeRTOS in PIC32MX

chaabanemalki wrote on Wednesday, April 23, 2014:

Hello,
I set up a project based using Mplab X ide 2.00 and XC32 1.31 and i added FreeRTOS kernel, For now FreeRTOs manages the heap with heap_4.c.

I noticed when I check “enable App IO” from Project Properties>x32-gcc, and add this line in the beginning of main(), after DBINIT()

char valueTest[]=“this is a test\n”;

When I start debugging, the value of valueTest doesn’t change, yet when i print it with DBRINTF()
I get “this is a t” in the PIC AppIO window.

If I uncheck “enable App IO” I can see the value of valueTest changing in the watches window

I know that DBPRINTF uses the heap space, and FreeRTOs reserve around 28k but i’m not sure if this space is shared with DBPRINTF().

I also found that I can use functions in printf-stdarg.c rather than standard C libraries. Is it possible to replace BDPRINTF with PRINTF from printf-stdarg.c

Any ideas how to fix this problem ?

Thank you

any ideas how to fix this problem ???

rtel wrote on Wednesday, April 23, 2014:

Does DBPRINTF work as expected if you call it from a standard C program, without FreeRTOS. You can test this easily by calling it from your FreeRTOS project, but from main(), before the scheduler has been started.

If DBPRINTF uses the heap then you will need to ensure you have one defined. The heap implemented by heap_4.c is used when pvPortMalloc() is called, so will not be used by any standard C libraries such as malloc().

Regards.

chaabanemalki wrote on Wednesday, April 23, 2014:

Thank you for the informations,

All the tests were before starting the scheduler, and I think i found the problem. It is in the watches window. and for that i should go to microchip forum.