Showing results for 
Search instead for 
Did you mean: 


FreeRTOS™ is a portable, open source, mini Real Time Kernel written by Richard Barry - a free to download and royalty free RTOS that can be used in commercial applications. More general information about FreeRTOS can be found at

An experimental adaptation of FreeRTOS that runs on NIOS II is available for download from

FreeRTOS V5.4.2 is the first version to include a Nios II port and demo application in the main .zip file download. See for more details.

FreeRTOS update for 9.1 and 10.0

13 July 2010 cjr

The original port only supports the old IRQ api (9.0) these updated files do the following

  • Update FreeRTOS to support the new and old IRQ/ISR API. It has not been tested with an external VIC, but should theoretically work with it since it only uses HAL routines and only overwrites "alt_iic_isr_register" and "alt_irq_register" that change just disables the call to "alt_irq_enable_all". This is presumable done elsewhere in the kernel.
  • Made the FreeRTOS a full fledged member of the BSP supported OSes.
  • Made the Example Demo Software an official template so it can be selected just like hello_world.


To run the FreeRTOS Demo the following hardware is required

  • 9 MBytes of ram ( ddr,sdram,ssram )
  • led_pio ( the demo uses 8 LEDs it can run with less) named "led_pio"
  • jtag_uart ( this is where print message will end up)
  • Inerval timer at 10ms or slower named "sys_clk_timer" or "sys_clk"
  • Avalon UART which has been looped back externally. Or looped back in the top level of the fpga design. Named "uart" or "uart1"
  • and a Nios.

Most standard Nios designs for Altera dev boards have all of these except possibly the UART. But it is easy to add the uart to the design and just connect the tx to the rx at the top level.

Clearly if you want to change the code you can remove most of these restrictions. But these are the requirements for the "out of box" experience.

Installation instructions

  1. Download (do not run) the latest FreeRTOS Realtime Kernel from I used the 6.0.5 build.
  2. After the executable is safely on your drive, run it and have it install in your active quartus ip directory. So for quartus 10.0 have it install in "c:\altera\10.0"
  3. Copy the  FreeRTOS_sw.tcl (below)file to c:\altera\ip\10.0\FreeRTOS subdirectory, that was created durring FreeRTOS installation. The FreeRTOS directory should now contain, Demo, License, Source, TraceCon and FreeRTOS_sw.tcl files and directories.
  4. Copy the port.c (below) to the C:\altera\10.0\ip\FreeRTOS\Source\portable\GCC\NiosII and overwrite the file there.
  5. If you are using 9.1 rename port_asm.S to port_am.s in directory C:\altera\10.0\ip\FreeRTOS\Source\portable\GCC\NiosII
  6. The next steps involves creating a FreeRTOS Demo template for the Software build Tools. You can either simply unzip the into the C:\altera\10.0\nios2eds\examples\software directory or follow steps 7-9 to create your own using that latest builds of FreeRTOS.
  7. If you don't use the then start by creating a FreeRTOS_Demo directory in C:\altera\10.0\nios2eds\examples\software
  8. Copy ParTest ( and all its sub folders and files), Common_Demo_Tasks ( and all its sub folders and files), and FreeRTOSConfig.h from C:\altera\10.0\ip\FreeRTOS\Demo\NiosII_CycloneIII_DBC3C40_GCC\RTOSDemo to the new FreeRTOS_Demo directory.
  9. Copy main.c serial.c (below) to the new FreeRTOS_Demo directory.

Now your should be read to go.

To test your FreeRTOS OS installation

  • In the Nios Software Build tools for eclipse, choose File ->New -> Nios II Board Support Package
  • In the dialogue box that appears you should be able to select "Real Time Engineers Ltd FreeRTOS 6.0.5" if you choose a .sopcinfo file you should be able to build a BSP.

To test your application

  • In the Nios Software Build tools for eclipse, choose File ->New -> Nios II Application and BSP from Template
  • Here you should be able to select FreeRTOS_Demo and build a system.


· - bundled Demo

·      FreeRTOS_sw.tcl - sw tcl file -- this is the magic that make the tools recognize this OS

·      main.c - This is essantially the same file that comes with the standard Demo I just added a "." that prints every 5 seconds

·      port.c - Updated ports.c that uses the new API and provides the new irq/isr register function

·      serial.c - Changed this so that it suports the new API and uarts named UART or UART1

·      template.xml - This is the template file which is need to make this Demo accessable as a template.

Version history
Last update:
‎06-27-2019 12:33 AM
Updated by: