digital control & real-timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf ·...
TRANSCRIPT
![Page 1: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/1.jpg)
Digital Control & Real-Time
![Page 2: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/2.jpg)
Control System
+controller plant
sensor
controlsignal
command
analog/digitalcircuit
![Page 3: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/3.jpg)
Digital Control System
+Controller Plant
Sensor
ControlSignal
Command
Digital Computer
D/A
A/D
![Page 4: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/4.jpg)
Real-Time
Real-Time is the essential part in digital control
“A real-time system is one in which the correctness of
the computations not only depends upon the logical
correctness of the computation but also upon the time at
which the result is produced. If the timing constraints of
the system are not met, system failure is said to have
occurred.”
Late correct answer is wrong answer!
![Page 5: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/5.jpg)
Real-Time
“Real-time in operating systems: The ability of the
operating system to provide a required level of service in
a bounded response time.”
POSIX Standard 1003.1
![Page 6: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/6.jpg)
Hard vs Soft Real-Time
Hard Real-Time
Absolute deadlines that must be met
Example: Braking system controller
Soft Real-Time
Time tolerance within which an event can occur
Example: Multimedia streaming
![Page 7: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/7.jpg)
Real-Time OS
Multi-threaded and pre-emptible
Thread priority has to exist
Must support predictable thread synchronization
mechanisms
A system of priority inheritance must exist
![Page 8: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/8.jpg)
Commercial Real-Time OS
Wind River Systems
VxWorks
pSOS
QNX Software Systems
QNX
Green Hills Software
Integrity
Mentor Graphics
VRTX
![Page 9: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/9.jpg)
![Page 10: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/10.jpg)
![Page 11: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/11.jpg)
Scheduler
Determine which task executes when
Schedulable entities-a kernel object that can compete for
execution on a system-> process, task
Multitasking: many thread of execution appear to be
running concurrently
![Page 12: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/12.jpg)
Scheduler
Context: the state of CPU registers
Context switch
When a new task is created, TCB(task control block) is
also created
TCB: system data structure
![Page 13: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/13.jpg)
![Page 14: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/14.jpg)
Scheduling Algorithms
Preemptive priority-based scheduling
Round-robin scheduling
![Page 15: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/15.jpg)
![Page 16: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/16.jpg)
![Page 17: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/17.jpg)
Linux
Source code freely available
Robust and reliable
Modular, configurable, scalable
Superb support for networking and Internet
No runtime licenses
Large pool of skilled developers
![Page 18: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/18.jpg)
![Page 19: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/19.jpg)
Interrupt Latency
Traditional UNIX Operating systems suffer from large
interrupt latency
How to reduce the interrupt latency?
Make kernel highly preemptible by changing its internal structure
(minimizing interrupt disabling) or adding a set of preemption
points
Microkernel approach
![Page 20: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/20.jpg)
Definition of Interrupt Latency
![Page 21: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/21.jpg)
Linux and Real-Time
Linux is not Real-Time
Monolithic Kernel: The Linux kernel uses coarse grained
synchronization, which allows a kernel task exclusive
access to some data for long periods. This could delay
the execution of any POSIX real-time task that needs
access to that same data.
Not Preemptible in Kernel Mode: The Linux kernel does
not preempt the execution of any task during system
calls. If a low priority process is in the middle of a system
call and a message is received for a real-time process,
the message will unfortunately be held in the queue until
the system call completes, despite its low priority.
![Page 22: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/22.jpg)
Linux and Real-Time
Resource Lock: Linux makes high priority tasks wait for
low priority tasks to release resources. For example, if
any process allocates the last network buffer and a
higher priority process needs a network buffer to send a
message, the higher priority process must wait until
some other process releases a network buffer before it
can send its message.
Priority Scheduling: The Linux scheduling algorithm will
sometimes give the most unimportant and nicest process
a time slice, even in circumstances when a higher
priority process is ready to execute.
![Page 23: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/23.jpg)
Linux Kernel 2.4 vs 2.6
![Page 24: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/24.jpg)
Linux Kernel 2.4 vs 2.6
![Page 25: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/25.jpg)
25University Program Material
Copyright © ARM Ltd 2012
Cortex-M4 Processor Overview
with ARM Processors and Architectures
![Page 26: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/26.jpg)
26University Program Material
Copyright © ARM Ltd 2012
Introduction
![Page 27: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/27.jpg)
27University Program Material
Copyright © ARM Ltd 2012
ARM
ARM was developed at Acorn Computer Limited of Cambridge, UK (between
1983 & 1985)
RISC concept introduced in 1980 at Stanford and Berkeley
ARM founded in November 1990
Advanced RISC Machines
Best known for its range of RISC processor cores designs
Other products – fabric IP, software tools, models, cell libraries - to help partners
develop and ship ARM-based SoCs
ARM does not manufacture silicon
Licensed to partners to develop and fabricate new micro-controllers
Soft-core
![Page 28: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/28.jpg)
28University Program Material
Copyright © ARM Ltd 2012
ARM Architecture
Based upon RISC Architecture with enhancements to meet requirements of
embedded applications
A large uniform register file
Load-store architecture
Fixed length instructions
32-bit processor (v1-v7), 64-bit processor (v8)
Good speed/power
High code density
![Page 29: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/29.jpg)
29University Program Material
Copyright © ARM Ltd 2012
Enhancement to Basic RISC
Control over both ALU and shifter for every data processing operations
ADD r2, r3, r4, LSL #2 ; r2 = r3 + (r4 * 4)
Auto-increment and auto-decrement addressing modes
To optimize program loops
Load/Store multiple data instructions
To maximize data throughput
LDM, STM
Conditional execution of instructions
To maximize execution throughput
![Page 30: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/30.jpg)
30University Program Material
Copyright © ARM Ltd 2012
Embedded Processors
![Page 31: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/31.jpg)
31University Program Material
Copyright © ARM Ltd 2012
Application Processors
![Page 32: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/32.jpg)
32University Program Material
Copyright © ARM Ltd 2012
ARM Processor Family
![Page 33: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/33.jpg)
33University Program Material
Copyright © ARM Ltd 2012
Summary of Processor Characteristics
![Page 34: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/34.jpg)
34University Program Material
Copyright © ARM Ltd 2012
Pipeline
![Page 35: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/35.jpg)
35University Program Material
Copyright © ARM Ltd 2012
ARM Cortex Advanced Processors
![Page 36: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/36.jpg)
36University Program Material
Copyright © ARM Ltd 2012
Application Examples
![Page 37: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/37.jpg)
37University Program Material
Copyright © ARM Ltd 2012
ARM Architecture Overview
![Page 38: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/38.jpg)
38University Program Material
Copyright © ARM Ltd 2012
Architecture History
![Page 39: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/39.jpg)
39University Program Material
Copyright © ARM Ltd 2012
Halfword and
signed halfword
/ byte support
System mode
Thumb
instruction set
(v4T)
Improved
interworking
CLZ
Saturated arithmetic
DSP MAC
instructions
Extensions:
Jazelle (5TEJ)
SIMD Instructions
Multi-processing
v6 Memory architecture
Unaligned data support
Extensions:
Thumb-2 (6T2)
TrustZone® (6Z)
Multicore (6K)
Thumb only (6-M)
Note that implementations of the same architecture can be different
Cortex-A8 - architecture v7-A, with a 13-stage pipeline
Cortex-A9 - architecture v7-A, with an 8-stage pipeline
Thumb-2
Architecture Profiles
7-A - Applications
7-R - Real-time
7-M - Microcontroller
v4 v5 v6 v7
Development of the ARM Architecture
![Page 40: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/40.jpg)
40University Program Material
Copyright © ARM Ltd 2012
Architecture ARMv7 profiles
Application profile (ARMv7-A)
Memory management support (MMU)
Highest performance at low power
Influenced by multi-tasking OS system requirements
TrustZone and Jazelle-RCT for a safe, extensible system
e.g. Cortex-A5, Cortex-A9
Real-time profile (ARMv7-R)
Protected memory (MPU)
Low latency and predictability ‘real-time’ needs
Evolutionary path for traditional embedded business
e.g. Cortex-R4
Microcontroller profile (ARMv7-M, ARMv7E-M, ARMv6-M)
Lowest gate count entry point
Deterministic and predictable behavior a key priority
Deeply embedded use
e.g. Cortex-M3
![Page 41: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/41.jpg)
41University Program Material
Copyright © ARM Ltd 2012
Which architecture is my processor?
![Page 42: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/42.jpg)
42University Program Material
Copyright © ARM Ltd 2012
Cotex-M Processor Family
![Page 43: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/43.jpg)
43University Program Material
Copyright © ARM Ltd 2012
ARMv7-M Architecture
![Page 44: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/44.jpg)
44University Program Material
Copyright © ARM Ltd 2012
ARMv7-M Profile Overview
v7-M Cores are designed to support the microcontroller market
Simpler to program – entire application can be programmed in C
Fewer features needed than in application processors
Register and ISA changes from other ARM cores
No ARM instruction set support
Only one set of registers
xPSR has different bits than CPSR
Different modes and exception models
Only two modes: Thread mode and Handler mode
Vector table is addresses, not instructions
Exceptions automatically save state (r0-r3, r12, lr, xPSR, pc) on the stack
Different system control/memory layout
Cores have a fixed memory map
No coprocessor 15 – controlled through memory mapped control registers
![Page 45: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/45.jpg)
45University Program Material
Copyright © ARM Ltd 2012
Cortex-M3
Cortex M3 Total
60k* Gates
ARMv7-M Architecture
Thumb-2 only
Fully programmable in C
3-stage pipeline
Optional MPU
AHB-Lite bus interface
Fixed memory map
1-240 interrupts
Configurable priority levels
Non-Maskable Interrupt support
Debug and Sleep control
Serial wire or JTAG debug
Optional ETM
![Page 46: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/46.jpg)
46University Program Material
Copyright © ARM Ltd 2012
Cortex-M0
Cortex M3 Total
60k* Gates
ARMv6-M Architecture
16-bit Thumb-2 with system control
instructions
Fully programmable in C
3-stage pipeline
AHB-Lite bus interface
Fixed memory map
1-32 interrupts
Configurable priority levels
Non-Maskable Interrupt support
Low power support
Core configured with or without
debug
Variable number of watchpoints and
breakpoints
![Page 47: Digital Control & Real-Timeccrs.hanyang.ac.kr/webpage_limdj/automation/lecture1.pdf · Real-Time Real-Time is the essential part in digital control “A real-time system is one in](https://reader034.vdocuments.net/reader034/viewer/2022052500/5f81f66c4940a5324e28aa81/html5/thumbnails/47.jpg)
47University Program Material
Copyright © ARM Ltd 2012
Thumb-2 Technology