Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building FreeRTOS for x86

I read online that it was possible to build FreeRTOS on Windows for an external device. Can you build it for x86 on ubuntu?

Thanks

like image 513
Coder404 Avatar asked May 10 '12 21:05

Coder404


3 Answers

There are several things you can do on an X86 with FreeRTOS.

The first is to run FreeRTOS as the OS on the CPU. FreeRTOS is intended for microcontrollers, so only (officially) support real mode (16-bit). This is valid if you are running on something like a 186 based microcontroller, like those that used to be manufactured by AMD and then (now?) RDC. You can also run the code on any X86, but only in real mode, and it used to be the development platform for the core FreeRTOS code using tools such as Open Watcom. I'm not sure of an equivalent Linux hosted 16 bit compiler, but there might be one.

The other way of using FreeRTOS on X86 is to run the FreeRTOS simulator. When that is done, FreeRTOS is not the kernel running the CPU, but rather, Windows or Linux is running the CPU, but Windows or Linux threads run the FreeRTOS code. That is now the preferred way of doing core development work--but it is just a simulator, meaning the timing is all over the place and simulated time is much lower than real time (because the timing resolution and accuracy in Windows is so low compared to a real-time system).

The Windows simulator can be run with Visual Studio (free version), and that port is maintained. You can also use it with MingW and Eclipse, although the demo is less featured, and I believe there are some problems with later versions of Eclipse.

The Linux FreeRTOS simulator is a contributed port, so I can't really comment on it.

Windows simulator page: http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html

Linux simulator page: http://www.freertos.org/FreeRTOS-simulator-for-Linux.html

Regards.

like image 165
Richard Avatar answered Nov 20 '22 17:11

Richard


According to the FreeRTOS ports page the supported tools for x86 builds are:

  • Visual Studio 2010 Express
  • MingW
  • Open Watcom
  • Borland
  • Paradigm

so the answer to your question would appear to be no.

Since the above are all Windows-based tools I would guess that you need a Windows PC to build an x86 version of FreeRTOS, although you might be able to use an emulator such as WINE under Ubuntu.

like image 34
Paul R Avatar answered Nov 20 '22 16:11

Paul R


I do NOT know how to build FreeRTOS to run as the OS on a full-blown x86-based computer, but I'd really like to know myself!

How to build and run freertos on Linux

However, I can say I was able to run the FreeRTOS simulator on Linux pretty easily. I can't really comment on how "real time" it is, per say (it explicitly states it is NOT real time since it runs on top of a non-real-time Linux kernel), but building and running it is super easy.

Get the source code here: https://github.com/FreeRTOS/FreeRTOS. Here is how to build and run the simulator on Linux:

git clone https://github.com/FreeRTOS/FreeRTOS.git --recurse-submodules
cd FreeRTOS/FreeRTOS/Demo/Posix_GCC
make

Now it is built. To run it, do:

./build/posix_demo

That's it! It works great! Here is that demo project: https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS/Demo/Posix_GCC.

You can then modify that project yourself to customize it for your exact needs and purposes. Just start with that demo as a baseline to get you started. It is a great little demo, with 2 tasks (threads) and a thread-safe queue (multi-producer/multi-consumer-compatible) to pass data between them.

References

  1. Main FreeRTOS Linux simulator reference page: https://www.freertos.org/FreeRTOS-simulator-for-Linux.html. You can see their build and run instructions there too.
like image 3
Gabriel Staples Avatar answered Nov 20 '22 18:11

Gabriel Staples