Tutorial Sistema Operativo en Tiempo Real RTOS

19
Tutorial Sistema Operativo en Tiempo Real RTOS MSc . Ing. Carlos Centeno Grupo de Investigación y Transferencia en Electrónica Avanzada UTN FRC

Transcript of Tutorial Sistema Operativo en Tiempo Real RTOS

Page 1: Tutorial Sistema Operativo en Tiempo Real RTOS

Tutorial

Sistema Operativo en

Tiempo Real

RTOS

MSc. Ing. Carlos Centeno

Grupo de Investigación y Transferencia

en Electrónica Avanzada

UTN FRC

Page 2: Tutorial Sistema Operativo en Tiempo Real RTOS

TEMARIO

Sistema Embebido Super Loop Generalidades

Ejemplo

Conversión a RTOS

Conceptos Generales de RTOS KERNEL

SCHEDULER

TAREAS

PRIORIDADES

SINCRONIZACION

Page 3: Tutorial Sistema Operativo en Tiempo Real RTOS

GENERALIDADES

Cada “tarea” es una función en C.

Se llaman por turno desde el bloque principal. NO existen prioridades.

Se ejecutan rápidamente y regresan al bloque principal.

Pueden usar una variable de estado.

Se usan esperas pasivas – delay. NO hay timers.

Page 4: Tutorial Sistema Operativo en Tiempo Real RTOS

MICRO

TECLADO

MUX Input

FILTROS

LCD

USART

ADCPGAOFFSET

USB

I/O

RS232

SPI

Sistema de Adquisición de Señales

SISTEMA EMBEBIDO

Page 5: Tutorial Sistema Operativo en Tiempo Real RTOS

SOLUCION Super LOOP

Implementación del Software de control basado en topología súper loop

LEER Teclado

Filtrado Digital

Escribir Pixel

Borrar Pantalla

T == 1

Timer ISR

LEER ADC

RS232

Frec Muestreo: 500Hz

Resolución LCD: 240 pixel

Resolución Impresión: 5 muestras por pixel

Tiempo de ciclo: 10mS

c=c+1Si c>=5

T=0

Page 6: Tutorial Sistema Operativo en Tiempo Real RTOS

CONVERSION a RTOS

Se requiere RAM y ROM adicional para la uso de un RTOS.

Requiere definir cada PROCESO.

Se deben definir las prioridades.

Se deben definir las interacciones entre procesos. Sincronización con EVENTOS.

Page 7: Tutorial Sistema Operativo en Tiempo Real RTOS

Super Loop RTOS

LEER Teclado

Filtrado Digital

Escribir Pixel

Borrar Pantalla

T==1

Timer Interrupt Service

LEER ADC

RS232

Timer Interrupt Service

LEER ADC

RS232

Ejecutivo CICLICO

Page 8: Tutorial Sistema Operativo en Tiempo Real RTOS

Tarea ADC

Prioridad = 1

Tarea Comunicación

Prioridad = 2

Tarea LCD

Prioridad = 3

Super Loop RTOS

Tarea Teclado

Prioridad = 4

TareaIDLE

Prioridad = 63

EVENTOS

Multitarea RTOS

Page 9: Tutorial Sistema Operativo en Tiempo Real RTOS

RTOS

Conceptos Generales KERNEL

SCHEDULER

TIPOPREEMPTIVE

NON PREEMTIVE

TAREASESTADOS DE OPERACIÓN

TCB RAM

STACK RAM

Page 10: Tutorial Sistema Operativo en Tiempo Real RTOS

RTOS

Conceptos Generales TAREASPRIORIDADES

REENTRANCIA

SINCRONIZACIONECB

TIPOS DE EVENTOS SEMAFOROS

MUTEX

MAILBOX

QUEUES

Page 11: Tutorial Sistema Operativo en Tiempo Real RTOS

Tipos RTOS

Page 12: Tutorial Sistema Operativo en Tiempo Real RTOS

Reentrancia

Page 13: Tutorial Sistema Operativo en Tiempo Real RTOS

Estados del Sistema

Page 14: Tutorial Sistema Operativo en Tiempo Real RTOS

Eventos

Semáforos

Mailbox

Queues

Page 15: Tutorial Sistema Operativo en Tiempo Real RTOS

EVENTOS

Tarea Teclado

Prioridad = 4

Tarea ADC

Prioridad = 1

Tarea LCD

Prioridad = 3

Tarea Comunicación

Prioridad = 2

TareaIDLE

Prioridad = 63

RTOS - Esquema

Page 16: Tutorial Sistema Operativo en Tiempo Real RTOS

Tarea Teclado

Prioridad = 4

Tarea ADC

Prioridad = 1

Tarea LCD

Prioridad = 3

Tarea Comunicación

Prioridad = 2

TareaIDLE

Prioridad = 63

Semaforo

MailBox

MailBox

Semaforo

RTOS - Esquema

Page 17: Tutorial Sistema Operativo en Tiempo Real RTOS

void KEY(){

while(1){……}

}

void ADC(){

while(1){……}

}

void LCD(){

while(1){……}

}

void comm(){

while(1){……}

}

void IDLE(){

while(1){……}

}

Semaforo

MailBox

MailBox

Semaforo

RTOS - Código

Page 18: Tutorial Sistema Operativo en Tiempo Real RTOS

RTOS DISPONIBLES

uCOS III

https://www.micrium.com/rtos/kernels/

freeRTOS

https://www.freertos.org/

AVIX RT

http://www.avix-rt.com/

THREADX RTOS

https://rtos.com/

EJEMPLO LOOP EJEMPLO RTOS

Page 19: Tutorial Sistema Operativo en Tiempo Real RTOS

PREGUNTAS?

GRACIAS POR LA ATENCION!!!!!

MSc. Ing. Carlos Centeno

[email protected]

G.In.T.E.A. – FRC UTN

http://www.investigacion.frc.utn.edu.ar/gintea/