Nios® V Processor Software Developer Handbook

ID 743810
Date 7/08/2024
Public
Document Table of Contents

4.3.2.4. Configuring FreeRTOS*

Consider the following properties if you are using the FreeRTOS* environment:

  • FreeRTOS BSP settings: The FreeRTOS supports advanced configuration options. All these options can be enabled and disabled with BSP settings.
  • FreeRTOS setting modification: Modifying the FreeRTOS options modify the system.h file, which is used to compile the BSP library file.
  • FreeRTOS initialization: The core FreeRTOS is initialized during the execution of alt_main(), which is called from the C run-time initialization (crt0) code block. After the crt0 code block runs, the FreeRTOS resources are available for your application to use.

You can configure FreeRTOS with the BSP Editor as shown in the following figure :

Figure 5.  FreeRTOS* Configuration in the BSP Editor
  • Specify heap_4.c source file
  • Maximum number of priorities at 7
  • Minimum stack size at 300
  • Enable the FreeRTOS features.

Alternatively, you can use the following FreeRTOS Tcl script to perform the same setting as shown in the figure above.

Configuring FreeRTOS using Tcl script

#Specify heap method
set_setting freertos.heap_method 4

#Enable FreeRTOS features
set_setting freertos.os_port_has_mtime 1 
set_setting freertos.os_thread_safe_c_library 1 
set_setting freertos.os_use_preemption 1
set_setting freertos.os_use_16_bit_ticks 1

#Specify maximum number of priorities supported
set_setting freertos.os_max_priorities 7

#Specify minimum stack size
set_setting freertos.os_min_stack_size 300