Porting FreeRTOS to AT89LP

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!
Martin

Porting FreeRTOS to AT89LP

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.

Porting FreeRTOS to AT89LP

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
Martin

Porting FreeRTOS to AT89LP

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.

Porting FreeRTOS to AT89LP

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!

Porting FreeRTOS to AT89LP

Oh, beaten. Thanks for the info!

Porting FreeRTOS to AT89LP

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.