OSES notes 2019-2020
Prof. Massimo Violante
Francesco Malacarne
Sommario
- Introduction .................................................................................................................................................. 5
- Cross compilation flow .............................................................................................................................. 6
- Variables ................................................................................................................................................... 8
- Modifiers ............................................................................................................................................... 9
- Hardware basics .......................................................................................................................................... 13
- Computer architecture and basic knowledge ......................................................................................... 13
- Embedded system architecture .............................................................................................................. 15
- CPU peripheral interface ......................................................................................................................... 18
- SPI bus ................................................................................................................................................. 19
- I2C communication ............................................................................................................................. 20
- Polling and interrupt ........................................................................................................................... 22
- DMA .................................................................................................................................................... 25
- OS overview ................................................................................................................................................ 27
- Operating system architecture ............................................................................................................... 28
- Flat architecture .................................................................................................................................. 28
- Layered architecture with monolithic kernel ...................................................................................... 30
- Microkernel ......................................................................................................................................... 33
- Process management A .............................................................................................................................. 36
- Process in memory .................................................................................................................................. 36
- Process state diagram ............................................................................................................................. 40
- Process control block PCB ....................................................................................................................... 42
- CPU scheduler ......................................................................................................................................... 43
- Basic task ............................................................................................................................................. 46
- Extended task ...................................................................................................................................... 47
- Task in Micrium ................................................................................................................................... 47
- Critical section definition ........................................................................................................................ 49
- Busy waiting ........................................................................................................................................ 52
- Semaphore .......................................................................................................................................... 52
- Scheduling algorithm .............................................................................................................................. 58
- Round Robin scheduling algorithm ..................................................................................................... 58
- Priority-based scheduler ..................................................................................................................... 59
- Real-time and non real-time systems ..................................................................................................... 61
- Device management A ................................................................................................................................ 63
- Introduction ............................................................................................................................................ 63
- Programming .......................................................................................................................................... 67
- Pin multiplexing ...................................................................................................................................... 68
- Digital I/O ................................................................................................................................................ 69
- Digital level-triggered output .............................................................................................................. 69
- Digital level-triggered input, polling and interrupt code .................................................................... 76
- Process management B ............................................................................................................................... 80
- Task definition ......................................................................................................................................... 80
- Scheduling algorithm assumptions and definitions ................................................................................ 82
- Timeline scheduling ................................................................................................................................ 86
- Exam question + solution .................................................................................................................... 88
- Rate monotonic scheduling .................................................................................................................... 91
- Previous exercise solved with the RMS .............................................................................................. 95
- Exercise about RMS (exam) ................................................................................................................ 97
- Earliest Deadline First scheduling ........................................................................................................... 98
- Scheduling algorithm for aperiodic tasks .............................................................................................. 101
- Jackson’s algorithm ........................................................................................................................... 102
- Horn’s algorithm ............................................................................................................................... 103
- Exercises taken from past exams ...................................................................................................... 104
- Scheduling algorithms for periodic and aperiodic tasks ....................................................................... 106
- Background scheduling ..................................................................................................................... 107
- Polling server ..................................................................................................................................... 108
- Exercise about background scheduler and polling server ................................................................ 114
- Deferrable server .............................................................................................................................. 117
- Priority inversion ................................................................................................................................... 120
- NPP .................................................................................................................................................... 124
- IPC ..................................................................................................................................................... 125
- PIP ..................................................................................................................................................... 126
- Factors influencing the determinism of the scheduler ......................................................................... 127
- Focus about the LAB 1 – possible exam exercise ...................................................................................... 131
- Device management part 2 ....................................................................................................................... 136
- PWM ..................................................................................................................................................... 136
- ADC operations ......................................................................................................................................... 146
- Polling with NXP board ......................................................................................................................... 150
- Interrupt with the NXP board ............................................................................................................... 153
- Memory management .............................................................................................................................. 159
- Static partitioning .................................................................................................................................. 161
- Dynamic partitioning ............................................................................................................................. 164
- Exercise ................................................................................................................................................. 168
- Memory management and real time .................................................................................................... 170
- Stack sharing ......................................................................................................................................... 171
- Exercise ................................................................................................................................................. 176
- Mass memory management ................................................................................................................. 176
- Virtual file system ............................................................................................................................. 181
- Memory technology .......................................................................................................................... 182
- File system implementation .............................................................................................................. 183
- FAT .................................................................................................................................................... 189
- Journaling .......................................................................................................................................... 189
- Exam questions about this part ........................................................................................................ 194
- AUTOSAR ................................................................................................................................................... 195
- AUTOSAR classic .................................................................................................................................... 198
- Application layer ............................................................................................................................... 200
- RTE .................................................................................................................................................... 201
- Services layer .................................................................................................................................... 202
- ECU abstraction layer ........................................................................................................................ 206
- Microcontroller abstraction layer ..................................................................................................... 207
- Complex driver .................................................................................................................................. 208
- Example ................................................................................................................................................. 209
- Embedded Linux ........................................................................................................................................ 215
- Components of the embedded Linux system ....................................................................................... 216
- Bootloader ............................................................................................................................................ 218
- First scenario ..................................................................................................................................... 219
- Second scenario ................................................................................................................................ 220
- Kernel .................................................................................................................................................... 223
- Device tree ............................................................................................................................................ 224
- System program .................................................................................................................................... 225
- Application ............................................................................................................................................ 225
- Root file system .................................................................................................................................... 226
- Build system .......................................................................................................................................... 227
- Workflow ........................................................................................................................................... 228
- Build systems .................................................................................................................................... 231
- Yocto ..................................................................................................................................................... 233
- C language review ..................................................................................................................................... 241
- Functions ............................................................................................................................................... 241
- Data types ............................................................................................................................................. 241
- Numbers ................................................................................................................................................ 242
- How to handle global variables ............................................................................................................. 243
Lectures
Introduction
What is an embedded system? An embedded system is a special-purpose computer designed for specific applications. It is very different from a general-purpose computer since it can only run specific tasks and it often obeys to real-time computing constraints. An embedded system interacts with a physical system by means of actuators/sensors.
In this course we will not deal with hardware, we will only program it at the basic software level.
The top part of the chart is the application. The application is the software where we implement the features that our customer is asking for. The application needs to interact with hardware to provide results. In order to do this a basic software is necessary. The basic software is the collection of all the modules that are needed to abstract the operation of the hardware. Hence, the basic software provides services to use and manage hardware. The platform is the combination between the hardware and the basic software.
Cross compilation flow
Which is the compilation flow we will use in our practical experiences? Let’s start by analysing the standard process that happens when programming on a development PC: when coding in C with Codeblocks (for example) we are programming our machine, hence the created file will be executed by the same device where the coding is performed.
What is the process behind such a condition? The source files that compose our program are analysed by a special program called compiler, that will first analyse the syntax of our code and then, if correct, it will translate the source files into object files. Such object files will be provided to another program, the linker, which will take care of gluing together the source files with the libraries to produce the executable file.
In general, such a flow can be extended for multiple files so that the program appears in a cleaner fashion. Moreover, it is possible to divide the source file into a .c file and a .h file. The .c file contains the declaration of variables and the operations to be performed, the .h file contains the datatypes and the libraries. The compiler will create object files based on the source files and then the linker will glue them together to obtain the executable file implemented on the application.
This was the procedure that generally happens on our development PC; when dealing with embedded systems the situation is slightly different: the processor that is coming with our embedded system is simpler than the one on the PC and, in general, w
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
Scarica il documento per vederlo tutto.
-
Embedded Systems - Advanced Operating Systems - Appunti
-
Model based software design lecture notes
-
Appunti di Software Engineering For Embedded Systems
-
Technologies For Information Systems - Complete Notes