Quality RTOS & Embedded Software

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




Loading

Delete

Posted by Braun on December 2, 2011
Hi,

Wenn ich den Task lösche wird er nicht mehr aufgerufen.
Was mache ich falsch?

void main ( void )
{

DVK_setLEDs(0x0000);
unsigned int i;

i = xTaskCreate( vZustand, "Zustand", 1000, NULL, 1, NULL );

if( i == pdTRUE) //Task Zusatndsmaschine erstellen und abfragen ob er erstellt wurde
{
vTaskStartScheduler(); //Scheduler starten
}
else
{
DVK_setLEDs(0x0001); //Anzeige Task nicht erstellt
}

while(1)
{
DVK_setLEDs(0x0001);
}


}
void vZustand( void *pvParameters )
{
const portTickType xDelay_ms = 100 / portTICK_RATE_MS;
for(;;)
{
switch (0)
{
case 0:
DVK_setLEDs(0x0000);
xTaskCreate( vTask10, "Task 10", configMINIMAL_STACK_SIZE, NULL, 2, &xTask10Handle );

vTaskDelay(xDelay_ms);
break;
default:
state=0;
}
}
}
void vTask10( void *pvParameters )
{

taskdelete++;
vTaskDelete( xTask10Handle );

}

RE: Delete

Posted by Richard on December 2, 2011
You haven't said what is not working, but.....

vTaskDelete( xTask10Handle );


If you are using an older version of FreeRTOS, try changing this line to:

vTaskDelete( NULL );

RE: Delete

Posted by Braun on December 2, 2011
Now the task is run 27 times. Then no more.
If I follow the debugging, I get the error message:
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;

RE: Delete

Posted by Richard on December 2, 2011
Which memory allocation method are you using? heap_1.c, heap_2.c, heap_3.c or your own implementation?

If you are using heap_1, switch to heap_2. See http://www.freertos.org/a00111.html

Regards.

RE: Delete

Posted by Braun on December 2, 2011
Thank you
I've also noticed it straight.
https://sourceforge.net/projects/freertos/forums/forum/382005/topic/3690913
But thank you again for your prompt assistance.


[ 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