SlideShare a Scribd company logo
1 of 58
Fall 2018 - ECE 5436
Lecture 1
Harry Le, PhD
Valvano, Le
What Is a Real Time Operating System
• Involved from a collection of executives
• Complexity grows
• Becomes a manager of resources. Manages memory, I/O, tasks, threads
• Performance metrics:
• Deadline
• Reliability
• Threat synchronization
• Software evolution
• Porting
• Different from the general purpose OS
Valvano, Le
Overview of the labs
1. Introduction to I/O using the BSP and debugging,
• Learn about Keil compiler and debugger
• Understand what the MK-II boosterpack measures
• Learn how to perform timing profiles of the software system
2. Thread management for a personal fitness device
• Multiple threads
• Real-time periodic threads
• Spinlock semaphores
• Round robin scheduler
3. Thread synchronization and scheduling for a personal fitness device
• Timer-based real-time threads
• Thread sleeping
• Blocking semaphores with first come first serve scheduler
Valvano, Le
Overview (cont.)
4. Real-time operating system for a hand-held video game
• Edge triggered interrupts
• Blocking semaphores with priority scheduler
5. File system using the flash ROM of the microcontroller,
• Logging data onto flash/playback of data
6. Bluetooth personal area network.
• Interacting with the device from a smart phone
• Wifi
• IoT
Valvano, Le
Keil
• Keil version 5: https://www.keil.com/demo/eval/arm.htm
Since Keil version 5 does not support Stellaris ICDI interface, you need to
install this addon to use it with the Tiva C
http://www.keil.com//files/download/MDK_Stellaris_ICDI_AddOn.exe
Lab Parts
• Many electronic stores like TI, Mouser, etc. carry the following parts
• Education Booster Pack BOOSTXL-EDUMKII
https://www.ti.com/store/ti/en/p/product/?p=BOOSTXL-EDUMKII
• Tiva C EK-TM4C123GXL
• https://www.ti.com/store/ti/en/p/product/?p=EK-TM4C123GXL
• You need to remove resistor R9 and R10 of the Tiva C for it to work properly
with the Education Booster Pack
• BOOSTXL-CC2650MA
https://www.ti.com/store/ti/en/p/product/?p=BOOSTXL-CC2650MA
Valvano, Le
Valvano, Le
RTOS
• Computer Architecture: memory, I/O, data, processors
• RTOS:
• manages those resources
• Guarantee timing constraints
• Support synchronization and communication between tasks
• Portability: build a new system by changing an old one.
• A software layer between the application software and the hardware
Valvano, Le
Regular OS versus RTOS
Regular OS Real-time OS
Complex Simple
Best effort Guaranteed response
Fairness Strict timing constraints
Average bandwidth Minimum and maximum limits
Unknown components Known components
Unpredictable behavior Predictable behavior
Plug and play Upgradable
Valvano, Le
Some Real Time Domain and Applications
Laplante
Common Misconceptions
• Real-time systems are synonymous with “fast” systems.
• Rate-monotonic analysis has solved “the real-time problem.”
• There are universal, widely accepted methodologies for real-time
systems, specification and design.
• There is never a need to build a real-time operating system, because
many commercial products exist.
• The study of real-time systems is mostly about scheduling theory.
Laplante, Valvano, Le
Lecture 1 (cont.)
• An embedded system is a smart device with a processor that has a special
and dedicated purpose. The user usually does not or cannot upgrade the
hardware/software or change what the system does.
• Real time means that the embedded system must respond to critical
events within a strictly defined time, called the deadline.
• Five types of software functions the processor can perform in an
embedded system.
• Mathematical and/or data processing operation and analyze data and make decisions
based on the data.
• Handling and managing time: as an input (e.g., measure period), an output (e.g.,
output waveforms), and a means to synchronize tasks (e.g., run 1000 times a
second).
• Real-time input/output for the purpose of measurement or control.
• Digital signal processing (DSP), which are mathematical calculations on data streams.
• Communication and networking.
Valvano, Le
Valvano, Le
Lecture 1 (cont.)
• Constraints of an embedded system:
• Test and verify
• Safety critical systems
• Low cost
• Low power
• Handheld
• Small weight
• Performance: correct and in time
• Harsh environment
Valvano, Le
A Von Neumann Computer System
Valvano, Le
Basic components of a processor
Valvano, Le
Microcontroller
• Contains all components of a computer on a single chip
• Example: TivaC TI TM4C123, MSP432
• Have instruction pipeline
• ARM Cortex-M: Harvard architecture
Valvano, Le
ARM Cortex-M registers
Valvano, Le
ARM Architecture Procedure Call Standard,
AAPCS
• The ARM Architecture Procedure Call Standard, AAPCS, part of the
ARM Application Binary Interface (ABI),
• Uses registers R0, R1, R2, and R3 to pass input parameters into a C function or
an assembly subroutine. Also according to AAPCS we place the return
parameter in Register R0.
• Functions save R4-R11, use R4-R11, and then restore R4-R11 before returning.
• Keep the stack aligned to 64 bits, by pushing and popping an even number of
registers.
Valvano, Le
Status Registers
Valvano, Le
Stacks
• Last-in-first-out temporary storage
• To push data we first decrement the SP by 4 then store 32-bit data at
the SP.
• To pop data from the stack, the 32-bit information pointed to by SP is
first retrieved, and then the stack pointer is incremented by 4.
Valvano, Le
ARM ISA: Registers, Memory-map
TI TM4C123
Microcontroller
Condition Code Bits Indicates
N negative Result is negative
Z zero Result is zero
V overflow Signed overflow
C carry Unsigned overflow
ARM Assembly Language
• Four fields
• Labels (optional)
• Opcodes or pseudo-ops:
• LDR STR MOV PUSH POP B BL BX ADD SUB CPSID and CPSIE
• AREA EQU IMPORT EXPORT and ALIGN
• Operands
• Comments (optional)
Valvano, Le
Conditional Branch Instructions
❑Unsigned conditional branch
❖follow SUBS CMN or CMP
BLO target ; Branch if unsigned less than (if C=0, same as BCC)
BLS target ; Branch if unsigned less than or equal to (if C=0 or Z=1)
BHS target ; Branch if unsigned greater than or equal to
(if C=1, same as BCS)
BHI target ; Branch if unsigned greater than (if C=1 and Z=0)
CMP R0,R1
BLO
R0<R1
target
Next instruction
R0≥R1
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Conditional Branch Instructions
❑Signed conditional branch
❖follow SUBS CMN or CMP
BLT target ; if signed less than (if (~N&V | N&~V)=1, i.e. if N≠V)
BGE target ; if signed greater than or equal to (if (~N&V | N&~V)=0, i.e. if N=V)
BGT target ; if signed greater than (if (Z | ~N&V | N&~V)=0, i.e. if Z=0 and N=V)
BLE target ; if signed less than or equal to
(if (Z | ~N&V | N&~V)=1, i.e. if Z=1 or N≠V)
CMP R0,R1
BLT
R0<R1
target
Next instruction
R0≥R1
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Equality Test
Program 5.8. Conditional structures that test for equality.
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Unsigned Conditional Structures
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Program 5.9. Unsigned conditional structures.
Valvano, Le
Signed Conditional Structures
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Program 5.11. Signed conditional structures.
Valvano, Le
If-then-else
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
While Loops
LDR R4, =G1 ; R4 -> G1
LDR R5, =G2 ; R5 -> G2
loop LDR R0, [R5] ; R0 = G2
LDR R1, [R4] ; R1 = G1
CMP R0, R1 ; is G2 <= G1?
BLS next ; if so, skip to next
BL Body ; body of the loop
B loop
next
uint32_t G1,G2;
while(G2 > G1){
Body();
}
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
For Loops
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
For Loops
MOV R4, #0 ; R4 = 0
loop CMP R4, #100 ; index >= 100?
BHS done ; if so, skip to done
BL Process ; process function*
ADD R4, R4, #1 ; R4 = R4 + 1
B loop
done
for(i=0; i<100; i++){
Process();
}
MOV R4, #100 ; R4 = 100
loop BL Process ; process function
SUBS R4, R4, #1 ; R4 = R4 - 1
BNE loop
done
for(i=100; i!=0; i--){
Process();
}
Count up
Count down
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Registers to pass parameters
Subroutine
3) Sees the inputs in
registers
4) Performs the
action of the
subroutine
5) Places the
outputs in registers
High level program
1) Sets Registers to
contain inputs
2) Calls subroutine
6) Registers contain
outputs
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Stack to pass parameters
Subroutine
3) Sees the inputs
on stack (pops)
4) Performs the
action of the
subroutine
5) Pushes outputs
on the stack
High level program
1) Pushes inputs on
the Stack
2) Calls subroutine
6) Stack contain
outputs (pop)
7) Balance stack
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Assembly Parameter Passing
❑ Parameters passed using registers/stack
❑ Parameter passing need not be done using only
registers or only stack
❖Some inputs could come in registers and
some on stack and outputs could be returned
in registers and some on the stack
❑ Calling Convention
❖Application Binary Interface (ABI)
❖ARM: use registers for first 4 parameters,
use stack beyond, return using R0
❑ Keep in mind that you may want your assembly
subroutine to someday be callable from C or
callable from someone else’s software
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
ARM Arch. Procedure Call Standard
(AAPCS)
❑ ABI standard for all ARM architectures
❑ Use registers R0, R1, R2, and R3 to pass the
first four input parameters (in order) into any
function, C or assembly.
❑ We place the return parameter in Register R0.
❑ Functions can freely modify registers R0–R3
and R12. If a function needs to use R4 through
R11, it is necessary to push their current
register values onto the stack, use the register,
and then pop the old value off the stack before
returning.
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Parameter-Passing: Registers
Caller
;--call a subroutine that
;uses registers for parameter passing
MOV R0,#7
MOV R1,#3
BL Exp
;; R2 becomes 7^3 = 343 (0x157)
Callee
;---------Exp-----------
; Input: R0 and R1 have inputs XX an YY
; Output: R2 has the result XX raised to YY
; Comments: R1 and R2 and non-negative
; Destroys input R1
XX RN 0
YY RN 1
Pow RN 2
Exp
ADDS XX,#0
BEQ Zero
ADDS YY,#0 ; check if YY is zero
BEQ One
MOV pow, #1 ; Initial product is 1
More MUL pow,XX ; multiply product with XX
SUBS YY,#1 ; Decrement YY
BNE More
B Retn ; Done, so return
Zero MOV pow,#0 ; XX is 0 so result is 0
B Retn
One MOV pow,#1 ; YY is 0 so result is 1
Retn BX LR
❑ Suggest changes
to make it AAPCS
Return by value
Call by value
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Parameter-Passing: Stack
Caller
;-------- call a subroutine that
; uses stack for parameter passing
MOV R0,#12
MOV R1,#5
MOV R2,#22
MOV R3,#7
MOV R4,#18
PUSH {R0-R4}
; Stack has 12,5,22,7 and 18
; (with 12 on top)
BL Max5
; Call Max5 to find the maximum
;of the five numbers
POP {R5}
;; R5 has the max element (22)
Callee
;---------Max5-----------
; Input: 5 signed numbers pushed on the stack
; Output: put only the maximum number on the stack
; Comments: The input numbers are removed from stack
numM RN 1 ; current number
max RN 2 ; maximum so far
count RN 0 ; how many elements
Max5
POP {max} ; get top element (top of stack)
; store it in max
MOV count,#4 ; 4 more to go
Again POP {numM} ; get next element
CMP numM,max
BLT Next
MOV max, numM ; new numM is the max
Next SUBS count,#1 ; one more checked
BNE Again
PUSH {max} ; found max so push it on stack
BX LR
❑ Flexible style, but not AAPCS
Return by value
Call by value
Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari
Valvano, Le
Parameter-Passing: Stack & Regs
Caller
;------call a subroutine that uses
;both stack and registers for
;parameter passing
MOV R0,#6 ; R0 elem count
MOV R1,#-14
MOV R2,#5
MOV R3,#32
MOV R4,#-7
MOV R5,#0
MOV R6,#-5
PUSH {R4-R6} ; rest on stack
; R0 has element count
; R1-R3 have first 3 elements;
; remaining on Stack
BL MinMax
;; R0 has -14 and R1 has 32
;; upon return
❑ Not AAPCS
Callee
;---------MinMax-----------
; Input: N numbers reg+stack; N passed in R0
; Output: Return in R0 the min and R1 the max
; Comments: The input numbers are removed from stack
numMM RN 3; hold the current number in numMM
max RN 1 ; hold maximum so far in max
min RN 2
N RN 0 ; how many elements
MinMax
PUSH {R1-R3} ; put all elements on stack
CMP N,#0 ; if N is zero nothing to do
BEQ DoneMM
POP {min} ; pop top and set it
MOV max,min ; as the current min and max
loop SUBS N,#1 ; decrement and check
BEQ DoneMM
POP {numMM}
CMP numMM,max
BLT Chkmin
MOV max,numMM ; new num is the max
Chkmin CMP numMM,min
BGT NextMM
MOV min,numMM ; new num is the min
NextMM B loop
DoneMM MOV R0,min ; R0 has min
BX LR
Valvano, Le
Object code
• Assembler translate source code into object code, which are machine
instructions executed by the processor
• Object code is halfword-aligned.
• Thumb-2 instructions can be 16 or 32 bits wide. Program counter (PC)
bit 0 is always 0.
Valvano, Le
Booster Pack
• Button 1 function
• Button 2 function
• Joystick
• Beeping
• Sensors: accelerometer, microphone, LCD, Light, temperature
Valvano, Le
BSP (Board Support Package)
Valvano, Le
Booster Pack (BOOSTXL-EDUMKII)
Valvano, Le
BOOSTXL-EDUMKII Educational BoosterPack
Valvano, Le
Pinouts
Valvano, Le
TI OPT3001 Light Sensor
Valvano, Le
TI TMP006 Temperature Sensor
Valvano, Le
Servo Motor Connector
Valvano, Le
3-Axis Accelerometer
Valvano, Le
RGB Multicolor LED
Valvano, Le
Piezo Buzzer
Valvano, Le
Color 128x128-Pixel TFT LCD Display
Valvano, Le
Microphone
Valvano, Le
2-Axis Joystick With Pushbutton
Valvano, Le
User Pushbuttons
Valvano, Le
Valvano, Le
Figure 6.20 shows a CC2650 BoosterPack. This board comes preprogrammed with the simple network processor
described in the next section. With a JTAG debugger, other programs can be loaded onto this CC2650. For more
information see
http://www.ti.com/tool/boostxl-cc2650ma
Figure 6.21. CC2650 LaunchPad (LAUNCHXL-CC2650).
Figure 6.21 shows a CC2650 LaunchPad. The top part of the PCB is the debugger and the bottom part implements the CC2650 target
system. Figure 6.22 shows the pin connections to the booster pack headers. More details on the connections we will use are given in Lab
6. For more information, see
http://www.ti.com/ww/en/launchpad/launchpads-connected-launchxl-cc2650.html
Valvano, Le
Figure 6.22. CC2650 LaunchPad pin connections.

