This is OS based on ARM for fun.
We can learn OS concept and ARM architecture by creating the OS.
Some of the functions are from jserv's mini-arm-os.
- Install necessary package.
- Ubuntu
sudo apt install zlib1g-dev libsdl1.2-dev automake autoconf libtool libpixman-1-dev bison flex
# If you are using Ubuntu 20.04, run the following command
sudo apt install build-essential python zlib1g-dev libglib2.0-dev libpixman-1-dev libtool libfdt-dev
# For 32 bit, lib32gcc1 is necessary
sudo apt install lib32gcc1 lib32ncurses5
# Install cross compiler
sudo apt install binutils-arm-none-eabi libnewlib-arm-none-eabi gcc-arm-none-eabi
# install gdb
sudo apt install gdb-multiarch
# install necessary packages
sudo apt install astyle
- MAC
# Install cross compiler
brew install gcc-arm-none-eabi
- We run the environment on qemu, so you should build the qemu first.
git clone https://github.com/beckus/qemu_stm32.git
cd qemu_stm32
./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
- clone the source code.
git clone https://github.com/evshary/arm-os-4fun.git
- Build and run.
cd arm-os-4fun
make
make qemu
- If you want to run gdb
cd arm-os-4fun
make DEBUG=1
# start to run gdb
make qemu_gdb
# run in different terminal
make qemu_connect
- Install necessary package.
sudo apt install cmake libtool libusb-1.0-0-dev libgtk-3-dev
- Clone stlink and build.
- Ubuntu
git clone http://github.com/texane/stlink.git
cd stlink
cmake .
make
- MAC
brew install stlink
- clone the source code.
git clone https://github.com/evshary/arm-os-4fun.git
- Build and run.
cd arm-os-4fun
# F407
make BOARD=STM32F407
# F429
make BOARD=STM32F429
make flash
- If you want to run gdb
cd arm-os-4fun
# F407
make DEBUG=1 BOARD=STM32F407
# F429
make DEBUG=1 BOARD=STM32F429
# start to run gdb
make st-util_gdb
# run in different terminal
make st-util_connect
We can connect the UART to see the debug message.
The GPIO for UART is different by models.
model | GPIO |
---|---|
F429 | PA9:TX, PA10:RX |
You can use serial application, like minicom to see the message.
Serial Settings is 8N1, 115200.
NOTE: green is RX, white is TX, and also remember to connect ground.
# Ubuntu
sudo apt install minicom
# MAC
brew install minicom
# Usage
minicom -s
# ESC-Z for leaving minicom
arm-os-4fun now can run on qemu, which emulates STM32-P103. The supported CPU is stm32f103, which is ARM Cortex M3.
The OS also supports STM32F429I, which is ARM Cortex M4.
You can reference the link below.
- The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors
- RM0008 Reference manual for STM32F10xxx/20xxx/21xxx/L1xxxx
- PM0056 Programming manual for STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx
- Context Switch (Use SysTick)
- System Call
- malloc/free
- basic shell
- message queue/IPC
- resource protection
- file system