Difference between revisions of "Freertos posix Development"

From OpenCircuits
Jump to navigation Jump to search
(add introduction)
(link to more general article)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This wiki describes the development of freertos_posix - a POSIX wrapper for [http://www.freertos.org/ FreeRTOS]. The wrapper has been used for deploying the [[DsPIC30F 5011 Development Board | dsPic33 development board]].
+
This wiki describes the development of freertos_posix - a POSIX wrapper for [http://www.freertos.org/ FreeRTOS], a popular open-source [[RTOS]]. The wrapper has been used for deploying the [[DsPIC30F 5011 Development Board | dsPic33 development board]].
  
 
==Introduction==
 
==Introduction==
Line 18: Line 18:
 
#Time and clock functions (e.g. time and clock): using the context switch timer required in FreeRTOS (time.h)
 
#Time and clock functions (e.g. time and clock): using the context switch timer required in FreeRTOS (time.h)
 
#Socket API: mapped to uip: Please note that the socket API is only posix-like and it is NOT compatible with standard POSIX operation.
 
#Socket API: mapped to uip: Please note that the socket API is only posix-like and it is NOT compatible with standard POSIX operation.
 +
#File system operations: mapped to FatFs. (under development)
 
*Extra functions include:
 
*Extra functions include:
 
#a coroutine task scheduler, in order to run multiple POSIX threads in a single FreeRTOS Task (see pthread.c and system.c)
 
#a coroutine task scheduler, in order to run multiple POSIX threads in a single FreeRTOS Task (see pthread.c and system.c)

Latest revision as of 16:00, 25 February 2025

This wiki describes the development of freertos_posix - a POSIX wrapper for FreeRTOS, a popular open-source RTOS. The wrapper has been used for deploying the dsPic33 development board.

Introduction

  • freertos_posix is a POSIX wrapper for FreeRTOS.
  • The platform independent files (apart from those those under /posix/asm-dsPic) are saved under /posix.
  • Platform dependent files (such as drivers) are stored under demo_posix/xxx, where xxx is the name of your target platform.


Source Code Repository

  • The most up-to-date development can be found at repository freertos_posix


Features

  • Not all POSIX functions are implemented, the followings are the major functions developed. You are invited to contribute new functions and improve the existing ones.
  1. POSIX Thread: mapped to FreeRTOS task (pthread.h, and unistd.h)
  2. Mutex functions: mapped to FreeRTOS semaphore
  3. Filestream operations (e.g. open, read, write, lseek, etc): not associated with any FreeRTOS functions (unistd.h)
  4. Time and clock functions (e.g. time and clock): using the context switch timer required in FreeRTOS (time.h)
  5. Socket API: mapped to uip: Please note that the socket API is only posix-like and it is NOT compatible with standard POSIX operation.
  6. File system operations: mapped to FatFs. (under development)
  • Extra functions include:
  1. a coroutine task scheduler, in order to run multiple POSIX threads in a single FreeRTOS Task (see pthread.c and system.c)
  2. dsp library API


Documentations

  • You can also generate HTML documentations in the source code using doxygen
    • Goto /posix and use the Doxyfile to generate documentation under /posix/doc


Architecture

  • Refer to software architecture from here


POSIX Threads Scheduler

  • The task scheduler is based on FreeRTOS incorporating coroutine developed by Simon Tatham. The scheduler API is wrapped by the POSIX Thread API.
    • e.g. pthread_create(), usleep(), etc.


POSIX Driver Development

  • Software drivers are developed to allow users at Application Level to use the hardware (e.g. ADC, DAC, UART, NVM etc) through the POSIX System call API.
    • e.g. open(), write(), read(), ioctl(), lseek(), etc.
  • An example of how to develop drivers for Microchip dsPic33 devices can be found here


Power Management

  • to be added