SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
Porting FreeRTOS on OpenRISC
Speaker:Yi-Chiao Lin
• Motivation
• OpenRISC
• Porting FreeRTOS on OpenRISC
• Experiments
Outline
 Multi-Tasking Management Support
• Round-Robin 、 FIFO ……
 Memory Management Unit Support
• TLB、Page Table ……
 On-chip Memory Architecture Support
• Cache and SPM (scratch pad memory)
Motivation
 Scratch Pad Memory(SPM)
• Software controlled on-chip memory
• Consume less energy than cache
SPM (scratch pad memory)
• Motivation
• OpenRISC
• Porting FreeRTOS on OpenRISC
• Experiments
Outline
 Or1200 Open Hardware CPU released
 Implemented in the Verilog
 5-stage pipeline
 32 register
Special-Purpose Registers
OpenRISC
 l.mfspr / l.mtspr
 MMU、Cache、Interrupt……
OpenRISC
Enable/Disable
• Motivation
• OpenRISC
• Porting FreeRTOS on OpenRISC
• Experiments
Outline
 Real time operating system
 Designed to be small and simple(2k~3k)
 Stack can be shared between tasks
 For free!!
FreeRTOS benefit
Task Create
xTaskCreate(
pdTASK_CODE pvTaskCode,
const portCHAR * const pcName,
unsigned portSHORT usStackDepth,
void *pvParameters,
unsigned portBASE_TYPE uxPriority,
xTaskHandle *pvCreatedTask )
void vRtosTask(void *pvParameters){
while(1){
.........
}
}
Task
xTaskCreate
prvAllocateTCBAndStack(
usStackDepth, puxStackBuffer
);
prvInitialiseTaskLists();
prvInitialiseTCBVariables( pxNewTCB,
pcName, uxPriority, xRegions,
usStackDepth );
prvAddTaskToReadyQueue( pxNewTC
B );
• FreeRTOS porting file :
1. Port.c
2. Portmacro.h
3. Portasm.S
4. Port_spr_def.h(OpenRISC)
(Definition of special-purpose registers)
FreeRTOS/Source/portable/[Platform]
FreeRTOS Porting
FreeRTOS Porting
Ported layer
Port.c Portmacro.c Portasm.S Port_spr_def.h
Kernel layer
Application layer
Pagetable.c
TLB-miss ISR
Software(FreeRTOS)
Timer ISR
task.c
Data Moving ISR TLB.c
cache.cInterrupt handler
Reset.S
Hardware(OpenRISC)
SPM Redirector
Page miss
Bookkeeping
Port_spr_def.h
Portmacro.h
 Define Kernel Type
 pxPortInitialiseStack
 vPortDisableInterrupts
 vPortEnableInterrupts
 prvSetupTimerInterrupt
 xPortStartScheduler
port.c
port.c (*pxPortInitialiseStack)
PxCode
uTaskSR
r31:0x00000031
r30:0x00000030
r29:0x00000029
.
.
.
High address
Low address
 vPortDisableInterrupts
 vPortEnableInterrupts
port.c
Exception Handler
Exception type Vector offect[11:0] Example
Reset 0x100 Caused by Software or
Hardware reset
Bus error 0x200
Data Page fault 0x300
Instruction Page fault 0x400
Tick Timer 0x500 Timer interrupt
Alignment 0x600
Illegal Instruction 0x700
External interrupt 0x800 External interrupt asserted
D-TLB miss 0x900 No matching entry in DTLB
I-TLB miss 0xA00 No matching entry in ITLB
Range 0xB00
System call 0xC00
Float Point 0xD00
Trap 0xE00
 Exception Program Counter Registers
 Exception Supervision Registers
 Exception Effective Address Register
Exception Register
 Maximum timer count of 2^32 clock cycles
Tick Timer
TTMR
TTCR
RISC Clk
Tick INT
Tick Timer Mode Register
Tick Timer Counter
 prvSetupTimerInterrupt
Port.c
xPortStartScheduler
Task 1
Task2
Memory
Stack_TCB
Stack_TCB
Setup Timer
Load register
Load TCB
• Context Switch
 portSAVE_CONTEXT
 portRESTORE_CONTEXT
Portasm.S
Task1 Task2
Stack_TCB Stack_TCB
Portasm.S (Tick Handler)
 Reset register
 Set Stack point、Clear BSS
 Reset Cache、MMU、UART
Reset.S(Booting)
 OpenRISC Start at 0x100
 Clear general-purpose registers
Reset register
 Set Stack Pointer
 Clear BSS
Clear BSS (Block Started by Symbol)
• Flush Cache
Data Cache Block Invalidate Register
Cache
D-cache 8k 512Line 4word
PPN[31:13] 0x1[12:4] 0x8[3:0]
Physical [31:13]
Physical [31:13]
Physical [31:13]
Physical [31:13]
WORD
WORD
WORD
WORD
WORD
Physical [31:13] V
V
V
V
V
WORD
WORD
WORD
WORD 0
1
2
3
4
5
6
7
2047
0
1
2
3
511
13:212:4
 Task address space isolation
 Allow safe sharing of memory among multiple tasks
Why OS need MMU Support?
CPU
Task1
Task2
Virtual
Task 1
Task2
Memory
Physical
Page Index Level 1[31:24] Page Offset[12:0]Page Index Level 2[23:13]
0
255
PTE
PTE2
+
0
2047
Physical Page Number Page Offset[12:0]
+
Address
Page Table entry
Physical Page Number D A WBC CI CCWOMWRWRREV
 Entry Store in Memory
 Set in Data Translation Lookaside Buffer Translate Registers when
