PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux...
Transcript of PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux...
![Page 1: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/1.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
1
REAL TIME OPERATING SYSTEM REAL TIME OPERATING SYSTEM PROGRAMMINGPROGRAMMING--II: Windows CE, II: Windows CE,
OSEK and Real time Linux OSEK and Real time Linux
Lesson-13: RT LinuxRT Linux
![Page 2: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/2.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
2
1. RT Linux1. RT Linux
![Page 3: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/3.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
3
RT LinuxRT Linux• For real time tasks and predictable hard
real time behaviour, an extension of Linux is a POSIX hard real-time environment using a real time core.
• The core is called RTLinuxFree and RTLinuxPro , freeware and commercial software respectively. V. Yodaikendeveloped RTLinux, later FSM Labs commercialized RTLinuxPro and now Wind River has acquired it
![Page 4: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/4.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
4
RT Linux…RT Linux…
• Relatively simple modifications, which converts the existing Linux kernel into a hard real-time environment.
• Deterministic interrupt-latency ISRs execute at RTLinux core and other in-deterministic processing tasks are transferred to Linux.
![Page 5: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/5.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
5
RT Linux…RT Linux…
• The forwarded Linux functions are placed in FIFO with sharing of memory between RTLinux threads as highest priority and Linux functions running as low priority threads. Figure
![Page 6: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/6.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
6
RT Linux basic features
![Page 7: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/7.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
7
Running the task for hard real time Running the task for hard real time performanceperformance
� Run the primitive tasks with only statically allocated memory.
� The dynamic memory allocation or virtual memory allocation introduces unpredictable allocation and load timings
![Page 8: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/8.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
8
Running the task for hard real time Running the task for hard real time performance…performance…
� Run the real time task with no address space protection.
� The memory address protection involves additional checks, which also introduce the unpredictable allocation and load timings
![Page 9: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/9.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
9
Running the task for hard real time Running the task for hard real time performance…performance…
� Run with disabling of interrupts so that other interrupts don’t introduce the unpredictability.
� Run a simple fixed priority scheduler.
![Page 10: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/10.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
10
Running the task for hard real time Running the task for hard real time performance…performance…
� Run with disabling of interrupts so that other interrupts don’t introduce the unpredictability.
� Run a simple fixed priority scheduler.
![Page 11: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/11.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
11
Running the task for soft real time Running the task for soft real time performance…performance…
� Applications can be configured to run differently.
� RTLinux allows flexibility in defining real-time task behaviour, synchronization and communication
� RTLinux kernel designed with modules, which can be replaced to make behaviourflexible wherever possible
![Page 12: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/12.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
12
Running the task for non real time tasksRunning the task for non real time tasks
� Applications run as the Linux processes.
![Page 13: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/13.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
13
2. Programming with RT Linux2. Programming with RT Linux
![Page 14: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/14.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
14
Example RT LinuxExample RT Linux
� include rtl.mk /* Include RTLinux make file. The rtl.mk file is an include file which contains all the flags needed to compile the code. */
� all: module1.o /* Object file at module1.o */
� clean: rm -f .o /* Remove using function rmobject files inserted before this file */
� module1.0: module1.c /* module1.0 is object file of source file module1.c */
� $(cc) ${include} ${cflags} -c module1.c /* Compile, include, Cflags C module module1.c */
![Page 15: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/15.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
15
3. Functions in RT Linux3. Functions in RT Linux
![Page 16: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/16.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
16
Module and thread functions in RT Linux
![Page 17: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/17.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
17
Functions in RT Linux
![Page 18: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/18.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
18
Real Time Thread Functions in RT Linux
![Page 19: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/19.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
19
Real Time FIFO functions
![Page 20: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/20.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
20
Real Time FIFO functions
![Page 21: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/21.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
21
Real Time FIFO functions
![Page 22: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/22.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
22
SummarySummary
![Page 23: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/23.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
23
We learntWe learnt� RTLinux provides hard real
functionalities in a separate layer, which runs the primitive tasks with only statically allocated memory, no dynamic memory allocation, no virtual memory allocation, no address space protection, run with disabling of interrupts, runs a simple fixed priority scheduler,
![Page 24: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/24.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
24
We learntWe learnt� It provides for running of real time tasks
by RTLinux layer and no deterministic non real time tasks by Linux.
� A FIFO connects real time tasks with Linux processes,
� Synchronization between the hard real time tasks and the limited size FIFO queues is achieved through use of shared memory (not through IPCs).
![Page 25: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/25.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
25
We learntWe learnt� RTLinux separate functions
rtl_hard_enable_irq ( ); rtl_hard_disable_irq ( );rtlinux_sigaction ( ); rtl_getschedclcok ( ); rtl_request_irq( ); rtl_restore_interrupts ( ); rtl_ stop_interrupts ( ); rtl_printf ( ); and rtl_no_interrupts ( );
![Page 26: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/26.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
26
We learntWe learnt� RTLinux supports priority for the
real time threads. RTLinux has real time thread wait, thread period definition, thread deletion, priority assignment, and FIFO device-functions.
![Page 27: PROGRAMMING - Devi Ahilya Vishwavidyalaya , Indore · II: Windows CE, OSEK and Real time Linux Lesson-13: ... Programming with RT Linux. 2008 ... assignment, and FIFO device-](https://reader031.fdocuments.us/reader031/viewer/2022021801/5b226bb57f8b9a547d8b47a4/html5/thumbnails/27.jpg)
2008Chapter-10 L13: "Embedded Systems - Architecture,
Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.
27
End End Lesson-13 on RT LinuxRT Linux