FreeRTOS - how much vanilla is it?


  • Are there any Vanilla FreeRTOS functions, macros or hooks that are NOT available on the Milk-V duo or behave different than the vanilla version of FreeRTOS?
  • Is there a way to make FreeRTOS the only thing running on the board (i.e remove Linux entirely)?


Hey everyone! I hope you’re all doing well.

I am looking for RISC-V boards to develop real-time software and stumbled upon the Milk-V Duo. It looks just like what I need in terms of raw performance, but I have a question regarding the FreeRTOS it officially supports - how close to the standard (vanilla) version is it?

My reasoning behind that question is really that I have bought an ESP32-C3 board before, knowing Espressif uses FreeRTOS as a base for its ESP-IDF toolchain, and although most of the functionality remains the same they did perform some changes within the API that broke some of the libraries I needed for my project. Since I noticed a few changes on the project template already, like having a custom main_cvirtos execution entrypoint, I figured maybe this would be the case here too.

As an extra question, I’d love to know if there is currently a way - or at least plans - of making an official port that is only FreeRTOS (without Linux). Obviously it seems to have enough power for both, but for benchmarks and academic purposes it might be better to have a sole OS and remove entropy from the equation.

Thank you very much!


You can run vanilla FreeRTOS with the c906 extension (for FPU context saves). You just need to mess around with the MTIME tick interrupt to get it going (you can’t use the builtin StartTickTimer function as the C906 MTIME is a bit different)

It can run on both cores, you would just need to, minimally have fsbl - freertos (unless you want to setup DDR and clocks yourself).

Peripheral wise, UART, SPI, PWM, I2C have bare metal drivers. Everything else you would need to write yourself.

1 Like

Ok, so I suppose implementing Vanilla FreeRTOS as a standalone firmware would be a procedure close what’s described in the porting guide. Is that so? After that, how would I proceed with flashing it into the Duo?

I apologize if my questions are too simple - I’m fairly new to such a low-level approach. My background covers mostly microcontrollers, which usually follow a simpler process.

1 Like

Yes. But if you’re just starting out, I’d work on getting a basic program running over serial port first. (Eg, printing something in main).

Starting from scratch to get freertos running is a pretty big task. Break it down into small things (startup code and things like libc working correctly as well as compiler options and so forth).

Or just use the duo freertos repository. The major difference between running on the small core and the big core are the interrupt numbers, and start/reset vectors, and that code has drivers already integrated.

I believe the shipped u-boot allows you to boot elf files (such as what is produced by the duo repository).

I’d also invest in a debugger like the sipeed slogic. It helps a lot to debug code before the serial port is enabled etc.)

Once your software is running nicely, you can recreate the fip.bin file the buildroot produces to use your program rather than opensbi/uboot.

At a high level, it’s not that much different from simple MCU’s. The challenge is these chips are pretty capable and thus there is extra complexity.

1 Like