DTLB-MISS
TLB miss Handler
TLB MISS
Find the Task
Find Page Table
Set TLB register
Exception Effective Address Registers
or1200_except.v
Exception Effective Address Registers
DTLB Architecture
Virtial address[19:31] Index[13:18] Offset[12:0]
VPN [19:31] V
VPN [19:31] V
VPN [19:31] V
VPN [19:31] V
PPN [13:31]
PPN [13:31]
PPN[13:31]
PPN [13:31]
PPN [13:31]VPN [19:31] V
Direct mapped
相等
&& V=1
Physical address[13:31] Offset
DTLB miss
DTLB Match Register
DTLB Translate Regidter
EEAR:0x6000
W R W R CI
W R W R CI
W R W R CI
W R W R CI
W R W R CI
Super User
W R W R CI
Waveform
DTLB Miss
0x900
Interrupt ->
Dmmu Disable
0x100->0x20000100
Interrupt ->
Dmmu Disable
0x100->0x20000100
FreeRTOSConfig.h
Set Total Stack、SYSCLK……
• Set Uart Base Address、System CLK……
• Cache size set……
Board.h
Modify OpenRISC memory architecture
CPU
D-MMU
Data ram
Wishbone bus
Redirector
D-CacheSPM
Page miss
Bookkeeping
circuit
Interrupt
PIC (Programmable Interrupt Controller)
Page miss
Bookkeeping
circuit
or1200_cpu.vexternal_interrupt.v
or1200_pic.v
spr_cs
spr_we
spr_addr
spr_dat_i
intr
spr_dat_o
clk
rst
pic_int[31:0]
SPM data moving interrupt handler
Free SPM
space?
Interrupt
Select a victim page and
move it to Data ram
Move the page into SPM
No
Yes
Update D-TLB
Translate Regidter
Update Page table
• Motivation
• OpenRISC
• Porting FreeRTOS on OpenRISC
• Experiments
Outline
Verify on FPGA Board
Verify on FPGA Board
VeriComm
Dump Counter
 學習移植OS與底層硬體的整合
 善加運用身邊工具Debug
 更加了解CPU之運作
Summary
Thank You for Listening
Contact us.
E-mail : joe21013@hotmail.com

Contenu connexe

Tendances

ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
Ontico
 
06 file processing
06 file processing06 file processing
06 file processing
Issay Meii
 

Tendances (20)

Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
 
Threads in java
Threads in javaThreads in java
Threads in java
 
Operating system NachOS
Operating system NachOSOperating system NachOS
Operating system NachOS
 
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202
 
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
ToroDB: scaling PostgreSQL like MongoDB / Álvaro Hernández Tortosa (8Kdata)
 
Fun with FUSE
Fun with FUSEFun with FUSE
Fun with FUSE
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
 
Specializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network StackSpecializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network Stack
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Threads
ThreadsThreads
Threads
 
Basics of Java Concurrency
Basics of Java ConcurrencyBasics of Java Concurrency
Basics of Java Concurrency
 
Concurrent programming with RTOS
Concurrent programming with RTOSConcurrent programming with RTOS
Concurrent programming with RTOS
 
06 file processing
06 file processing06 file processing
06 file processing
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
P threads
P threadsP threads
P threads
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Multi threading
Multi threadingMulti threading
Multi threading
 
Multi threading
Multi threadingMulti threading
Multi threading
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
Multi-Threading
Multi-ThreadingMulti-Threading
Multi-Threading
 

Similaire à Porting FreeRTOS on OpenRISC

CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CanSecWest
 
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other AttacksExploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
inside-BigData.com
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
codebits
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
Kan-Ru Chen
 
Sql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ramSql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ram
Chris Adkin
 

Similaire à Porting FreeRTOS on OpenRISC (20)

Super scaling singleton inserts
Super scaling singleton insertsSuper scaling singleton inserts
Super scaling singleton inserts
 
Persistent Memory Programming with Java*
Persistent Memory Programming with Java*Persistent Memory Programming with Java*
Persistent Memory Programming with Java*
 
My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)My First 100 days with an Exadata (PPT)
My First 100 days with an Exadata (PPT)
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in Action
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
VMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep DiveVMworld 2016: vSphere 6.x Host Resource Deep Dive
VMworld 2016: vSphere 6.x Host Resource Deep Dive
 
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
Build an High-Performance and High-Durable Block Storage Service Based on CephBuild an High-Performance and High-Durable Block Storage Service Based on Ceph
Build an High-Performance and High-Durable Block Storage Service Based on Ceph
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
High Performance With Java
High Performance With JavaHigh Performance With Java
High Performance With Java
 
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other AttacksExploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
Exploiting Modern Microarchitectures: Meltdown, Spectre, and other Attacks
 
Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)Operating Systems 1 (5/12) - Architectures (Unix)
Operating Systems 1 (5/12) - Architectures (Unix)
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
 
Kernel Recipes 2015 - Porting Linux to a new processor architecture
Kernel Recipes 2015 - Porting Linux to a new processor architectureKernel Recipes 2015 - Porting Linux to a new processor architecture
Kernel Recipes 2015 - Porting Linux to a new processor architecture
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Sql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ramSql server engine cpu cache as the new ram
Sql server engine cpu cache as the new ram
 
L05 parallel
L05 parallelL05 parallel
L05 parallel
 
Ch 2 inside systems unit
Ch 2 inside systems unitCh 2 inside systems unit
Ch 2 inside systems unit
 
ceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-shortceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-short
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)
 
Performance and Predictability - Richard Warburton
Performance and Predictability - Richard WarburtonPerformance and Predictability - Richard Warburton
Performance and Predictability - Richard Warburton
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 

Porting FreeRTOS on OpenRISC