Skip to content
GeMRTOS
GeMRTOS

The Generic eMbedded Multiprocessor RTOS

  • Home
  • Download Now!
  • GeMRTOS
    • License
    • Download
    • GeMRTOS Documentation
      • Documentation Browser
      • GeMRTOS Manuals
    • GeMRTOS repository
  • Log in
  • Contact us
Search
GeMRTOS
GeMRTOS

The Generic eMbedded Multiprocessor RTOS

  • Download Now!!!
  • GeMRTOS
    • License
    • Download now!
    • GeMRTOS documentation
    • GeMRTOS repository
  • Login
  • Contact us
  • FPGA Laboratory ACCESS
  • Cursos de FPGA (en español)
  • Challenges
GeMRTOS
GeMRTOS

The Generic eMbedded Multiprocessor RTOS

  • Home
  • Download Now!
  • GeMRTOS
    • License
    • Download
    • GeMRTOS Documentation
      • Documentation Browser
      • GeMRTOS Manuals
    • GeMRTOS repository
  • Log in
  • Contact us
Search
GeMRTOS
GeMRTOS

The Generic eMbedded Multiprocessor RTOS

  • Download Now!!!
  • GeMRTOS
    • License
    • Download now!
    • GeMRTOS documentation
    • GeMRTOS repository
  • Login
  • Contact us
  • FPGA Laboratory ACCESS
  • Cursos de FPGA (en español)
  • Challenges

GeMRTOS - Getting started

  • Introduction to GeMRTOS
  • Getting Started with GeMRTOS: Multiprocessor RTOS for Altera FPGA (Nios II & Nios V)
  • API references
  • Platform Designer Flow for GeMRTOS Nios V FPGA Development
  • GeMRTOS RTOS Task Periods: Infinite Loop vs Periodic Tasks
  • Install Quartus Prime and WSL for GeMRTOS Nios V on Windows

GeMRTOS - Features

  • GeMRTOS Mutex and Critical Sections in Multiprocessor RTOS
  • GeMRTOS Signals: Runtime Exception Handling for Nios V RTOS
  • GeMRTOS System Architecture – Multiprocessor Design with Altera Nios V Processors
  • Hybrid Partition Scheduling in GeMRTOS, Multiprocessor RTOS for Altera FPGA
  • GeMRTOS Scheduling Lists: EDF and Fixed Priority RTOS Guide
  • GeMRTOS Tasks: Types, Creation, and Scheduling for Nios V
  • GeMRTOS Trigger Resources: Event Handling Beyond Interrupts
  • GeMRTOS Controller: Complete FPGA RTOS Hardware Guide
  • Data Structures in GeMRTOS: Control Blocks and Linked Lists
  • GeMRTOS Semaphores: Binary and Counting API for Nios V RTOS

General

  • Error (16031): Current Internal Configuration mode does not support memory initialization or ROM. Select Internal Configuration mode with ERAM.
  • newlib Thread Safety in GeMRTOS Nios V Multiprocessor RTOS
  • Set Up Questa-Intel FPGA Edition License for GeMRTOS Nios V
  • Installing Nios II Software Built Tools (SBT) for Eclipse in Quartus Prime starting from version 19.1
  • Fix Quartus Prime 23.1 Fatal Error When Creating ALTPLL IP
  • Fix Missing SDRAM Controller IP in Quartus Prime for GeMRTOS
  • GeMRTOS Nios: Fix 256MB Compile Boundary with -relax-all
  • Questa Simulation Setup for GeMRTOS Nios V: Two Common Fixes
  • Quartus Warning 113015: mem_init.hex Width Mismatch BSP Fix
  • GeMRTOS Secondary Processors Not Booting: nios2-download Fix
  • Fix Quartus Prime System Console: jvm.dll and awt.dll Errors
  • Eclipse does not start after full Quartus Prime instalation
  • Home
  • GeMRTOS KnowledgeBase
  • GeMRTOS
  • GeMRTOS Tasks: Types, Creation, and Scheduling for Nios V

GeMRTOS Tasks: Types, Creation, and Scheduling for Nios V

In GeMRTOS on Altera FPGA platforms with Nios V processors, a task is the fundamental unit of execution. Every task consists of three components: a GS_TCB (Task Control Block) that stores task management data, the task code (a subroutine function loaded into system memory), and a task stack that preserves the suspended task’s state so it can be resumed correctly. Stack memory is reserved at task creation time. This guide covers the five GeMRTOS task types and the core task API functions.

GeMRTOS Task Types #

