Home

Awesome

Build a minimal multi-tasking OS kernel for ARM from scratch

Prerequisites

./configure --disable-werror --enable-debug \
    --target-list="arm-softmmu" \
    --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY \
    --extra-cflags=-DSTM32_UART_ENABLE_OVERRUN \
    --disable-gtk
make

Steps

Building and Verification

make
make qemu

Guide to Hacking 08-CMSIS

08-CMSIS implements preemptive round-robin scheduling with user-level threads for STM32F429i-Discovery (real device) and STM32-P103 (qemu).

Get the dependencies:

git submodule init
git submodule update

Install additional utilities:

Quick Start / Support Devices:

Available commands:

Overall

STM32-P103(QEMU)

STM32F429i-Discovery(physical device)

Directory Tree:

Porting Guide:

You should know what CMSIS is and why it saves us a lot of efforts.

cmsis is a submodule from JaredCJR/cmsis, maintained by Jia-Rung Chang.

The full project can be divided into two layer:

Steps to launch the kernel on real devices:

STEP 1

Select a target name for your device,such as f429disco.

In this guide, we assume its name is example_device with vendor name "LPC".

Create example_device directory in "platform" and LPCexample_device directory in "cmsis" directory.

Create "include" and "src" directory in platform/example_device/

STEP 2

Introducing your CMSIS for your target, where it should be in the mbed repo.

For example, the CMSIS for STM32F429i-discovery could be found here.

We only need ".h" files, do not copy any ".c" files.

Put the header files into cmsis/LPCexample_device.

cmsis is a submodule in this project,maintianed by Jia-Rung Chang.

NOTE: You may encounter some error messages during building binary for your target. You need to solve it mannually. Usually, some files may be missing caused by some specific "define". You could just comment out that definition to resolve this problem.

STEP 3

This is the most difficult part.

You have to implement the files in platform/example_device/include/ and platform/example_device/src/.

According to different device vendor(such as STMicroelectronics, NXP, etc), the implementation is very different.

Please look into the current example:f429disco,and you will figure it out!

The function interface must be as same as the function interface in "platform/STM32F429/inc/" due to this is HAL for the entire project.

STEP 4

Add your target rules into Makefile.

Please look the example f429disco in the Makefile.

Most of the rules are reusable,so all you need is copy-n-paste, modifying the variable/target name and knowing what gcc arguments suit your target!

STEP 5

Congratulations!

Now, you can try the "Available commands" in this README.

Licensing

mini-arm-os is freely redistributable under the two-clause BSD License. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Reference