Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FreeRTOS+IO posix driver

Posted by andrewholt on September 12, 2016

I am using FreeRTOS V9.0.0, and I am investigating how to create a driver for (say) a uart or i2c that presents the posix/UNIX/Linux style API (I'm sure you know the one open,close, read,write, ioctl).

If somebody can direct me to a simple example I would be grateful.

Regards, Andrew


FreeRTOS+IO posix driver

Posted by rtel on September 12, 2016

You could look at http://www.freertos.org/io - but it has some issues - namely it is too complex to port as it supports multiple transaction modes. Sticking to a single transaction mode would have been better.


FreeRTOS+IO posix driver

Posted by richard_damon on September 12, 2016

For a UART, it should be THAT hard, as it is inherently a straming device, so a POSIX stream isn't that bad of a match. The challange with open, is that you aren't just writting an open for the serial port, but there is just a single open function that needs to handle EVERY device you want to connect to, and this goes and impacts the entire I/O file lib. You can look at an open source implementation like newlib for an example of how to do this. That implementation was designed to be somewhat extensible with hooks to let you add devices to the library.

I2C might be a bit tougher if you are actually expecting to use read/write to talk to the device, as I2C isn't a simple streaming protocal, but is block based with device specific headers for each block. On the Raspberry Pi, I2C is hooked in via ioctl for all transactions, but since all the calls are now very much device specific, since you don't have a 'big' OS getting in your way, it would be much better to just use a native I2C driver that you directly call, and not add a ioctl translation layer in the middle.


FreeRTOS+IO posix driver

Posted by andrewholt on September 12, 2016

Hi thanks for the link. That shows how an application would use the driver, what I am looking for is an example of a driver implementation.


FreeRTOS+IO posix driver

Posted by tlafleur on September 12, 2016

In my many years of doing embedded real-time software, I have found that adding layers like Posix just get in the way of efficient and clean drivers. Yes on the outside it looks to be a great academic exercise with a clean API, but in reality it just add to much overhead, and is NOT tailored to the often needed bit manipulation interface that we see in real world real-time driver.

my two bit worth...

On Mon, Sep 12, 2016 at 7:18 AM, Andrew Holt andrewholt@users.sf.net wrote:

Hi thanks for the link. That shows how an application would use the

driver, what I am looking for is an example of a driver implementation.

FreeRTOS+IO posix driver

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~

Tom Lafleur

Attachments

alternate (1940 bytes)


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner