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


while (1) loop in the main function vs. FreeRTOS

Posted by tahirnaseer on November 11, 2014


I am trying to implement FreeRTOS on controller with specific API calls. In the bare controller example, there are a few commands which are used at the beginning and end of while(1) loop in main as follows:

void main (void) { ... while(1) command1();

/* your application code here */



It is mandatory to used command1 and command2. Where in FreeRTOS should I write calls to command1 and command2 functions? }

while (1) loop in the main function vs. FreeRTOS

Posted by rtel on November 11, 2014

I'm not sure I understand your question. Let me state it back to see if I have it right.

Currently you have a non-RTOS application that is structured as follows:

while( 1 )
    /* Must be called before application code. */

    /* Application code goes here. */

    /* Must be called after application code. */

now you want to implement the same thing but using the RTOS.

If so then the first thing to say is you could just create that function as a task and have it run. If it does not block and you have other tasks running it would have to be a low priority though.

Other than that any answer would depend on the what command1() and command2() were, what is their purpose, what are their processing requirements, and what relation (if any) do they have to the application code.

For example, does command2() use a value calculated by the application code, in which case it must be executed exactly once after each execution of the application code.

Or alternatively is command2() completely unrelated to the application code but needs to be called either periodically or as fast as possible.


[ 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