⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@arkadiuszwojcik
Copy link
Contributor

@arkadiuszwojcik arkadiuszwojcik commented Jan 19, 2026

This PR introduces FreeRTOS module for MicroZig and for now exposes RP2040 port only. Version for RP2350 will come later. I reconstruted miniaml version of PicoSDK headers neccesery for compilation so this code don't have to relay on full PicoSDK.

Right now module expose only few basic wrappers around FreeRTOS API, more will be added gradually.

Edit:
There are few ugly fragments in glue code (see hello_task.zig example), maybe somone will help me with that.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Lint Results

Found 4 issues on changed lines in 2 files:

  • modules/freertos/build.zig: 1 issue
  • modules/freertos/src/root.zig: 3 issues

@arkadiuszwojcik arkadiuszwojcik marked this pull request as draft January 19, 2026 16:38
@arkadiuszwojcik arkadiuszwojcik marked this pull request as ready for review January 19, 2026 16:40
@mattnite mattnite dismissed github-actions[bot]’s stale review January 19, 2026 20:04

Keep FreeRTOS naming conventions

.hash = "ssd1306_font_8x8-0.0.0-oGb_cERcAAA6NJzWDOMepgnY6r4blNEHjpkldDaRAui5",
},
.net = .{ .path = "../../../modules/network/" },
.freertos = .{ .path = "../../../modules/freertos/" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did you pull this from? I think it would be nice to be able to have a hash on this.

Did you have to make any modifications?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is new module created be me and sits next to lwip or fundation-libc. This module pulls freertos source code as dependency and provide glue code to produce zig wrapper around it.


pub fn xTaskCreate(
task_function: c.TaskFunction_t,
name: [*:0]const u8,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we should make this a normal string, maybe provide a helper to convert it (though that might require alloc + copy to fit the null byte?). Similarly, should we provide nicer types for the handle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is debatable, at this point task name have probably no other purpose than some debug/informational one so it is used internaly by FreeRTOS only, so there is no point to do extra allocation

}

///
/// Some ugly glue code to implement required functions from FreeRTOS and Pico SDK
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not tuck this into freertos root.zig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is debatable and in future can change. This code require some access to hal and some parts can be duplicated/implemented with what wi have in microzig right now and some other part probably no, especially those that require accessing some shared resource that have to be done by one API (microzig API). I will put comment about that in this place.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Lint Results

Found 4 issues on changed lines in 2 files:

  • modules/freertos/build.zig: 1 issue
  • modules/freertos/src/root.zig: 3 issues

@@ -0,0 +1,99 @@
const std = @import("std");

const FreeRTOSPort = enum {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Rename FreeRTOSPort to Free_RTOS_Port, it should be more in line with our style guidelines. This automation is not perfect so take it with a grain of salt.

pub const MINIMAL_STACK_SIZE: usize = c.configMINIMAL_STACK_SIZE;
pub const MAX_PRIORITIES: usize = c.configMAX_PRIORITIES;

pub fn vTaskStartScheduler() noreturn {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to v_task_start_scheduler, in MicroZig we use snake case for function names.

unreachable;
}

pub fn vTaskDelay(ticks: c.TickType_t) void {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to v_task_delay, in MicroZig we use snake case for function names.

c.vTaskDelay(ticks);
}

pub fn xTaskCreate(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to x_task_create, in MicroZig we use snake case for function names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants