I managed to adapt the FreeRTOS demo to my board, deleted all the demo tasks and began to work on my own. My problem is that Parport initialization of the LED’s is working (they turn on before any tasks and scheduler)
int main( void )
{
/* Setup any hardware that has not already been configured by the low
level init routines. */
prvSetupHardware();
xTaskCreate( vTestTaskB, "Hello", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
vTaskStartScheduler();
/* We should never get here as control is now taken by the scheduler. */
return 0;
}
Parport test is within the prvSetupHardware() function. But the simple task doesn’t start. Is it possible something went wrong in the task code and the processor got an error from the RTOS? Here’s the code for the task:
static void vTestTaskB( void *pvParameters )
{
AT91C_BASE_PIOA->PIO_SODR = (1<<17);
/* Tasks must be implemented as continuous loops */
while(1);
}
It turned out I had to change the configTOTAL_HEAP_SIZE from 1024 to 4*24 and everything goes as it was planned. But can anyone tell why? And how can I calculate the minimal heap size for my program?
I’m using Olimex SAM7-P64 board. My configMINIMAL_STACK_SIZE is set to 130. I did not check the return values of xTaskCreate(), nor vTaskStartScheduler. I’m using heap_2.c, but I don’t think I can debug the program, because it’s loaded into flash and for all I know, you can only add breakpoints if the program lies in ram. I’m sorry my questions can seem quite dumb, but I’m just starting my adventure with FreeRTOS and I’m trying to get to know it better. How are the return values related?