More Related Content

Similar to What Is a Real Time Operating System

Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with PipeliningAneesh Raveendran
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureVinit Raut
 
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.The Linux Foundation
 
Demo how to efficiently evaluate nf-vi performance by leveraging opnfv testi...
Demo  how to efficiently evaluate nf-vi performance by leveraging opnfv testi...Demo  how to efficiently evaluate nf-vi performance by leveraging opnfv testi...
Demo how to efficiently evaluate nf-vi performance by leveraging opnfv testi...OPNFV
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationDr. Balaji Ganesh Rajagopal
 
UNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsUNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsButtaRajasekhar2
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureDhaval Bagal
 
Applications of the Reverse Engineering Language REIL
Applications of the Reverse Engineering Language REILApplications of the Reverse Engineering Language REIL
Applications of the Reverse Engineering Language REILzynamics GmbH
 
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT Talks
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT TalksMykhailo Zarai "Be careful when dealing with C++" at Rivne IT Talks
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT TalksVadym Muliavka
 
2010 02 instrumentation_and_runtime_measurement
2010 02 instrumentation_and_runtime_measurement2010 02 instrumentation_and_runtime_measurement
2010 02 instrumentation_and_runtime_measurementPTIHPA
 
Patrick jcp
Patrick jcpPatrick jcp
Patrick jcpd0nn9n
 
