Sistemas Embarcados e Tempo Real
Sistemas Embarcados e Tempo Real
Sistemas Embarcados e Tempo Real
Disclaimer: The contents of this document are scribe notes for The University of
Texas at Austin EE445M Spring 2017, Embedded and real Time Systems.
RTOS
RealTimeOperatingSystem
RTOS Review
RTOS
Real Time Operating System is a software that manages computer system resources
like memory, I/O, data and processors, satisfying all time constraints.
HAL
Hardware Abstraction Layer. A software that simplifies porting application code from
one microcontroller to another.
Bandwidth
It is the number of information that can be transferred or processed (bytes/sec).
Embedded System
It consist of a smart device with a processor that has a special and dedicated
purpose.
For Embedded Systems, Real Time means that the embedded system must
respond to critical events with a strictly defined time (deadline).
There are 5 (five) types of software functions that the processor can perform in an
embedded system:
Transformative: Collect data from inputs, makes decisions and affects its
environment by driving actuators (Ex.: Robots).
Reactive: Collects data from inputs in continuous fashion and produces outputs
in continuos fashion (Ex.: DSP).
- Small Size,
- Low weight,
- Low power,
- Harsh Environments,
- Safety Critical Systems
- Sensitive Cost.
Computer
It combines a CPU, Random Access memory (RAM), Read Only Memory (ROM), and
I/O ports.
Software
It is an ordered sequence of very specific instructions that are stored in memory,
defining exactly what and when certain tasks are to be performed.
Harvard Architecture
It has a separated data and instruction buses.
Interrupt
It is a hardware-triggered software function, which is extremely important for real
time embedded systems.
Ex.01: What address do you use to access bit 3 of the byte 0x2000.1010?
b=3
n = 0x1010
So,
Ex.02: What address do you use to access bit 7 of the byte 0x4000.0030?
b=7
n = 0x0030
So,
The ARM Architecture Procedure Call Standard (AAPCS) part of the ARM Application
Binary Interface (ABI):
- Uses R0, R1, R2, R3, and R12 to pass input parameters into a C function or an
assembly sub-routine.
- The place to return parameter is R0.
- Preserve registers R4-R11, which implies save R4-R11, use them, and restore R4-
r11 before returning.
- Keep the stack aligned to 64 bits, by pushing and popping an even number of
registers (multiple of 8 bytes).
Special Registers:
STACK
A Last In First Out (LIFO) temporary storage.
A bus fault will be generated when the software tries to read/write from an address
that does not exists. If a valid address below or above the stack, then further stack
operation will corrupt the data.
When multiple registers are pushed and popped, the data exists in memory with the
lowest numbered register using the lowest memory address (stacks top). Ex.:
If R1, R4, R5, R6 contains the values 1, 4, 5, 6 respectively, then the value of the
lowest numbered register R1 is placed in the lowest stack address.
If four entries are popped like POP {R0, R2, R7, R9}, the value the lowest stack
address is loaded in the lowest numbered register.
Bit 1 on the Register Control is the Active Stack Pointer Selection (ASPSEL).
ARM Defines
- Foreground (main program) as thread Mode.
- Background (ISR) as handler Mode.
Note: The context is saved whichever stack pointer is active, but during the
execution of ISR, the MSP is used.
RESET
After a reset.
I/O
Pin Specific wire on the microcontroller unit (MCU) that can be used for
specific input/output operations.
Port A collection of pins grouped by common functionalities
Interfa Collection of I/O ports, external electronics, physical devices, and
ce softwares.
I/O Interfaces
I/O interfaces can be classified in 4 (four) categories: