从头开始构建一个适用于 ARM 的最小多任务操作系统内核
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
$PATH accordingly00-Semihosting00-HelloWorld01-HelloWorld02-ContextSwitch-103-ContextSwitch-204-Multitasking05-TimerInterrupt06-Preemptive07-Threads08-CMSISmake
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.screensudo apt-get install screenscreen /dev/ttyUSB0 115200 8n1Ctrl-a then kOverall
make allmake doe NOT equal to make all here because Makefile uses
eval for targets.make cleanSTM32-P103(QEMU)
make p103 or make target PLAT=p103make qemumake qemu_GDBstubmake qemu_GDBconnectSTM32F429i-Discovery(physical device)
make f429disco or make target PLAT=f429discomake st-flashmake st-erasemake gdb_ST-UTILmake clean will 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 TibaChang/cmsis, maintained by Jia-Rung Chang.
The full project can be divided into two layer:
Select a target name for your device, such as f429disco.
In this guide, we assume its name is example_device with vendor name "f429disco".
Create example_device directory in "platform" and f429disco
directory in "cmsis" directory.
Create "include" and "src" directory in platform/example_device/
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/f429discoexample_device.
cmsis is a submodule in this project, maintianed by Tiba 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.
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.
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!
rules.mk NOT modify this file!
- All of the rules are encapsulated into macro, used in Makefile.Makefile:STM32 := STM32STM32F429_DEVICE := f429discotarget_using_CM4_listtarget_NOT_using_CMSIS_list$(eval $(call eval_all_variable,$(STM32F429_DEVICE),$(STM32)))vendor name is used in the cmsis directory name. They must be
associated with each other.$(eval $(call eval_build_command,$(STM32F429_DEVICE)))Makefile.all$($(YOUR_DEVICE_NAME)_TARGET) , this variable
will be automatic derived by rules.mk$($(STM32F429_DEVICE)_TARGET)Congratulations!
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
in the LICENSE file.
暂无开放 Issues,或尚未同步最近议题。