-
Notifications
You must be signed in to change notification settings - Fork 164
FreeRTOS microzig module #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
Keep FreeRTOS naming conventions
| //.overwrite_hal_interrupts = true, | ||
| //.interrupts = .{ .PendSV = .{ .naked = freertos.isr_pendsv }, .SysTick = .{ .c = freertos.isr_systick }, .SVCall = .{ .c = freertos.isr_svcall } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have to clean this up.
| const cs = microzig.interrupt.enter_critical_section(); | ||
| defer cs.leave(); | ||
|
|
||
| // very ugly code but good for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put a TODO to cleanup please
| } | ||
|
|
||
| export fn multicore_reset_core1() callconv(.c) void { | ||
| // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more descriptive TODO please
| firmware.app_mod.addImport("net", net_mod); | ||
| } | ||
|
|
||
| // Import freertos module for some examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please mention that it's a hack that uses the example name to determine.
We could just add a field to Example and default it to false, that would be cleaner.
| .hash = "ssd1306_font_8x8-0.0.0-oGb_cERcAAA6NJzWDOMepgnY6r4blNEHjpkldDaRAui5", | ||
| }, | ||
| .net = .{ .path = "../../../modules/network/" }, | ||
| .freertos = .{ .path = "../../../modules/freertos/" }, |
There was a problem hiding this comment.
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?
| // Used when PICO_NO_RAM_VECTOR_TABLE is 1 (but don't work - VTOR is not set to 0x10000100 during boot) | ||
| // pub const microzig_options = microzig.Options{ | ||
| // .overwrite_hal_interrupts = true, | ||
| // .interrupts = .{ .PendSV = .{ .naked = freertos.isr_pendsv }, .SysTick = .{ .c = freertos.isr_systick }, .SVCall = .{ .c = freertos.isr_svcall } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please multiline this
|
|
||
| freertos_lib.addCMacro("LIB_PICO_MULTICORE", "0"); | ||
|
|
||
| // Had problems when this was enabled. Microzig but also Pico SDK? dont set VTOR to 0x10000100 for RP2040 at boot even when ram_vector_table is set to false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap long lines
| "build.zig", | ||
| "build.zig.zon", | ||
| "src", | ||
| // For example... | ||
| //"LICENSE", | ||
| //"README.md", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please clean this up! you'll need picosdk and config.
|
|
||
| pub fn xTaskCreate( | ||
| task_function: c.TaskFunction_t, | ||
| name: [*:0]const u8, |
There was a problem hiding this comment.
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?
| } | ||
|
|
||
| /// | ||
| /// Some ugly glue code to implement required functions from FreeRTOS and Pico SDK |
There was a problem hiding this comment.
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?
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.