Time v Frequency Domain Analysis For Large Automotive Systems
Time v Frequency Domain Analysis For Large Automotive SystemsTime v Frequency Domain Analysis For Large Automotive Systems
Time v Frequency Domain Analysis For Large Automotive SystemsAltair
 
ReFRESCO-General-Jan2015
ReFRESCO-General-Jan2015ReFRESCO-General-Jan2015
ReFRESCO-General-Jan2015Guilherme Vaz
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelinesturki_09
 
OVN DBs HA with scale test
OVN DBs HA with scale testOVN DBs HA with scale test
OVN DBs HA with scale testAliasgar Ginwala
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on androidKoan-Sin Tan
 
Heart rate monitor system
Heart rate monitor systemHeart rate monitor system
Heart rate monitor systemSkyinthe Raw
 

Similar to What Is a Real Time Operating System (20)

Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
 
Demo how to efficiently evaluate nf-vi performance by leveraging opnfv testi...
Demo  how to efficiently evaluate nf-vi performance by leveraging opnfv testi...Demo  how to efficiently evaluate nf-vi performance by leveraging opnfv testi...
Demo how to efficiently evaluate nf-vi performance by leveraging opnfv testi...
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and Organization
 
Ch3-2
Ch3-2Ch3-2
Ch3-2
 
UNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsUNIT 3 - General Purpose Processors
UNIT 3 - General Purpose Processors
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Applications of the Reverse Engineering Language REIL
Applications of the Reverse Engineering Language REILApplications of the Reverse Engineering Language REIL
Applications of the Reverse Engineering Language REIL
 
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT Talks
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT TalksMykhailo Zarai "Be careful when dealing with C++" at Rivne IT Talks
Mykhailo Zarai "Be careful when dealing with C++" at Rivne IT Talks
 
2010 02 instrumentation_and_runtime_measurement
2010 02 instrumentation_and_runtime_measurement2010 02 instrumentation_and_runtime_measurement
2010 02 instrumentation_and_runtime_measurement
 
Patrick jcp
Patrick jcpPatrick jcp
Patrick jcp
 
Time v Frequency Domain Analysis For Large Automotive Systems
Time v Frequency Domain Analysis For Large Automotive SystemsTime v Frequency Domain Analysis For Large Automotive Systems
Time v Frequency Domain Analysis For Large Automotive Systems
 
ReFRESCO-General-Jan2015
ReFRESCO-General-Jan2015ReFRESCO-General-Jan2015
ReFRESCO-General-Jan2015
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
 
Protocol Independence
Protocol IndependenceProtocol Independence
Protocol Independence
 
