Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner