DEV Community

Can Gulmez
Can Gulmez

Posted on

Overview of the RTOS Kernel Project

In previous tutorial, I've gave you the theoretical background about ARM Cortex-M3/4 processors. In here, I will explain the RTOS kernel project structure.

You can access and inspect the kernel implementation from here.

The project gives the end-to-end development environment for STM32F446RE with the builtin kernel. I've built a statically allocated and fully preemptive kernel. For now, it's just kernel, not having the queue, mutex, thread notification or similar mechanism. I plan to add these also in the future.

The project directory:

  • bin includes the output artifacts.
  • docs includes the some development notes.
  • drivers includes the CMSIS and HAL drivers and required files.
  • lib includes the driver libraries.
  • renode includes the Renode description files to simulate.
  • src includes an example firmware source with the custom kernel.

I've built the kernel on top of CMSIS driver and the example firmware with official STM32F4 HAL driver. So both and required other files should be under the drivers.

I use Makefile-based build system. There are two commands in here:

  • make lib builds the static driver library including the CMSIS and HAL under lib.
  • make bin builds the firmware itself and associated artifacts go into bin.

I put the end-to-end example under src. It includes the kernel source code and the firmware which demonstrates the kernel usage. The firmware outputs will be the firmware.elf and firmware.bin (stripped) under bin.

Under src, there are

  • main.h includes the firmware definitions.

  • peripheral.c includes the peripheral settings.

  • syscalls.c includes the dummy syscall functions for compiler.

  • it.c includes the interrupt service routines.

  • main.c includes the firmware main code.

  • os_core.h includes the kernel definitions.

  • os_core.c includes the ARM Cortex-M3/4 specific settings.

  • os_list.c includes the kernel linked-list logic.

  • os_thread.c includes the generic kernel APIs.

In this series, I try to explain the kernel specific codebase (os_*) in detail.

I've also used the Renode to simulate the kernel workflow. If you don't have it, I suggest to get it strongly. Because, the real hardware will not be accessible mostly in real-life. You should visit the official GitHub page and follow the instructions to download it. I also explained the usage of it in the README.md.

I think that this is enough for now. I just wanted to give the project link and explained the overall structure in shortly.

In next tutorial, I will explain the processor-specific os_core.h and os_core.c files in deeply.

Top comments (0)