I'm working on a multi-core plateform, based on Rocket-Chip, it uses RISC-V ISA based cores.
My objective is to create a lightweight OS, that has a basic scheduler that can let me run multiple threads.
I tried FreeRTOS, ZephyrOS but those are not supporing multi-cores. So I decided to make a baremetal app, running in machine-mode, with just the very basic API (pthread_create, join ..).
The problem is that I'm not familiar with POSIX implementation details, nor with OS architectures. I already spent a month trying to understand what's going on in Rocket-Chip, and how baremetals work, but I'm still very far from my objective. Can you please tell me where to begin from? Any advice is welcome.
Best regards.
There's an extremely simple SMP hello world example in SiFive's Freedom E SDK https://github.com/sifive/freedom-e-sdk/blob/master/software/smp/smp.c that might serve as a good example. Concurrent programming is difficult in general, but luckily there's an entire discipline based around operating system design. One of the only books I've read is https://en.wikipedia.org/wiki/Modern_Operating_Systems , I think that'd be a good place to start.