[ ]
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT FreeRTOS+POSIX Contact / Enquiries


FreeRTOS+POSIX is still in the lab

FreeRTOS+POSIX is provided under the MIT open source license by Amazon Web Services.

We encourage you to give FreeRTOS+POSIX a try, but please be aware when doing so that the code is still in the lab, which means we have not yet completed our review and test quality control processes. Please use the forum for support, or contact us directly if you have a specific business interest.

FreeRTOS+POSIX Pre-configured Example

[FreeRTOS+POSIX Overview]

Overview

The pre-configured example documented on this page uses the FreeRTOS Windows port. It demonstrates how FreeRTOS+POSIX can be used to port a simple POSIX threading compliant application (in this case, an implementation of the actor model) to the FreeRTOS kernel. To demonstrate the concept, the application is built for execution on both Linux (which uses POSIX threads) and FreeRTOS.

On this page:

  1. The demo application
  2. Building and running the demo on Linux
  3. Building and running the demo using the FreeRTOS Windows port


The Demo Application

This demo creates two types of actors: dispatcher and workers. Dispatchers tell workers what to do by sending different types of messages to the works. Each time a worker receives a message it performs a predefined routine that is dependent on the message it received. At the end of the demo the dispatcher notifies the workers that there is nothing more to do and all actors (dispatcher and worker) terminate.

Each actor is a thread that is created using the POSIX pthread_create() function. Messaging is performed through queues using the POSIX mq_open(), mq_send(), mq_timedsend() and mq_receive() functions.


Building and Executing the Demo on Linux

  1. Download the posix_demo.c source file.

  2. Open a command line window and cd to the directory that contains the downloaded posix_demo.c source file.

  3. Compiler using the following command line:
    
    gcc -Wall posix_demo.c -lpthread -lrt -o posix_demo
    		

  4. Once built, execute the demo using the following command line.
    
    ./posix_demo
    		

Expected Output

...


Building and Executing the Demo using the FreeRTOS Windows Port

  1. Download the free 2017 (minimum) Community edition of Visual Studio for C/C++.

  2. Download and unzip the pre-configured example for Visual Studio.

  3. From within the Visual Studio IDE, open the solution file FreeRTOS_Plus_POSIX_with_actor.sln, which is located in the \FreeRTOS-Plus\Demo\FreeRTOS_Plus_POSIX_with_actor_Windows_Simulator folder of the unzipped files.

  4. From within the Visual Studio IDE, press F10 to build the project and start a debug session.

Note that FreeRTOS cannot return from main() without ending the entire application, so the native FreeRTOS API is used to create a task called vStartPOSIXDemo(), which then used to run the same actor demo as already demonstrated running on Linux.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ FreeRTOS Labs Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]




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