0

I just started learning FreeRtos. I have started with "Using the FreeRtos Real Time Kernel" pdf book of Richard Barry. The book has comprehensive examples and I understood the principles very well but I want to be able to compile this examples somewhere.

Now this may sound like a dumb question but I'm totally new to RTOS :D. What compiler can I use to compile freeRtos code? I have googled a lot and I found some compiler named Watcom and tried to run some code in it but couldn't and could not find any examples on how to use this compiler.

So basically what I would like is some examples of actually someone showing how to run simple freeRtos code in a compiler then run it and see the actual results in a console.

Any links would be appreciated. Thank you for reading!

Cantafford
  • 31
  • 1
  • 7

3 Answers3

2

FreeRTOS supports a large range of compilers. The officially supported compilers for each officially supported port are listed on the Official FreeRTOS Ports page.

You can use any of the compilers listed (and probably more, but they won't be officially supported). In general, you should be able to keep using what you already use, since FreeRTOS typically supports the standard vendor-supplied compiler of whatever platform you are using.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • 1
    Thank you for answering. I'm little bit less confused now. I see in that list you provided FreeRTOS supports "Visual Studio 2010 Express" compiler. If I write some C FreeRTOS code in this compiler just like I would do a normal .c program will it work fine? Also please explain what is a "port" when talking about RTOS. Thank you. – Cantafford Jun 30 '17 at 15:22
  • @Cantafford : The use of Visual Studio (or at least Visual C++ - VS is an IDE not a compiler) to build FreeRTOS applications only applies to the [Win32Port](http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html). This is a _simulation_ platform and does not perform true real-time scheduling. The simple answer to your question is you use the tool-chain appropriate to your target platform. You can of course use Visual Studio Community Edition with [VisualGDB](http://visualgdb.com/toolchains/embedded) for embedded development. – Clifford Jul 05 '17 at 14:09
  • A FreeRTOS "port" is a port of the FreeRTOS codebase to a specific architecture or platform. Figure out what hardware you are going to run FreeRTOS on first, then select the compiler that supports your platform _and_ is supported by FreeRTOS. Even if it is not supported, porting the FreeRTOS code (thus generating a new "port") is feasible, but unlikely to be necessary unless you choose a particularly obscure target and toolchain combination. – Clifford Jul 05 '17 at 14:13
  • @Cantafford Note you should post new questions _as_ questions rather then hide them in comments. – Clifford Jul 05 '17 at 14:14
2

Normally you run a FreeRTOS application in a stand-alone environment - ie, the system boots directly into your application rather then being loaded by an OS (there may be an intermediate bootloader in some cases).

There is no concept of a "console" in FreeRTOS itself; your application must implement support for stdio or low-level I/O, typically via a UART and a terminal emulator running on the development host or by using semi-hosting via your debugger. This is a mater of porting your standard library rather than an issue for FreeRTOS. The standard library should have some sort fo pirting layer (known as "syscalls" in Newlib, or "Retargetting" in ARM/Keil toolchains for example).

FreeRTOS applications are built using cross-development tools rather than hosted development environments. That is the code is build on a development host using a cross-compiler then loaded to the target hardware and executed. There is a Win32 port of FreeRTOS that allows FreeRTOS applications to be built and executed on a Windows host, but the port is only a simulation, and does not provide hard-real-time scheduling. It is useful for development before hardware is available and testing and debugging using the more sophisticated debugging environment provided by Visual Studio that that typically available to embedded targets.

What you would normally do is select a hardware platform that FreeRTOS supports and meets your application needs, then select a toolchain that supports your hardware platform and is in turn supported by FreeRTOS. For most 32 bit platforms and the 8-bit AtmelAVR platform GNU gcc is near ubiquitous, and many proprietary compilers support GNU extensions for compatability. Unless you choose a particularly obscure toolchain/target combination, you are unlikely to not be able to either port to use an existing port of FreeRTOS.

Clifford
  • 88,407
  • 13
  • 85
  • 165
1

You can use System Workbench for STM32 if you are using a STM32 based board. System Workbench utilized GCC based compiler and it is very enjoyable to use. You can easily download the wholly cross-platform IDE and the compiler tool from the following link:

System Workbench for STM32

Mete Cantimur
  • 1,371
  • 12
  • 11