1
Embedded Systems Lab 3 - HS 2019 28.10.2019 Andreas Biri, Matthias Meyer Andreas Biri, Matthias Meyer 28.10.2019 1 Goals Introduce a real-time operating system (RTOS) Learn what tasks are and how to create them Get to know task states and priorities Implement inter-task communication using queues Learn how to handle critical sections Andreas Biri, Matthias Meyer 28.10.2019 2 Tasks Running Ready Blocked Suspended Not Running vTaskSuspend() Blocking API function call Event vTaskResume() vTaskSuspend() vTaskSuspend() OS allows splitting up the application into independent tasks Tasks can be individually put into new states depending on their behaviour Priority signals scheduler which task to prefer Andreas Biri, Matthias Meyer 28.10.2019 3 Critical sections Pre-emption: Tasks can be interrupted by other events Time slicing: Scheduler shares processing time between tasks However, this might stop time-critical interactions (e.g. with peripherals, such as when reading from a sensor) Mutex: Guarantees exclusive access to a shared resource Andreas Biri, Matthias Meyer 28.10.2019 4 Related chapters from the lecture Ch. 5: Embedded Operating Systems Ch. 5: FreeRTOS Task Management Task 1 Task functions Creation of tasks Task handles and deletion at runtime Ch. 7: Resource Sharing Task 2 Example of shared resource conflict Mutual exclusion Andreas Biri, Matthias Meyer 28.10.2019 5 Related chapters from the lecture Ch. 5: FreeRTOS Timers and FreeRTOS Task States Task 2 Delay Blocked, Ready, Running States Events Ch. 7: Communication and Synchronization Task 3 Communication between tasks Queues Andreas Biri, Matthias Meyer 28.10.2019 6 FreeRTOS The lab is self-contained but cannot cover everything about FreeRTOS Supplementary material can help to understand the content and go beyond https://www.freertos.org/ FreeRTOS Reference Manual v9.0.0. Book: Mastering the FreeRTOS Real Time Kernel Andreas Biri, Matthias Meyer 28.10.2019 7 Questions? Andreas Biri ETZ G75 +41 44 632 08 73 [email protected] Matthias Meyer ETZ G81 +41 44 632 04 54 [email protected] Andreas Biri, Matthias Meyer 28.10.2019 8 Lab 3 Institut für Technische Informatik und Kommunikationsnetze Computer Engineering and Networks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 Page 1 of 1

Related chapters from the lecture - ETH Z · FreeRTOS Reference Manual v9.0.0. Book: Mastering the FreeRTOS Real Time Kernel Andreas Biri, Matthias Meyer 28.10.2019 7 Questions? Andreas

  • Upload
    others

  • View
    18

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Related chapters from the lecture - ETH Z · FreeRTOS Reference Manual v9.0.0. Book: Mastering the FreeRTOS Real Time Kernel Andreas Biri, Matthias Meyer 28.10.2019 7 Questions? Andreas

Embedded Systems Lab 3 - HS 201928.10.2019Andreas Biri, Matthias Meyer

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 1

Goals

Introduce a real-time operating system (RTOS)

Learn what tasks are and how to create them

Get to know task states and priorities

Implement inter-task communication using queues

Learn how to handle critical sections

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 2

Tasks

Running

Ready BlockedSuspended

Not Running

vTaskSuspend() Blocking API function call

Event

vTaskResume()

vTaskSuspend()

vTaskSuspend()

OS allows splitting up theapplication into independent tasks

Tasks can be individually put intonew states depending on theirbehaviour

Priority signals scheduler whichtask to prefer

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 3

Critical sections

Pre-emption: Tasks can be interrupted by other events

Time slicing: Scheduler shares processing time between tasks

However, this might stop time-critical interactions (e.g. withperipherals, such as when reading from a sensor)

Mutex: Guarantees exclusive access to a shared resource

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 4

Related chapters from the lecture

Ch. 5: Embedded Operating Systems

Ch. 5: FreeRTOS Task Management → Task 1Task functionsCreation of tasksTask handles and deletion at runtime

Ch. 7: Resource Sharing → Task 2Example of shared resource conflictMutual exclusion

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 5

Related chapters from the lecture

Ch. 5: FreeRTOS Timers and FreeRTOS Task States → Task 2DelayBlocked, Ready, Running StatesEvents

Ch. 7: Communication and Synchronization → Task 3Communication between tasksQueues

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 6

FreeRTOS

The lab is self-contained but cannot cover everything aboutFreeRTOS

Supplementary material can help to understand the content andgo beyond

https://www.freertos.org/FreeRTOS Reference Manual v9.0.0.Book: Mastering the FreeRTOS Real Time Kernel

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 7

Questions?

Andreas BiriETZ G75+41 44 632 08 [email protected]

Matthias MeyerETZ G81+41 44 632 04 [email protected]

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory Andreas Biri, Matthias Meyer 28.10.2019 8

Lab 3

Institut für Technische Informatikund KommunikationsnetzeComputer Engineering andNetworks Laboratory

Andreas Biri, Matthias Meyer 28.10.2019 Page 1 of 1