preemptive
1.0.0
Cortex-M3 (특히 파란색 필드 보드)의 최소 선제 OS. Rust로 작성되었습니다. Cortex-M3의 기본 런타임이 어떻게 작동하는지 연구하고 보여주는 목적입니다.
컴퓨팅에서 선점은 컴퓨터 시스템에 의해 수행되는 작업을 일시적으로 방해하는 행위와 협력을 필요로하지 않고 나중에 작업을 재개 할 의도로 작업을 일시적으로 방해하는 행위입니다. 실행 된 작업의 이러한 변경은 컨텍스트 스위치라고합니다. ---- Wikipedia
Breif에서는 비 배열 OS의 커널은 작업을 방해 할 수 없으며 선제 OS의 커널은 작업에 알리지 않고 제어를 되돌릴 수 있습니다.
blue-pill 보드와 직렬 포트 리시버가 있는지 확인하십시오.arm-none-eabi 도구 체인과 openocd 설치되어 있는지 확인하십시오.rustc 1.37.0-nightly (17e62f77f 2019-07-01) 입니다. 이 프로젝트는 스케치에서 예비 선제 OS를 구축하는 여러 단계의 컬렉션입니다. 각 장의 모든 코드가 blue-pill 에서 컴파일하고 실행할 수 있는지 확인합니다.
Chapter5-MultiTasking 입력하십시오 cd Chapter5-MultiTasking
blue-pill 노트북에 연결하십시오.
115200 보드 레이트, 8 개의 데이터 비트, 1 정지 비트, 패리티 및 흐름 제어가없는 Serial Reiever에 PIN PA2 연결하십시오.
openocd 실행 :
> openocd
...
Info : using stlink api v2
Info : Target voltage: 3.175214
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
> cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.93s
Running `targetthumbv7m-none-eabidebugpreemptive`
Reading symbols from targetthumbv7m-none-eabidebugpreemptive...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.
결과적으로, 당신은 다음과 같은 일련의 리시버의 출력을 볼 수 있습니다.
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
...