In GeMRTOS on Altera FPGA platforms with Nios V processors, signals handle exceptional conditions that may arise during runtime. A signal allows a task to execute associated callback code when a specific condition occurs — such as when a task is created, a resource is granted, or a task is blocked. GeMRTOS uses the GS_SCB (Signal Control Block) data structure to store signal information and links it to the appropriate data structures at runtime. The signal code is executed prior to the code of the task with which the signal is associated. Multiple signal types are supported, and additional types can be defined to extend the system.
What Are GeMRTOS Signals? #
A signal in GeMRTOS is a mechanism that binds a callback function to a specific runtime condition on a task, resource, processor, or event control structure. When the defined condition occurs, GeMRTOS executes the signal’s callback function before resuming the associated task’s normal execution. This allows application code to respond to exceptional system events without polling or restructuring task logic.
The GS_SCB structure stores the signal type, its execution priority (which determines the order of execution when multiple signals are pending), a pointer to the associated control structure, a pointer to the callback function, and an optional argument to pass to that function.
GeMRTOS Signal Types #
The following signal type is defined in GeMRTOS. Additional types can be defined to handle other runtime conditions:
- G_SCBType_TCB_ABORTED — fired when a task is aborted. A task abort occurs when a new release of a periodic task takes place before the previous invocation completes. The associated callback function is executed before the next instance of the task begins execution.
Signal API Reference #
Creating and Associating a Signal #
Create and associate a signal with a control structure using:
GS_SCB *gu_SignalCreate(enum scbtype type, G_UINT32 priority, void *pxcb, void *signal_code, void *signal_arg);The gu_SignalCreate function creates a signal of the specified type and associates it with a control structure. The priority assigned to the signal determines the execution order when more than one signal callback is pending.
| Parameter | Description |
|---|---|
Type | The signal type to associate, e.g. G_SCBType_TCB_ABORTED. |
Priority | Execution priority of this signal. Determines order when multiple signal callbacks must execute. |
pxcb | Pointer to the control structure to link the signal to. May be a resource, processor, task, or event control block. |
Signal_Code | Pointer to the callback function that implements the signal handler. |
Signal_Arg | Argument passed to the signal callback function when it executes. |
Returns: pointer to the newly created GS_SCB structure.
Key Takeaways #
- GeMRTOS signals bind callback functions to specific runtime conditions on Nios V FPGA RTOS, executing before the associated task resumes — enabling clean exception handling without polling.
- The GS_SCB structure stores all signal metadata: type, priority, associated control structure, callback pointer, and callback argument.
- G_SCBType_TCB_ABORTED fires when a periodic task’s new release occurs before the previous invocation completes — the callback runs before the next task instance starts.
- Signal priority controls execution order when multiple signals are pending on the same task; lower numerical values indicate higher priority consistent with GeMRTOS scheduling conventions.
- Signals can be associated with any GeMRTOS control structure — tasks, resources, processors, or events — making them a flexible cross-cutting mechanism for runtime exception handling.