Related chapters from the lecture - ETH Z · FreeRTOS Reference Manual v9.0.0. Book: Mastering the...

Post on 10-Mar-2020

18 views 0 download

Transcript of Related chapters from the lecture - ETH Z · FreeRTOS Reference Manual v9.0.0. Book: Mastering the...

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 73abiri@ethz.ch

Matthias MeyerETZ G81+41 44 632 04 54matthmey@ethz.ch

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