Nios updated port for NiosEDS 9.1 and 10.0

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 www.freertos.org .  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 FreeRTOS_Demo.zip 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 FreeRTOS_Demo.zip 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.


YOu can also check out FreeRTOS on the nioswiki



Please sign in to leave a comment.