OVN DBs HA with scale test
OVN DBs HA with scale testOVN DBs HA with scale test
OVN DBs HA with scale test
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
Intel IA 64
Intel IA 64Intel IA 64
Intel IA 64
 
Heart rate monitor system
Heart rate monitor systemHeart rate monitor system
Heart rate monitor system
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 

What Is a Real Time Operating System

  • 1. Fall 2018 - ECE 5436 Lecture 1 Harry Le, PhD Valvano, Le
  • 2. What Is a Real Time Operating System • Involved from a collection of executives • Complexity grows • Becomes a manager of resources. Manages memory, I/O, tasks, threads • Performance metrics: • Deadline • Reliability • Threat synchronization • Software evolution • Porting • Different from the general purpose OS Valvano, Le
  • 3. Overview of the labs 1. Introduction to I/O using the BSP and debugging, • Learn about Keil compiler and debugger • Understand what the MK-II boosterpack measures • Learn how to perform timing profiles of the software system 2. Thread management for a personal fitness device • Multiple threads • Real-time periodic threads • Spinlock semaphores • Round robin scheduler 3. Thread synchronization and scheduling for a personal fitness device • Timer-based real-time threads • Thread sleeping • Blocking semaphores with first come first serve scheduler Valvano, Le
  • 4. Overview (cont.) 4. Real-time operating system for a hand-held video game • Edge triggered interrupts • Blocking semaphores with priority scheduler 5. File system using the flash ROM of the microcontroller, • Logging data onto flash/playback of data 6. Bluetooth personal area network. • Interacting with the device from a smart phone • Wifi • IoT Valvano, Le
  • 5. Keil • Keil version 5: https://www.keil.com/demo/eval/arm.htm Since Keil version 5 does not support Stellaris ICDI interface, you need to install this addon to use it with the Tiva C http://www.keil.com//files/download/MDK_Stellaris_ICDI_AddOn.exe
  • 6. Lab Parts • Many electronic stores like TI, Mouser, etc. carry the following parts • Education Booster Pack BOOSTXL-EDUMKII https://www.ti.com/store/ti/en/p/product/?p=BOOSTXL-EDUMKII • Tiva C EK-TM4C123GXL • https://www.ti.com/store/ti/en/p/product/?p=EK-TM4C123GXL • You need to remove resistor R9 and R10 of the Tiva C for it to work properly with the Education Booster Pack • BOOSTXL-CC2650MA https://www.ti.com/store/ti/en/p/product/?p=BOOSTXL-CC2650MA Valvano, Le
  • 8. RTOS • Computer Architecture: memory, I/O, data, processors • RTOS: • manages those resources • Guarantee timing constraints • Support synchronization and communication between tasks • Portability: build a new system by changing an old one. • A software layer between the application software and the hardware Valvano, Le
  • 9. Regular OS versus RTOS Regular OS Real-time OS Complex Simple Best effort Guaranteed response Fairness Strict timing constraints Average bandwidth Minimum and maximum limits Unknown components Known components Unpredictable behavior Predictable behavior Plug and play Upgradable Valvano, Le
  • 10. Some Real Time Domain and Applications Laplante
  • 11. Common Misconceptions • Real-time systems are synonymous with “fast” systems. • Rate-monotonic analysis has solved “the real-time problem.” • There are universal, widely accepted methodologies for real-time systems, specification and design. • There is never a need to build a real-time operating system, because many commercial products exist. • The study of real-time systems is mostly about scheduling theory. Laplante, Valvano, Le
  • 12. Lecture 1 (cont.) • An embedded system is a smart device with a processor that has a special and dedicated purpose. The user usually does not or cannot upgrade the hardware/software or change what the system does. • Real time means that the embedded system must respond to critical events within a strictly defined time, called the deadline. • Five types of software functions the processor can perform in an embedded system. • Mathematical and/or data processing operation and analyze data and make decisions based on the data. • Handling and managing time: as an input (e.g., measure period), an output (e.g., output waveforms), and a means to synchronize tasks (e.g., run 1000 times a second). • Real-time input/output for the purpose of measurement or control. • Digital signal processing (DSP), which are mathematical calculations on data streams. • Communication and networking. Valvano, Le
  • 14. Lecture 1 (cont.) • Constraints of an embedded system: • Test and verify • Safety critical systems • Low cost • Low power • Handheld • Small weight • Performance: correct and in time • Harsh environment Valvano, Le
  • 15. A Von Neumann Computer System Valvano, Le
  • 16. Basic components of a processor Valvano, Le
  • 17. Microcontroller • Contains all components of a computer on a single chip • Example: TivaC TI TM4C123, MSP432 • Have instruction pipeline • ARM Cortex-M: Harvard architecture Valvano, Le
  • 19. ARM Architecture Procedure Call Standard, AAPCS • The ARM Architecture Procedure Call Standard, AAPCS, part of the ARM Application Binary Interface (ABI), • Uses registers R0, R1, R2, and R3 to pass input parameters into a C function or an assembly subroutine. Also according to AAPCS we place the return parameter in Register R0. • Functions save R4-R11, use R4-R11, and then restore R4-R11 before returning. • Keep the stack aligned to 64 bits, by pushing and popping an even number of registers. Valvano, Le
  • 21. Stacks • Last-in-first-out temporary storage • To push data we first decrement the SP by 4 then store 32-bit data at the SP. • To pop data from the stack, the 32-bit information pointed to by SP is first retrieved, and then the stack pointer is incremented by 4. Valvano, Le
  • 22. ARM ISA: Registers, Memory-map TI TM4C123 Microcontroller Condition Code Bits Indicates N negative Result is negative Z zero Result is zero V overflow Signed overflow C carry Unsigned overflow
  • 23. ARM Assembly Language • Four fields • Labels (optional) • Opcodes or pseudo-ops: • LDR STR MOV PUSH POP B BL BX ADD SUB CPSID and CPSIE • AREA EQU IMPORT EXPORT and ALIGN • Operands • Comments (optional) Valvano, Le
  • 24. Conditional Branch Instructions ❑Unsigned conditional branch ❖follow SUBS CMN or CMP BLO target ; Branch if unsigned less than (if C=0, same as BCC) BLS target ; Branch if unsigned less than or equal to (if C=0 or Z=1) BHS target ; Branch if unsigned greater than or equal to (if C=1, same as BCS) BHI target ; Branch if unsigned greater than (if C=1 and Z=0) CMP R0,R1 BLO R0<R1 target Next instruction R0≥R1 Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 25. Conditional Branch Instructions ❑Signed conditional branch ❖follow SUBS CMN or CMP BLT target ; if signed less than (if (~N&V | N&~V)=1, i.e. if N≠V) BGE target ; if signed greater than or equal to (if (~N&V | N&~V)=0, i.e. if N=V) BGT target ; if signed greater than (if (Z | ~N&V | N&~V)=0, i.e. if Z=0 and N=V) BLE target ; if signed less than or equal to (if (Z | ~N&V | N&~V)=1, i.e. if Z=1 or N≠V) CMP R0,R1 BLT R0<R1 target Next instruction R0≥R1 Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 26. Equality Test Program 5.8. Conditional structures that test for equality. Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 27. Unsigned Conditional Structures Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Program 5.9. Unsigned conditional structures. Valvano, Le
  • 28. Signed Conditional Structures Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Program 5.11. Signed conditional structures. Valvano, Le
  • 29. If-then-else Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 30. While Loops LDR R4, =G1 ; R4 -> G1 LDR R5, =G2 ; R5 -> G2 loop LDR R0, [R5] ; R0 = G2 LDR R1, [R4] ; R1 = G1 CMP R0, R1 ; is G2 <= G1? BLS next ; if so, skip to next BL Body ; body of the loop B loop next uint32_t G1,G2; while(G2 > G1){ Body(); } Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 31. For Loops Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 32. For Loops MOV R4, #0 ; R4 = 0 loop CMP R4, #100 ; index >= 100? BHS done ; if so, skip to done BL Process ; process function* ADD R4, R4, #1 ; R4 = R4 + 1 B loop done for(i=0; i<100; i++){ Process(); } MOV R4, #100 ; R4 = 100 loop BL Process ; process function SUBS R4, R4, #1 ; R4 = R4 - 1 BNE loop done for(i=100; i!=0; i--){ Process(); } Count up Count down Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 33. Registers to pass parameters Subroutine 3) Sees the inputs in registers 4) Performs the action of the subroutine 5) Places the outputs in registers High level program 1) Sets Registers to contain inputs 2) Calls subroutine 6) Registers contain outputs Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 34. Stack to pass parameters Subroutine 3) Sees the inputs on stack (pops) 4) Performs the action of the subroutine 5) Pushes outputs on the stack High level program 1) Pushes inputs on the Stack 2) Calls subroutine 6) Stack contain outputs (pop) 7) Balance stack Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 35. Assembly Parameter Passing ❑ Parameters passed using registers/stack ❑ Parameter passing need not be done using only registers or only stack ❖Some inputs could come in registers and some on stack and outputs could be returned in registers and some on the stack ❑ Calling Convention ❖Application Binary Interface (ABI) ❖ARM: use registers for first 4 parameters, use stack beyond, return using R0 ❑ Keep in mind that you may want your assembly subroutine to someday be callable from C or callable from someone else’s software Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 36. ARM Arch. Procedure Call Standard (AAPCS) ❑ ABI standard for all ARM architectures ❑ Use registers R0, R1, R2, and R3 to pass the first four input parameters (in order) into any function, C or assembly. ❑ We place the return parameter in Register R0. ❑ Functions can freely modify registers R0–R3 and R12. If a function needs to use R4 through R11, it is necessary to push their current register values onto the stack, use the register, and then pop the old value off the stack before returning. Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 37. Parameter-Passing: Registers Caller ;--call a subroutine that ;uses registers for parameter passing MOV R0,#7 MOV R1,#3 BL Exp ;; R2 becomes 7^3 = 343 (0x157) Callee ;---------Exp----------- ; Input: R0 and R1 have inputs XX an YY ; Output: R2 has the result XX raised to YY ; Comments: R1 and R2 and non-negative ; Destroys input R1 XX RN 0 YY RN 1 Pow RN 2 Exp ADDS XX,#0 BEQ Zero ADDS YY,#0 ; check if YY is zero BEQ One MOV pow, #1 ; Initial product is 1 More MUL pow,XX ; multiply product with XX SUBS YY,#1 ; Decrement YY BNE More B Retn ; Done, so return Zero MOV pow,#0 ; XX is 0 so result is 0 B Retn One MOV pow,#1 ; YY is 0 so result is 1 Retn BX LR ❑ Suggest changes to make it AAPCS Return by value Call by value Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 38. Parameter-Passing: Stack Caller ;-------- call a subroutine that ; uses stack for parameter passing MOV R0,#12 MOV R1,#5 MOV R2,#22 MOV R3,#7 MOV R4,#18 PUSH {R0-R4} ; Stack has 12,5,22,7 and 18 ; (with 12 on top) BL Max5 ; Call Max5 to find the maximum ;of the five numbers POP {R5} ;; R5 has the max element (22) Callee ;---------Max5----------- ; Input: 5 signed numbers pushed on the stack ; Output: put only the maximum number on the stack ; Comments: The input numbers are removed from stack numM RN 1 ; current number max RN 2 ; maximum so far count RN 0 ; how many elements Max5 POP {max} ; get top element (top of stack) ; store it in max MOV count,#4 ; 4 more to go Again POP {numM} ; get next element CMP numM,max BLT Next MOV max, numM ; new numM is the max Next SUBS count,#1 ; one more checked BNE Again PUSH {max} ; found max so push it on stack BX LR ❑ Flexible style, but not AAPCS Return by value Call by value Bard, Erez, Gerstlauer, Valvano, Yerraballi, Telang, Janapa Reddi, Tiwari Valvano, Le
  • 39. Parameter-Passing: Stack & Regs Caller ;------call a subroutine that uses ;both stack and registers for ;parameter passing MOV R0,#6 ; R0 elem count MOV R1,#-14 MOV R2,#5 MOV R3,#32 MOV R4,#-7 MOV R5,#0 MOV R6,#-5 PUSH {R4-R6} ; rest on stack ; R0 has element count ; R1-R3 have first 3 elements; ; remaining on Stack BL MinMax ;; R0 has -14 and R1 has 32 ;; upon return ❑ Not AAPCS Callee ;---------MinMax----------- ; Input: N numbers reg+stack; N passed in R0 ; Output: Return in R0 the min and R1 the max ; Comments: The input numbers are removed from stack numMM RN 3; hold the current number in numMM max RN 1 ; hold maximum so far in max min RN 2 N RN 0 ; how many elements MinMax PUSH {R1-R3} ; put all elements on stack CMP N,#0 ; if N is zero nothing to do BEQ DoneMM POP {min} ; pop top and set it MOV max,min ; as the current min and max loop SUBS N,#1 ; decrement and check BEQ DoneMM POP {numMM} CMP numMM,max BLT Chkmin MOV max,numMM ; new num is the max Chkmin CMP numMM,min BGT NextMM MOV min,numMM ; new num is the min NextMM B loop DoneMM MOV R0,min ; R0 has min BX LR Valvano, Le
  • 40. Object code • Assembler translate source code into object code, which are machine instructions executed by the processor • Object code is halfword-aligned. • Thumb-2 instructions can be 16 or 32 bits wide. Program counter (PC) bit 0 is always 0. Valvano, Le
  • 41. Booster Pack • Button 1 function • Button 2 function • Joystick • Beeping • Sensors: accelerometer, microphone, LCD, Light, temperature Valvano, Le
  • 42. BSP (Board Support Package) Valvano, Le
  • 46. TI OPT3001 Light Sensor Valvano, Le
  • 47. TI TMP006 Temperature Sensor Valvano, Le
  • 52. Color 128x128-Pixel TFT LCD Display Valvano, Le
  • 54. 2-Axis Joystick With Pushbutton Valvano, Le
  • 56. Valvano, Le Figure 6.20 shows a CC2650 BoosterPack. This board comes preprogrammed with the simple network processor described in the next section. With a JTAG debugger, other programs can be loaded onto this CC2650. For more information see http://www.ti.com/tool/boostxl-cc2650ma
  • 57. Figure 6.21. CC2650 LaunchPad (LAUNCHXL-CC2650). Figure 6.21 shows a CC2650 LaunchPad. The top part of the PCB is the debugger and the bottom part implements the CC2650 target system. Figure 6.22 shows the pin connections to the booster pack headers. More details on the connections we will use are given in Lab 6. For more information, see http://www.ti.com/ww/en/launchpad/launchpads-connected-launchxl-cc2650.html
  • 58. Valvano, Le Figure 6.22. CC2650 LaunchPad pin connections.