Freertos posix Development

From OpenCircuits
Jump to navigation Jump to search

This wiki describes the development of freertos_posix - a POSIX wrapper for FreeRTOS. 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