hashmismatch / freertos.rs

A Rust wrapper for FreeRTOS.
232 stars 22 forks source link

How to start the scheduler? #29

Open axos88 opened 5 years ago

axos88 commented 5 years ago

Can't seem to find the equivalent of vTaskStartScheduler();

niondir commented 4 years ago

I created a version using some of this code that can run the main() from Rust. I also added added a vTaskStartScheduler() equivalent in FreeRtosUtils::start_scheduler();

You can find the code with some examples here: https://github.com/lobaro/FreeRTOS-rust

Logarithmus commented 4 years ago

@Niondir, you are a hero! I'm struggling with my university project involving FreeRTOS, it's the matter of principle for me now to finish it in Rust. I spent so much time to build the correct version of rustc for AVR, now . And I was practically a total newbie in embedded, so had to understand all the timers, clocks, interrupts and other stuff. So now I hope to get it working finally.

Logarithmus commented 4 years ago

@Niondir, unfortunately, when I tried to compile your crate for AVR target, I've got LLVM error, something about "invalid bitcast", FnOnce and *i8. AVR support for Rust is highly experimental now, so getting weird LLVM errors is not a surprise. I've heard this maybe caused by the fact that AVR is a Harvard architecture. I ended up doing this project in C++. It's finished now. Maybe someday I'll try using Rust again with FreeRTOS, but I doubt it. If I'll need embedded multitasking, I'll just pick some alternative RTOS written in Rust. Or maybe even use async await. I've read on Reddit that Ferrous Systems is currently working hard on embedded async await