TCP/IP STACK + freeRTOS Harmony / PIC32MX32 combination, wont' glue together for me.

andrewfrazer wrote on Monday, February 22, 2016:

I’m new to working with both freeRTOS and Harmony and have run into a problem that is causing me some issues;
Im using MPLAB 3.20, and Harmony 1.06
I’m trying to get the TCP/IP stack + freeRTOS working together in the same stack. It just doe’snt want to play for me…

I created a new project, based around a PIC32MX795P512-L ( using an ethernet Starter Kit 2 ), and set up the TCP/IP etc, used the appropriate BSP files, added a file system. and it all works without any issues…

Then go back and add FreeRTOS into the mix using the Harmony Configurator;

Selected FreeRTOS_V8.x.x
Memory management Type is Heap5
The Tick Rate is 1000Hz
Total Heap Size is 10240

There were no changes in any code when it was generated. The code compiles ands installs on the Starter Kit 2, but does not seem to operate correctly. When i debug the code, i end up in the
vApplicationMallocFailedHook() loop, when the tasks are created ( before starting the scheduler ).

This is my SYS_Task… It doesnt get past the first part.

void SYS_Tasks ( void )


{
/* Create OS Thread for Sys Tasks. */
xTaskCreate((TaskFunction_t) _SYS_Tasks,
"Sys Tasks",
1024, NULL, 1, NULL);

/* Create OS Thread for APP Tasks. */
xTaskCreate((TaskFunction_t) _APP_Tasks,
"APP Tasks",
1024, NULL, 1, NULL);

/**************
* Start RTOS * 
**************/
vTaskStartScheduler(); /* This function never returns. */

}

any pointers woud be greater appreicated.

andrewfrazer wrote on Monday, February 22, 2016:

Stepping through the debug, vApplicationMallocFailedHook() is being called by *pvPortMalloc.

Im at a loss to know why pvReturn == NULL

rtel wrote on Monday, February 22, 2016:

Have a look at http://www.freertos.org/a00111.html - it sounds like you
need to increase the size of configTOTAL_HEAP_SIZE, but it is also
likely you could decrease the size of the stacks allocated to the tasks too.

Once the tasks are running you can use <a
href=http://www.freertos.org/uxTaskGetStackHighWaterMark.html">uxTaskGetStackHighWaterMark()
to see how much stack the tasks are actually using, and then reduce the
amount of stack (which can be done in the configuration) accordingly so
memory is used efficiently.

Regards.

andrewfrazer wrote on Monday, February 22, 2016:

I increased TOTAL_HEAP_SIZE to 100240 ( from 10024 ) and reduced the size of the stacks, but got the same result.

andrewfrazer wrote on Monday, February 22, 2016:

changed things to heap4 and its working! Seems that heap5 needs some extra configuraion.

rtel wrote on Monday, February 22, 2016:

The link sent previously provides information on the initialisation
required for heap_5.