Quality RTOS & Embedded Software

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


Porting FreeRTOS to AT89LP

Posted by babicka_baba on March 2, 2013
Hello everybody,
I just got a school assignment that requires me to write a small embedded application with some RTOS. At the same time, I have a work assignment to rewrite firmware for our legacy hardware using the AT89LP4052 microcontroller from the 8051 family. This led me to idea that I could do both at once, and real-time scheduling would actually ease the development of the application. Googling around a bit, it turns out that 8051 family is not well supported among RTOSes. The only RTOS that claims official support for AT89s is RTX51 tiny, but since this is a small project, the cost is prohibitive.

Out of the free variants, FreeRTOS is the only one to claim at least SOME support for 8051, but the controller in the demo (​C8051F) seems quite different. Now, the question is: could anyone give a rough estimate how much effort would it take to port FreeRTOS to AT89? Or would that be possible at all given the very limited computing resources? I really only need scheduling. I do not have much microcontroller experience, I come from the PC world, but I think I learn pretty quickly :-)

Thanks very much for any hints!

RE: Porting FreeRTOS to AT89LP

Posted by Dave on March 2, 2013
You will not get a preemptive OS running on a device with so little RAM. There are cooperative and run to completion products that might work.

RE: Porting FreeRTOS to AT89LP

Posted by babicka_baba on March 2, 2013
Thanks very much for the quick reply! I dare asking few more questions :-)

There is some support for cooperative multitasking in the FreeRTOS, namely co-routine support and configUSE_PREEMPTION flag. Would any of this let me get away with this little RAM or do I need something much more lightweight than FreeRTOS?

I tried Googling for a cooperative RTOS, but mostly found only code snippets and nothing that would really look like RTOS, the only exception being QP Nano and MiCOS. Is this because cooperative multitasking is so simple it is not worth an actual RTOS? Or could you point me towards some interesting variants?

Best regards

RE: Porting FreeRTOS to AT89LP

Posted by Richard Damon on March 2, 2013
The problem you will run into is that even though you are only using co-routines, FreeRTOS is still based on a model that supports true multi-tasking, which will tax the capabilities of a processor as small as the 8051.

It might be possible to look at how co-routines are implemented and do something similar after stripping out the multi-tasking code. This might end up being too small of an OS to qualify for the school assignment, although you may get extra credit for actually building the RTOS instead of just using one.

RE: Porting FreeRTOS to AT89LP

Posted by babicka_baba on March 2, 2013
Turns out the correct Google phrase was "Non-preemptive rtos" :-) I actually found something useful! Now its time to try that out....
If there is any way to use FreeRTOS in a non-preemptive way with very little ( < 64B) RAM, let me know!

RE: Porting FreeRTOS to AT89LP

Posted by babicka_baba on March 2, 2013
Oh, beaten. Thanks for the info!

RE: Porting FreeRTOS to AT89LP

Posted by Richard Damon on March 2, 2013
64 Bytes of RAM is probably too little Ram for FreeRTOS, as even with configUSE_PREEMPTION set off, it is still based on a preemptive model (it just won't do a preemptive task switch). with only 64 bytes, you probably can't even have two tasks, each with their own full stack frame. That really is a VERY small machine. I suspect that at that size the only thing that will fit would be something based on a model similar to FreeRTOSs co-routines (or the Timer call back method), with no support for anything more complicated, as this model does not need multiple stack frames.

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

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

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


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





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