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-Semihosting
00-HelloWorld
01-HelloWorld
02-ContextSwitch-1
03-ContextSwitch-2
04-Multitasking
05-TimerInterrupt
06-Preemptive
07-Threads
08-CMSIS
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.
screen
sudo apt-get install screen
screen /dev/ttyUSB0 115200 8n1
Ctrl-a
then k
Overall
make all
make
doe NOT equal to make all
here because Makefile uses
eval
for targets
.make clean
STM32-P103(QEMU)
make p103
or make target PLAT=p103
make qemu
make qemu_GDBstub
make qemu_GDBconnect
STM32F429i-Discovery(physical device)
make f429disco
or make target PLAT=f429disco
make st-flash
make st-erase
make gdb_ST-UTIL
make 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 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 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/
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.
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 := STM32
STM32F429_DEVICE := f429disco
target_using_CM4_list
target_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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。