- Notifications
You must be signed in to change notification settings - Fork2
andylokandy/preemptive
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A minimum preemptive OS on Cortex-M3 (specially on blue-pill board) written in Rust. It is for the purpose ofresearching and showing how the fundamental runtime of Cortex-M3 works.
In computing, preemption is the act of temporarily interrupting a task being carried out by a computer system,without requiring its cooperation, and with the intention of resuming the task at a later time. Such changes ofthe executed task are known as context switches. ---- Wikipedia
In breif, the kernel of non-preemptive OS can not interrupt a task, while the kernel of preemptive OS can takethe control back without informing the task.
- Make sure you have a
blue-pill
board and a serial port reciever. - Make sure you have
arm-none-eabi
toolchain andopenocd
installed on your platform. - Install the latest nightly rust toolchain. The compiler version used when this project is beening written is
rustc 1.37.0-nightly (17e62f77f 2019-07-01)
.
This project is collections of several stages of building a preliminary preemptive OS from sketch. I'll makesure all code of each chapter can compile and run onblue-pill
.
- Enter
Chapter5-MultiTasking
cd Chapter5-MultiTasking
Connect the
blue-pill
to your laptop.Connect pin
PA2
to a serial reciever, with 115200 baudrate, 8 data bits, 1 stop bits, no parity and no flow control.Run
openocd
:
> openocd...Info : using stlink api v2Info : Target voltage: 3.175214Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
- Run the application:
> cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.93s Running `target\thumbv7m-none-eabi\debug\preemptive`Reading symbols from target\thumbv7m-none-eabi\debug\preemptive...done.target halted due to debug-request, current mode: ThreadxPSR: 0x01000000 pc: 0x080008fc msp: 0x20005000Loading section .isr_vector, size 0x40 lma 0x8000000Loading section .text, size 0x2a08 lma 0x8000040Start address 0x80008fc, load size 10824Transfer rate: 14 KB/sec, 5412 bytes/write.(gdb) continueContinuing.
As the result, you would see the output from the serial reciever like this:
Executing task1!task1: fib(0)=1task1: fib(1)=1task1: fib(2)=2Executing task2!task2: is_prime(1)=truetask2: is_prime(2)=truetask2: is_prime(3)=trueExecuting task1!task1: fib(3)=3task1: fib(4)=5task1: fib(5)=8Executing task2!task2: is_prime(4)=falsetask2: is_prime(5)=truetask2: is_prime(6)=false...
- mini-arm-os (https://github.com/jserv/mini-arm-os)
- tock os (https://github.com/tock/tock)
About
A minimum preemptive OS on Cortex-M3 (specially on blue-pill board) written in Rust.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.