All Projects → andylokandy → preemptive

andylokandy / preemptive

Licence: other
A minimum preemptive OS on Cortex-M3 (specially on blue-pill board) written in Rust.

Programming Languages

rust
11053 projects
GDB
78 projects

Projects that are alternatives of or similar to preemptive

ez-rtos
A micro real-time operating system supporting task switching, delay function, memory allocator and critical section. It is writen on ARM Cortex-M3 assemble language, it runs successfully on STM32F103 MCU.
Stars: ✭ 57 (+90%)
Mutual labels:  os, cortex-m3
decode-os
The DECODE OS for private, distributed P2P computing
Stars: ✭ 56 (+86.67%)
Mutual labels:  os
Aqeous
(Inactive, Checkout AvanaOS, Rewrite of this) This is a New Operating System (Kernel right now). Made completely from scratch, We aim to make a complete OS for Learning purpose
Stars: ✭ 23 (-23.33%)
Mutual labels:  os
cryptctl
A disk encryption utility that helps setting up LUKS-based disk encryption using randomly generated keys, and keeps all keys on a dedicated key server.
Stars: ✭ 23 (-23.33%)
Mutual labels:  os
tupai
Tupai is a multi-tasking operating system I wrote for my degree that focuses on safety and design, targeting a variety of platforms.
Stars: ✭ 21 (-30%)
Mutual labels:  os
Cardinal
Operating system designed to be fast and secure.
Stars: ✭ 20 (-33.33%)
Mutual labels:  os
AhnTri
Super-simple OS
Stars: ✭ 54 (+80%)
Mutual labels:  os
Psyduck
Record CS knowlegement with XMind, version 2.0. 使用 XMind 记录 Linux 操作系统,网络,C++,Golang 以及数据库的一些设计
Stars: ✭ 4,280 (+14166.67%)
Mutual labels:  os
sOS
Solar Operating System - The ASCII OS nobody asked for.
Stars: ✭ 11 (-63.33%)
Mutual labels:  os
Ultra
An operating system that doesn't try to be UNIX. Made completely from scratch with its own bootloader. 😊
Stars: ✭ 48 (+60%)
Mutual labels:  os
Onyx
UNIX-like operating system written in C and C++
Stars: ✭ 52 (+73.33%)
Mutual labels:  os
DemOS
Free, simple, extremely lightweight, stackless, cooperative, co-routine system (OS) for microcontrollers
Stars: ✭ 18 (-40%)
Mutual labels:  os
chaos-2
A hand-made SMP-aware kernel
Stars: ✭ 20 (-33.33%)
Mutual labels:  os
src
MidnightBSD OS source code
Stars: ✭ 21 (-30%)
Mutual labels:  os
ebook
一些已经读、正在读、将要读的书籍
Stars: ✭ 126 (+320%)
Mutual labels:  os
toddler
Toddler is a well-designed usable and portable microkernel OS
Stars: ✭ 70 (+133.33%)
Mutual labels:  os
opuntiaOS
opuntiaOS - an operating system targeting x86, ARMv7, Aarch64
Stars: ✭ 566 (+1786.67%)
Mutual labels:  os
device.js
🧬 Reactive library to observe essential browser and device properties.
Stars: ✭ 29 (-3.33%)
Mutual labels:  os
SynapseOS
SynapseOS - модульная операционная система на языке C.
Stars: ✭ 93 (+210%)
Mutual labels:  os
note
📝个人知识体系 算法与数据结构 / 操作系统 / 数据库 / 计算机系统 / 网络 / 中间件 / Java / 架构 / 前端 / 运维 / 网络安全 / 软技能
Stars: ✭ 40 (+33.33%)
Mutual labels:  os

Preemptive-rs

A minimum preemptive OS on Cortex-M3 (specially on blue-pill board) written in Rust. It is for the purpose of researching and showing how the fundamental runtime of Cortex-M3 works.

What is preemptive OS

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 of the 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 take the control back without informing the task.

Prerequisite

  • Make sure you have a blue-pill board and a serial port reciever.
  • Make sure you have arm-none-eabi toolchain and openocd 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).

Project Structure

This project is collections of several stages of building a preliminary preemptive OS from sketch. I'll make sure all code of each chapter can compile and run on blue-pill.

Build and Run

  • 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 v2
Info : Target voltage: 3.175214
Info : 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: Thread
xPSR: 0x01000000 pc: 0x080008fc msp: 0x20005000
Loading section .isr_vector, size 0x40 lma 0x8000000
Loading section .text, size 0x2a08 lma 0x8000040
Start address 0x80008fc, load size 10824
Transfer rate: 14 KB/sec, 5412 bytes/write.
(gdb) continue
Continuing.

As the result, you would see the output from the serial reciever like this:

Executing task1!
task1: fib(0)=1
task1: fib(1)=1
task1: fib(2)=2

Executing task2!
task2: is_prime(1)=true
task2: is_prime(2)=true
task2: is_prime(3)=true

Executing task1!
task1: fib(3)=3
task1: fib(4)=5
task1: fib(5)=8

Executing task2!
task2: is_prime(4)=false
task2: is_prime(5)=true
task2: is_prime(6)=false
...

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].