Quality RTOS & Embedded Software

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




Loading

Low Pwr + IdleTask + TaskDelete() Question

Posted by https://www.google.com/accounts on November 30, 2009
I realize that when using the TaskDelete() API call the IDLE task must have time to clean up delete task resources. However, if one added a IdleTaskHook to the IDLE task, does the IDLE task clean up the resources prior to invoking the hook method? For example (PIC32):

void vApplicationIdleHook( void )
{
// Idle task runs and clean up
// delete task resource prior to
// invoking this method?
// Then enter low-power state
PowerSaveIdle();
}

RE: Low Pwr + IdleTask + TaskDelete() Question

Posted by https://www.google.com/accounts on November 30, 2009
Hopefully, this will clean up the code I posted....

void vApplicationIdleHook( void ) <\br> { <\br>// Idle task runs and clean up <\br>// delete task resource prior to <\br>// invoking this method? <\br>// Then enter low-power state PowerSaveIdle(); <\br>}

RE: Low Pwr + IdleTask + TaskDelete() Question

Posted by Dave on November 30, 2009
Sorry, new to markdown syntax...

void vApplicationIdleHook( void )
{
// Then enter low-power state
PowerSaveIdle();
}

RE: Low Pwr + IdleTask + TaskDelete() Question

Posted by Dave on November 30, 2009
Seems if you add a tab as the first character on each code line then the code prints out with the wanted formatting.

Regarding the idle task. The idle task does something like this

void TheIdleTask( void* pv )
{
for(;;)
{
CleanUpDeletedResources();
CallIdleHook();
}
}

This is simplified admittedly, but you cannot say which of the two function calls comes before the other because FreeRTOS is a pre-emptive system. It will start running from the place it last stopped running, which could be anywhere in its implementation. If it starts running just before CallIdleHook() then it will not have cleaned up the resources first, but it will do as soon as it leaves CallIdleHook().

RE: Low Pwr + IdleTask + TaskDelete() Question

Posted by Dave on December 1, 2009
Hi Dave.

The markdown syntax on SourceForge doesn't seem to comply strictly with the spec in the link provided. I did eventually figure out 4 (or more) spaces or a tab work,but there doesn't seem to be a clean way to post indented code...that said,

Thanks also for pointing out what I neglected to consider; that FreeRTOS will clean up the resources after if not before the power down mode is used due to preemption. What I wanted to nail down is if there is a more better or smarter way to enter idle without eating up resources, that is, assuming an application creates and distroys tasks frequenly. This represents a 40% power savings in my case. I ran the example (example 9 in Richard's PIC32 FreeRTOS book) that deos creates and deletes a task in a tight loop overnight with no issues. This seems to confirm the validity of this technique unless anyone has any advice.

Dave


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists