Build a minimal multi-tasking OS kernel for ARM from scratch
./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
make make qemu
08-CMSIS implements preemptive round-robin scheduling with user-level threads for STM32F429i-Discovery (real device) and STM32-P103 (qemu).
git submodule init git submodule update
Install additional utilities:
USART1(Tx=PA9,Rx=PA10,baud rate=115200)as default serial port here.
sudo apt-get install screen
screen /dev/ttyUSB0 115200 8n1
makedoe NOT equal to
make allhere because Makefile uses
make target PLAT=p103
make target PLAT=f429disco
make cleanwill remove the entire directory,do not put personal files inside it!
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:
Select a target name for your device,such as
In this guide, we assume its name is
example_device with vendor name "LPC".
example_device directory in "platform" and
directory in "cmsis" directory.
Create "include" and "src" directory in
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
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.
This is the most difficult part.
You have to implement the files in
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.
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!
NOTmodify this file! - All of the rules are encapsulated into macro, used in
STM32 := STM32
STM32F429_DEVICE := f429disco
$(eval $(call eval_all_variable,$(STM32F429_DEVICE),$(STM32)))
vendor nameis used in the
cmsisdirectory name. They must be associated with each other.
$(eval $(call eval_build_command,$(STM32F429_DEVICE)))
$($(YOUR_DEVICE_NAME)_TARGET), this variable will be automatic derived by
Now, you can try the "Available commands" in this README.
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