GeMRTOS defines five task types. Additional types can be defined to extend the system:

  • G_TCBType_OneShot — the task code executes once per release. If the task code does not contain an infinite loop, the task must be re-released for each subsequent execution. Initialization tasks are commonly implemented this way. When implemented as an infinite loop, the task runs continuously and can monopolize processor time — use one of these strategies to prevent starvation:
    • Assign the lowest priority so the task runs only when higher-priority tasks are idle.
    • Suspend the task inside the loop waiting for a timed or trigger event.
    • Reduce the task priority inside the loop to yield to newly ready higher-priority tasks.
    • Define a round-robin scheduling mechanism on the scheduling list to share processor time equally.
  • G_TCBType_Periodic — the task code executes periodically. The period and initial offset are configured when the type is specified and determine all future release times. If a previous invocation does not complete before the next release, it can be configured to abort the previous invocation or skip the next release. Periodic tasks are suited for cyber-physical applications requiring compliance with the Nyquist-Shannon sampling theorem. Schedulability analysis is recommended to avoid deadline misses under high load.
  • G_TCBType_ISR — the task is associated with a trigger resource and acts as an Interrupt Service Routine. The task type is set after creation using the gu_TriggerRegisterTask function.
  • G_TCBType_IDLE — the task executed by a processor when no other task requires execution. One IDLE task exists per system processor. By default, the IDLE task puts the processor into sleep mode to save energy and reduce system bus utilization.
  • G_TCBType_Periodic_Skip — declared in the task-type enumeration alongside G_TCBType_Periodic. The kernel currently schedules it identically to G_TCBType_Periodic.

Task API Reference #

Creating a Task #

Create a new task with default settings using:

void *gu_TaskCreate(void *TaskCode, void *p_arg, char *format,  ...);

The gu_TaskCreate function creates a task and returns a pointer to its GS_TCB structure. Task parameters can be adjusted before creation by modifying default settings, or after creation using task-related functions. The function accepts an optional printf-style format string to assign a human-readable description to the task.

ParameterDescription
TaskCodePointer to the function that implements the task’s code (the task entry point).
p_argPointer to the argument passed to TaskCode on each invocation. Cast to the required type within the task code.
formatPrintf-style format string to create a task description (up to G_TCB_DESCRIPTION_LENGTH characters). Supports format specifiers replaced by subsequent arguments.

Returns: pointer to the GS_TCB structure of the newly created task. NULL indicates failure.

Starting Task Execution #

Schedule a created task to begin execution with an optional time offset using:

G_INT32 gu_TaskStartWithOffset(GS_TCB *ptcb, unsigned int hours, unsigned int minutes, unsigned int seconds, unsigned int ms);

The gu_TaskStartWithOffset function starts a previously created task, with an optional delay before its first execution. The offset is measured from the time the function is called.

ParameterDescription
ptcbPointer to the GS_TCB structure of the task to start (returned by gu_TaskCreate).
hoursHours component of the start offset.
minutesMinutes component of the start offset.
secondsSeconds component of the start offset.
msMilliseconds component of the start offset.

Returns: G_TRUE on successful task startup.

Suspending a Task for a Time Interval #

Suspend the currently running task for a specified duration using:

G_INT32 gu_TaskDelay(G_INT32 hours, G_INT32 minutes, G_INT32 seconds, G_INT32 ms);

The gu_TaskDelay function suspends the calling task for the specified time interval. Commonly used inside a G_TCBType_OneShot infinite loop to create periodic-like behavior without using a periodic task type.

ParameterDescription
hoursHours to suspend.
minutesMinutes to suspend.
secondsSeconds to suspend.
msMilliseconds to suspend.

Returns: always G_TRUE.

Key Takeaways #

  • Every GeMRTOS task on Nios V FPGA is defined by three components: a GS_TCB control block, task code (subroutine function), and a task stack allocated at creation time.
  • G_TCBType_OneShot tasks execute once per release — use priority assignment, event suspension, priority reduction, or round-robin scheduling to prevent infinite-loop variants from starving other tasks.
  • G_TCBType_Periodic tasks are released at fixed intervals and are the correct choice for signal-processing applications that must comply with the Nyquist-Shannon theorem.
  • G_TCBType_ISR tasks are linked to trigger resources via gu_TriggerRegisterTask; G_TCBType_IDLE tasks run when no other task is ready and put the processor to sleep by default.
  • Use gu_TaskCreate to allocate a task, gu_TaskStartWithOffset to schedule its first execution, and gu_TaskDelay inside the task body to yield the processor for a fixed interval.
Avalon MM, GeMRTOS, Nios 2, Nios V, RISC-V
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • GeMRTOS Task Types
  • Task API Reference
    • Creating a Task
    • Starting Task Execution
    • Suspending a Task for a Time Interval
  • Key Takeaways

Copyright © 2026 - contact us - Dorrego 287 - B8000FLE - Bahía Blanca - Argentina - +542914311867  GeMRTOS

Nios II, Nios V, Quartus Prime, ModelsSim are property of their respective companies.
GeMRTOS is property of R. Cayssials.
**All contact forms on this site are protected by reCAPTCHA. Google Privacy

GeMRTOS joins Intel Partner Alliance as Gold member.