FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2011 Threads] Code inside vs. outside tasksPosted by on November 4, 2011 Hi!
I have a general question regarding tasks. Let's say that I have non-RTOS code that I would like to convert to a FreeRTOS task. The existing code performs some initialization (e.g. HW setup) only at startup and then enters the main program loop. Now if I move the code to FreeRTOS I could put all the code as is including those initialization stiff inside a task function or I could try to isolate the init stuff into my main() so that it runs before the scheduler is started. Only the main program loop would then go into the task function. Are there any benefits (e.g. resource saving) that are worth that additional program modification? Thank you in advance for the clarification.
Regards, Anguel
RE: Code inside vs. outside tasksPosted by Dave on November 4, 2011 Normally hardware would be set up before the scheduler was started. You can disable interrupts if necessary, as they will be automatically be re-enabled when the first task starts.
RE: Code inside vs. outside tasksPosted by on November 4, 2011 Thank you very much for the help.
RE: Code inside vs. outside tasksPosted by Richard Damon on November 4, 2011 My general rule is hardware initilzation (which tends to want to be done before interrupts are put "on the air") and the creating of communication resources (queue, semaphores, and mutes) generally want to be done before the scheduler starts. Sometimes a device needs a longer "configuration" protocol that might go into the beginning of a task, especially if it needs delays or interrupt responses.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|