Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Task is not starting

Posted by Bart on June 3, 2010
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 should only turn one led off.

RE: Task is not starting

Posted by Bart on June 3, 2010
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?

RE: Task is not starting

Posted by Bart on June 3, 2010
4*1024 of course.

RE: Task is not starting

Posted by Dave on June 3, 2010
“But can anyone tell why?”


I can only speculate that 1024 is not big enough. You don't say which CPU you are using or what configMINIMAL_STACK_SIZE is set to.

Did you check the return value of xTaskCreate()?

Did you check to see if vTaskStartScheduler() returned?

If you are using heap_1.c or heap_2.c then you can call xPortGetFreeHeapSize().

RE: Task is not starting

Posted by Bart on June 3, 2010
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?


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS