0% found this document useful (0 votes)
26 views100 pages

Understanding Embedded Software Systems

The document provides an overview of embedded software and systems, detailing their definitions, features, and the relationship between software and hardware. It discusses trends in embedded projects, including programming languages used and the importance of operating systems in managing hardware access and application isolation. Additionally, it covers the boot process for embedded systems and the role of various software components in this context.

Uploaded by

quereemilien
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views100 pages

Understanding Embedded Software Systems

The document provides an overview of embedded software and systems, detailing their definitions, features, and the relationship between software and hardware. It discusses trends in embedded projects, including programming languages used and the importance of operating systems in managing hardware access and application isolation. Additionally, it covers the boot process for embedded systems and the role of various software components in this context.

Uploaded by

quereemilien
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Embedded Software

IMT-Atlantique Embedded Software 1 / 62


1 From software to hardware
Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 2 / 62


Plan

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 2 / 62


Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 3 / 62


Embedded Systems ?

Definition
Combination of computer hardware and software
Designed to perform a dedicated function

Examples
Everyday objects: watch, washing machines,
Critical systems: planes, space systems, cars.

Excluding general-purpose computers


Personal Computers
Servers

... what about mobile phones ?

IMT-Atlantique Embedded Software 4 / 62


Embedded Software ?

Definition
Software used in embedded systems

Features
Low level programming, close to hardware
Constraints
low energy consumption
low computational power
real time constraints
reliability
... any constraints that apply to your dedicated function

IMT-Atlantique Embedded Software 5 / 62


Embedded Software ?

Definition
Software used in embedded systems

Features
Low level programming, close to hardware
Constraints
low energy consumption
low computational power
real time constraints
reliability
... any constraints that apply to your dedicated function

IMT-Atlantique Embedded Software 5 / 62


Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 6 / 62


Trends: From Scratch vs Upgrade ?
20

My current embedded project is…

2019 (N = 944) 2017 (N = 1,223) 2015 (N = 1,807)


56% 56% 56%

44% 44% 44%

New to the world; a new project from An upgrade or improvement to an


scratch earlier or existing project

In 2019, APAC ratio of “New to the World” vs “Upgrade” was 40%/60%.

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 7 / 62
Trends: What is developed ?
21

What does the upgrade or improvement include?

46%
New or different software features 50%
51%
37%
New or different processor 38%
39%
22%
New or different connectivity capabilities 24%
17%
19%
Mandatory changes/discontinued hdwr/sftwr 17%
17%
16%
New or different analog components 11%
10%
11%
New or different system logic 11%
15%
13%
New or different peripherals 14% 2019 (N = 521)
16%
2017 (N = 596)
10%
New or different operating system 10% 2015 (N = 851)
12%

Base = Those whose current project is an upgrade/improvement

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 8 / 62
Trends: Features ?
22

Which of the following capabilities are included


in your current embedded project?

Real-time capability 54%


59%
Digital signal processing 51%
56%
Networking capability 49%
54%
Analog signal processing 46%
50%
Wireless capability 42%
40%
Battery-powered 34%
34%
Rugged design 31%
34%
GUI 26%
36% 2019 (N = 943)

AI (machine learning)* 15% 2017 (N = 1,107)

GPU* 9%

*AI and GPU were added in 2019.

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 9 / 62
Trends: What language ?
32

My current embedded project is programmed


mostly in:
56%
C
56%
23%
C++
22%
6%
Python
3%
4%
Assembly language
4%
2%
Java
2%
1%
MATLAB
2%
2%
LabVIEW
2% 2019 (N = 689)
1% 2017 (N = 880)
JavaScript
1%
1%
C#
2%

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 10 / 62
Trends: What language ?
33

My next embedded project will likely be


programmed mostly in:
49%
C
52%
26%
C++
24%
8%
Python
5%
3%
C#
3%
3%
Assembly language
2%
2%
MATLAB
2%
2% 2019 (N = 685)
LabVIEW
2%
2017 (N = 879)
2%
Java
2%
1%
UML or other modeling language
1%

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 11 / 62
Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 12 / 62


Compiler

builder: make
compiler: gcc
linker: ld, gcc
debugger: gdb

[Link]
IMT-Atlantique Embedded Software 13 / 62
C vers assembleur

Assembly code generated by the compiler

IMT-Atlantique Embedded Software 14 / 62


C vers assembleur

Assembly code generated by the compiler

Included as binary code into a file

IMT-Atlantique Embedded Software 14 / 62


Taxonomy of executable file formats

Unix systems
[Link]: ancester
coff: for shared libraries
elf: most known
FatELF: multi-ELF support
Windows / NT
PE, PE32+: current
MZ: DOS
iOS OSX
Mach-0: still used

IMT-Atlantique Embedded Software 15 / 62


ELF

IMT-Atlantique Embedded Software 16 / 62


libelf

The format must be "understood"


read and use headers
copy data and code in the corresponding memories

ELF is not a primary format

Role of the "libelf" library

IMT-Atlantique Embedded Software 17 / 62


Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 18 / 62


When does software meet hardware ?

On power-up
Hardware initialisation of the processor and peripherals
Execution of the code stored in ROM (BootROM on ZedBoard)

What’s in Zynq’s BootROM


Basic drivers for boot options (QSPI Flash, SD card, NAND, NOR)
Copy primary bootloader to CPU instruction memory
Jump to the first instruction of the user code or First Stage Boot
Loader

Desktop / Laptop: BIOS


Read MBR (Master Boot Record) Bootstrap Code
Jump to the first instruction of the second-stage bootloader
[Link]
IMT-Atlantique Embedded Software 19 / 62
Booting: Laptop / Desktop

IMT-Atlantique Embedded Software 20 / 62


Booting: Laptop / Desktop

Stage 0: BIOS / UEFI


Initialize Hardware
Launch bootstrap
Load Second Stage Bootloader

Stage 1: Bootloader
Most used: GRUB2(Linux), BOOTMGR(Windows), iBoot(iOS)
Load filesystem drivers, OS configuration file, needed modules
Load the kernel and start the OS

Stage 2: Kernel / OS
Init software is launched

IMT-Atlantique Embedded Software 21 / 62


Booting: Zynq
Stage 0: BootROM

Stage 1: FSBL
Set peripheral clock frequencies, initialize MIOs
Program fpga with bitstream
Load 2nd stage bootloader(OS) or user code (no OS)

Stage 2: U-Boot
Second stage boot loader
Initialize and test hardware (DDR, Serial, ...)
Load Kernel into RAM

Stage 3: Linux Kernel / Busybox Software


Init software is launched
IMT-Atlantique Embedded Software 22 / 62
Accessing hardware
To access hardware, libraries are provided
Hardware Abstraction Layer
Board Support Package
In the case of custom, dedicated or boards, these are provided by
the manufacturer
In the case of laptop / desktop, it’s included in the kernel

IMT-Atlantique Embedded Software 23 / 62


Accessing hardware
To access hardware, libraries are provided
Hardware Abstraction Layer
Board Support Package
In the case of custom, dedicated or boards, these are provided by
the manufacturer
In the case of laptop / desktop, it’s included in the kernel

IMT-Atlantique Embedded Software 24 / 62


Plan

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 24 / 62


Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 25 / 62


What’s an operating system ?

A software that:
accesses the hardware
abstracts the hardware for read / write send / recv

OS
file socket

higher level applications


memory eth
cpu scheduling usb
management controller
manages hardware between
multiple applications
isolate and protect
applications from one another

Illustrations from [Link]


IMT-Atlantique Embedded Software 26 / 62
What’s an operating system ?

A software that:
accesses the hardware
abstracts the hardware for read / write send / recv

OS
file socket

higher level applications


memory eth
cpu scheduling usb
management controller
manages hardware between
multiple applications
isolate and protect
applications from one another

Illustrations from [Link]


IMT-Atlantique Embedded Software 26 / 62
What’s an operating system ?

A software that:
accesses the hardware
abstracts the hardware for read / write send / recv

OS
file socket

higher level applications


memory eth
cpu scheduling usb
management controller
manages hardware between
multiple applications
isolate and protect
applications from one another

Illustrations from [Link]


IMT-Atlantique Embedded Software 26 / 62
What’s an operating system ?

A software that:
accesses the hardware
abstracts the hardware for read / write send / recv

OS
file socket

higher level applications


memory eth
cpu scheduling usb
management controller
manages hardware between
multiple applications
isolate and protect
applications from one another

Illustrations from [Link]


IMT-Atlantique Embedded Software 26 / 62
Why using an operating system ?

simplifies access to the


hardware
usage
management read / write send / recv

OS
file socket
provides homogeneous and
generic interface cpu scheduling
memory
management usb
eth
controller

portability
corresponds to software
engineer skills
benefits from up to date
technology

Illustrations from [Link]


IMT-Atlantique Embedded Software 27 / 62
Why using an operating system ?

simplifies access to the


hardware
usage
management read / write send / recv

OS
file socket
provides homogeneous and
generic interface cpu scheduling
memory
management usb
eth
controller

portability
corresponds to software
engineer skills
benefits from up to date
technology

Illustrations from [Link]


IMT-Atlantique Embedded Software 27 / 62
Why using an operating system ?

simplifies access to the


hardware
usage
management read / write send / recv

OS
file socket
provides homogeneous and
generic interface cpu scheduling
memory
management usb
eth
controller

portability
corresponds to software
engineer skills
benefits from up to date
technology

Illustrations from [Link]


IMT-Atlantique Embedded Software 27 / 62
Why using an operating system ?

simplifies access to the


hardware
usage
management read / write send / recv

OS
file socket
provides homogeneous and
generic interface cpu scheduling
memory
management usb
eth
controller

portability
corresponds to software
engineer skills
benefits from up to date
technology

Illustrations from [Link]


IMT-Atlantique Embedded Software 27 / 62
Trends: OS
49

Does your current embedded project use an


operating system, RTOS, kernel, software
executive, or scheduler of any kind?

81% of those not using


OS/RTOSes, said the main
80
72% reason for NOT using is simply
69% 68%
70 65% 67% that they are not needed.

60

50

40 35%
33% 31% 32%
30 28%

20

10

0
Yes No

2019 (N = 613) 2017 (N = 818) 2015 (N = 1,125) 2014 (N = 1,493) 2013 (N = 2,082)

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 28 / 62
Trends: OS
56

What are the most important factors in choosing


an operating system?
Availability of full source code 35%
39%
Availability of tech support 31%
27%
Compatibility w/ other software, systems, tools 29%
27%
No royalties 29%
30%
Real-time performance 26%
24%
Freedom to customize or modify 26%
25%
Open-source availability 24%
25%
My familiarity with the operating system 20%
25%
Simplicity / ease of use 15%
15%
Popularity/large developer community 12%
15%
Purchase price 12%
14%
Small memory footprint 12%
12%
Software development tools available 11%
11%
The processors it supports 10%
13%
Successful prior use for similar apps 8%
8%
Other software, middleware, drivers, code available 8%
9% 2019 (N = 560)
Security 6%
6% 2017 (N = 767)
Base: Currently using an operating system

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 29 / 62
Trends: OS
57

Please select ALL of the operating systems


you are currently using.
Embedded Linux 21%
In-house/custom 19%
FreeRTOS 18%
Ubuntu 14%
Android 13%
Debian (Linux) 13%
Microsoft (Windows 10) 10%
Microsoft (Windows Embedded 7/Standard) 6%
Texas Instruments RTOS 6%
Wind River (VxWorks) 5%
Green Hills (INTEGRITY) 5%
Texas Instruments (DSP/BIOS) 5% Regional Breakout
Micrium (uC/OS-II) 4% EMEA uses Embedded Linux much more than other regions.
AnalogDevices (VDK) 4% APAC uses Android much more than other regions and uses
Keil (RTX) 4% Embedded Linux much less that others.
Red Hat (IX Lunix) 3%
Microsoft (Windows 7 Compact or earlier) 3% Most Used World Americas EMEA APAC
Express Logic (ThreadX) 3%
Micrium (uC/OS-III) 3% Embedded
QNX (QNX) 3% Linux
21% 21% 30% 15%
Android Go (Google) 2% Android
Freescale MQX 2% (Google)
13% 9% 14% 27%
Wittenstein High Integrity Systems… 2%
CMX 2% 2019 (N = 468)
Segger (embOS) 2% Only Operating Systems with
LynuxWorks (LynxOS) 2% 2% or more are shown.
Wind River (Linux) 2%
OSEK 2%
Base: Currently using an operating system
ECos 2%

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 30 / 62
Trends: OS
58

Please select ALL of the operating systems you are


considering using in the next 12 months.
Embedded Linux 31%
FreeRTOS 27%
In-house/custom 16%
Debian (Linux) 15%
Ubuntu 14%
Android 14%
Microsoft (Windows 10) 12%
Texas Instruments RTOS 9%
Keil (RTX) 6%
Other 6%
Micrium (uC/OS-III) 5% Regional Breakout
Red Hat (IX Lunix) 5% APAC users will use FreeRTOS and Android much more
Texas Instruments (DSP/BIOS) 5% than other regions and use Embedded Linux much less.
Wind River (VxWorks) 5% EMEA will use Android less than other regions.
Green Hills (INTEGRITY) 5%
Most Used World Americas EMEA APAC
QNX (QNX) 5%
Express Logic (ThreadX) 4% Embedded
Linux
31% 32% 31% 26%
Angstrom (Linux) 4%
Wittenstein HIS(OpenRTOS/SAFERTOS 4% FreeRTOS 27% 25% 24% 37%
Micrium (uC/OS-II) 4%
Freescale MQX 3% Android 14% 12% 10% 26%
AnalogDevices (VDK) 3% 2019 (N = 424)
Segger (embOS) 3% Only Operating Systems with
Wind River (Linux) 3% 3% more are shown
Microsoft (Windows 7 Compact or earlier) 3%

Base: Those who are considering an operating system in any project in the next 12 months

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 31 / 62
Trends: OS
59

Are you currently using embedded


virtualization/hypervisors or will you likely use
them in the next 12 months?
2019 (N = 577) 2017 (N = 768) 2015 (N = 1059) 2014 (N = 1394)
83% 85% 84%
80%

20%
17% 15% 16%
10% 9%
4% 5% 6% 4% 5% 4% 5% 4% 7% 7%

Top reasons for using virtualization/hypervisors %


Separation of multiple applications 45
Need to support multiple guest operating systems (e.g., Android, VxWorks, Linux) 40
Need to support hard real-time application(s) and guest operating system 32
Processor consolidation 26
Need to support legacy and new applications on the same system 26

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 32 / 62
Kernel vs OS

An operating system consists of


a kernel: responsible for abstraction and access to the hardware
some application software
Example: Ubuntu
Linux Kernel ([Link]
Ubuntu applications: graphical interface, package manager, etc...
Example: Laboratory
Linux Kernel ([Link]
High level software provided by busybox

IMT-Atlantique Embedded Software 33 / 62


Kernel vs OS

An operating system consists of


a kernel: responsible for abstraction and access to the hardware
some application software
Example: Ubuntu
Linux Kernel ([Link]
Ubuntu applications: graphical interface, package manager, etc...
Example: Laboratory
Linux Kernel ([Link]
High level software provided by busybox

IMT-Atlantique Embedded Software 33 / 62


Kernel vs OS

An operating system consists of


a kernel: responsible for abstraction and access to the hardware
some application software
Example: Ubuntu
Linux Kernel ([Link]
Ubuntu applications: graphical interface, package manager, etc...
Example: Laboratory
Linux Kernel ([Link]
High level software provided by busybox

IMT-Atlantique Embedded Software 33 / 62


User-Kernel

user-level Access to the kernel via


system calls
open (file)
Kernel send (socket)
kernel-level
mmap (memory)
privilege bit ...

IMT-Atlantique Embedded Software 34 / 62


User-Kernel

user-level Access to the kernel via


system calls
open (file)
Kernel send (socket)
kernel-level
mmap (memory)
privilege bit ...

IMT-Atlantique Embedded Software 34 / 62


System calls

The interfaces between the applications and the kernel are the
system calls
Documented in the manual on most linux-based OSs in the
second section
Extract: man man
1 Executable programs or shell commands
2 System calls ( functions provided by the kernel )
3 Library calls ( functions within program libraries )
4 Special files ( usually found in / dev )
5 File formats and conventions eg / etc / passwd
6 Games
7 Miscellaneous ( including macro packages and conventions ) , e . g .
man (7) , groff (7)
8 System administration commands ( usually only for root )
9 Kernel routines [ Non standard ]

IMT-Atlantique Embedded Software 35 / 62


System calls

The interfaces between the applications and the kernel are the
system calls
Documented in the manual on most linux-based OSs in the
second section
Extract: man man
1 Executable programs or shell commands
2 System calls ( functions provided by the kernel )
3 Library calls ( functions within program libraries )
4 Special files ( usually found in / dev )
5 File formats and conventions eg / etc / passwd
6 Games
7 Miscellaneous ( including macro packages and conventions ) , e . g .
man (7) , groff (7)
8 System administration commands ( usually only for root )
9 Kernel routines [ Non standard ]

IMT-Atlantique Embedded Software 35 / 62


System calls

The interfaces between the applications and the kernel are the
system calls
Documented in the manual on most linux-based OSs in the
second section
Extract: man man
1 Executable programs or shell commands
2 System calls ( functions provided by the kernel )
3 Library calls ( functions within program libraries )
4 Special files ( usually found in / dev )
5 File formats and conventions eg / etc / passwd
6 Games
7 Miscellaneous ( including macro packages and conventions ) , e . g .
man (7) , groff (7)
8 System administration commands ( usually only for root )
9 Kernel routines [ Non standard ]

IMT-Atlantique Embedded Software 35 / 62


System calls

Example: man 2 open


OPEN (2) Linux Programmer ’ s Manual
OPEN (2)

NAME
open , openat , creat - open and possibly create a file

SYNOPSIS
# include < sys / types .h >
# include < sys / stat .h >
# include < fcntl .h >

int open ( const char * pathname , int flags ) ;


int open ( const char * pathname , int flags , mode_t mode ) ;

int creat ( const char * pathname , mode_t mode ) ;

int openat ( int dirfd , const char * pathname , int flags ) ;


int openat ( int dirfd , const char * pathname , int flags ,
mode_t mode ) ;

DESCRIPTION
Given a pathname for a file , open () returns a file
descriptor , a small ,
nonnegative integer for use in ...

IMT-Atlantique Embedded Software 36 / 62


System calls

user-level When a system calls occurs,


privilege user system system call
bit = 0 code call return the user application
privilege privilege writes syscall args
bit = 0 bit = 1
kernel-level saves relevant data
system call
privilege execution
bit = 1 makes system call

IMT-Atlantique Embedded Software 37 / 62


System calls

user-level When a system calls occurs,


privilege user system system call
bit = 0 code call return the user application
privilege privilege writes syscall args
bit = 0 bit = 1
kernel-level saves relevant data
system call
privilege execution
bit = 1 makes system call

IMT-Atlantique Embedded Software 37 / 62


System calls

user-level When a system calls occurs,


privilege user system system call
bit = 0 code call return the user application
privilege privilege writes syscall args
bit = 0 bit = 1
kernel-level saves relevant data
system call
privilege execution
bit = 1 makes system call

IMT-Atlantique Embedded Software 37 / 62


Monolithic OS

An OS in which anything needed by the software is included in the OS,


and any hardware is handled by the OS.

+ everything included
+ inlining, compile-time optim
- customization, portability,
OS manageability
- memory footprint
- performance

IMT-Atlantique Embedded Software 38 / 62


Monolithic OS

An OS in which anything needed by the software is included in the OS,


and any hardware is handled by the OS.

+ everything included
+ inlining, compile-time optim
- customization, portability,
OS manageability
- memory footprint
- performance

IMT-Atlantique Embedded Software 38 / 62


Monolithic OS

An OS in which anything needed by the software is included in the OS,


and any hardware is handled by the OS.

+ everything included
+ inlining, compile-time optim
- customization, portability,
OS manageability
- memory footprint
- performance

IMT-Atlantique Embedded Software 38 / 62


Modular OS

Consists of basic services and APIs, and mostly modules that


implement everything (file system, scheduling, etc...). Modules are
loaded only if needed.

+ maintainability
+ smaller footprint
module
OS module
+ less resource needed
module - indirection can impact
(interface)
module performance
- maintenance can still be an
issue

IMT-Atlantique Embedded Software 39 / 62


Modular OS

Consists of basic services and APIs, and mostly modules that


implement everything (file system, scheduling, etc...). Modules are
loaded only if needed.

+ maintainability
+ smaller footprint
module
OS module
+ less resource needed
module - indirection can impact
(interface)
module performance
- maintenance can still be an
issue

IMT-Atlantique Embedded Software 39 / 62


Modular OS

Consists of basic services and APIs, and mostly modules that


implement everything (file system, scheduling, etc...). Modules are
loaded only if needed.

+ maintainability
+ smaller footprint
module
OS module
+ less resource needed
module - indirection can impact
(interface)
module performance
- maintenance can still be an
issue

IMT-Atlantique Embedded Software 39 / 62


Modular OS

Consists of basic services and APIs, and mostly modules that


implement everything (file system, scheduling, etc...). Modules are
loaded only if needed.

module In the laboratory, you will


OS module create modules for the linux
module
(interface) kernel to handle custom
module hardware

IMT-Atlantique Embedded Software 39 / 62


Microkernel OS

Provides minimum software: address space management, threads,


inter process communication. Everything else is done in user space.

unix server drivers file system + size


+ verifiability
OS address + portability
IPC space
threads
- complexity of software
development
- cost of user / kernel switching

IMT-Atlantique Embedded Software 40 / 62


Microkernel OS

Provides minimum software: address space management, threads,


inter process communication. Everything else is done in user space.

unix server drivers file system + size


+ verifiability
OS address + portability
IPC space
threads
- complexity of software
development
- cost of user / kernel switching

IMT-Atlantique Embedded Software 40 / 62


Microkernel OS

Provides minimum software: address space management, threads,


inter process communication. Everything else is done in user space.

unix server drivers file system + size


+ verifiability
OS address + portability
IPC space
threads
- complexity of software
development
- cost of user / kernel switching

IMT-Atlantique Embedded Software 40 / 62


Process

A process is the code, data and status of a program that is running on a


computer

Process State (ready, running,


waiting,...)
Program Counter
CPU registers
Scheduling information
Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process is the code, data and status of a program that is running on a


computer

Process State (ready, running,


waiting,...)
Program Counter
CPU registers
Scheduling information
Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process is the code, data and status of a program that is running on a


computer

Process State (ready, running,


waiting,...)
Program Counter
CPU registers
Scheduling information
Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process is the code, data and status of a program that is running on a


computer

Process State (ready, running,


waiting,...)
Program Counter
CPU registers
Scheduling information
Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process is the code, data and status of a program that is running on a


computer

Process State (ready, running,


waiting,...)
Program Counter
CPU registers
Scheduling information
Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process is the code, data and status of a program that is running on a


computer

PCB
Process State (ready, running,
waiting,...)

s
ta
de

file
da
co
Program Counter
CPU registers reg
Scheduling information stack

Memory management
(Address space)

IMT-Atlantique Embedded Software 41 / 62


Process

A process can consist of multiple threads.

s
ta

ta
de

de
file

file
da

da
co

co
reg reg reg reg
stack stack stack stack

IMT-Atlantique Embedded Software 42 / 62


Scheduling

CPU scheduling: managing processes and threads.


A CPU can only execute one thread at a time.
Threads must be run one after the other.
Run-to-Completion Scheduling
Preemptive Scheduling (SJF + priority)

IMT-Atlantique Embedded Software 43 / 62


POSIX

Portable Operating System Interface


Standardize an interface for operating system
C / Sh API
More than 30 standards, including real time

IMT-Atlantique Embedded Software 44 / 62


POSIX

Header Usage example functions


string.h Strings memcpy, memset, strlen, strcpy
math.h Mathematics cos, sin, exp, log, fma
time.h Time clock_gettime, nanosleep, timer_create, timer_gettime
unistd.h Constants & Types sleep, getgid, getuid, fchown, fchdir
sched.h Scheduling sched_setparam, sched_setscheduler, sched_yield,
sched_rr_get_interval
signal.h Inter Process Com- kill, sigqueue, raise, sigwait
munication
pthread.h Threads pthread_create, pthread_join, pthread_mutex_create,
pthread_mutex_lock, pthread_mutex_unlock

Table: Some examples of POSIX header files

[Link]
IMT-Atlantique Embedded Software 45 / 62
Open Source

Free redistribution
Source code availability
Derived works allowance
Integrity of Author’s source code (not mandatory)
No discrimination against persons or groups
No discrimination agains fields of endeavor
Distribution of License
License must not be specific to a product
License must not restrict other software
License must be technology-neutral

[Link]
IMT-Atlantique Embedded Software 46 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Open Source

+ Mostly free
- Reduced competitive
+ Free Support
advantage
+ Open standards
- Minimal support leverage
+ Tends to faster fixes
- Usability
+ Security
- Increase business risk
+ Avoids vendor lock-in

Open-Source vs. Proprietary Software Pros and Cons, optimus information


IMT-Atlantique Embedded Software 47 / 62
Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 48 / 62


Embedded operating system

Why using an operating system in embedded systems ?

Same reasons as for regular systems:


Abstraction
Resource management
Reduced time-to-market (code reuse, environment, tools...)

IMT-Atlantique Embedded Software 49 / 62


Real time

Nevertheless, a new constraint may appear in embedded systems:


Real Time

Soft:
Usefulness of a result degrades after deadline
Example: graphical interface, mouse input
Hard:
Failure if result is produced after dead linewidth
Example: Airbag, Inkjet printer
result usefulness result usefulness
100 % 100 %

0% time 0% time
deadline deadline
IMT-Atlantique Embedded Software 50 / 62
Real time

Nevertheless, a new constraint may appear in embedded systems:


Real Time

Soft:
Usefulness of a result degrades after deadline
Example: graphical interface, mouse input
Hard:
Failure if result is produced after dead linewidth
Example: Airbag, Inkjet printer
result usefulness result usefulness
100 % 100 %

0% time 0% time
deadline deadline
IMT-Atlantique Embedded Software 51 / 62
Real Time Embedded systems

Logical determinism: same inputs shall produce same outputs


Temporal determinism: the system shall meet temporal
constraints
Reliability: the system shall meet availibility constraints
→ Need for a predictible system, that is known a priori to meet the
constraints
→ A Real Time System is not necessarily fast, but must meet given
time constraints

Source: tr [Link]
IMT-Atlantique Embedded Software 52 / 62
Latencies

Latencies is the time between the time when a task should start and
when it really starts. Caused by:

Physical properties of the hardware (CPU, memory,...)


OS scheduling and policies
Kernel preemptiveness
System load
Context switches

IMT-Atlantique Embedded Software 53 / 62


Real Time Scheduling

For real time, kernel must be premptive


In Linux, some real time features are available
Real-Time Linux: Linux version in which nearly all of the kernel can
be preempted
FIFO scheduling
Earliest Deadline First (EDF) scheduling
Real Time OSs
Xenomaï
RTAI
RTLinux
...

IMT-Atlantique Embedded Software 54 / 62


Organization of the Presentation

1 From software to hardware


Definitions
Trends
From code to executable file
When does software meet hardware ?

2 Embedded Operating Systems


Operating System
Embedded Operating System
Virtualization

IMT-Atlantique Embedded Software 55 / 62


Virtualization

Concurrent execution of
multiple OS on a single
hardware platform OS OS OS
Each OS acts as if it owned the
hardware
The Virtualization layer Virtualization
provides an interface that is
the same as the original
machine
exhibits minor performance Hardware
loss
has exclusive control of the
hardware

IMT-Atlantique Embedded Software 56 / 62


Benefits of virtualization

Consolidation (multiple OS on OS OS OS
a single hardware means
fewer machines, cost
efficiency) Virtualization
Isolation
security
intellectual property
Hardware
Migration cost

IMT-Atlantique Embedded Software 57 / 62


Trends: Virtualization
59

Are you currently using embedded


virtualization/hypervisors or will you likely use
them in the next 12 months?
2019 (N = 577) 2017 (N = 768) 2015 (N = 1059) 2014 (N = 1394)
83% 85% 84%
80%

20%
17% 15% 16%
10% 9%
4% 5% 6% 4% 5% 4% 5% 4% 7% 7%

Top reasons for using virtualization/hypervisors %


Separation of multiple applications 45
Need to support multiple guest operating systems (e.g., Android, VxWorks, Linux) 40
Need to support hard real-time application(s) and guest operating system 32
Processor consolidation 26
Need to support legacy and new applications on the same system 26

2019 Embedded Markets Study © 2019 Copyright by AspenCore. All rights reserved.

[Link]
Embedded_2019_Embedded_Markets_Study.pdf
IMT-Atlantique Embedded Software 58 / 62
Virtualization Layer

Bare Metal vs Host Based

Service
Guest Guest Guest Guest Regular Regular
(privileged) Application Application
VM VM VM VM
VM
Qemu Qemu

Hypervisor KVM
Host OS

Hardware Hardware

Bare Metal model Hosted model

IMT-Atlantique Embedded Software 59 / 62


Virtualization: Host Based

Guest Guest Regular


Application
Regular
Application
A host OS with virtualization
VM VM
Qemu Qemu software (ex:KVM)
Guest VMs run on top of the
KVM
Host OS host
Qemu : CPU emulator
Examples:
Hardware Virtualbox, VMware Player,
Parallel Studio

IMT-Atlantique Embedded Software 60 / 62


Virtualization: Bare Metal

Service
Guest Guest
VMM manages all hardware
(privileged)
VM
VM VM resources and supports
execution of the VMs
privileged service VM to deal
Hypervisor with devices
Examples:
x86: Xen (open source or
Hardware Citrix), EDX (VMware)
Embedded: OKL4, CrossOS

IMT-Atlantique Embedded Software 61 / 62


Going further...
UBO, Jalil Boukhobza
[Link]
systemes-dexploitation-pour-lembarque
Georgia Tech, Ada Gavrilovska
[Link]

IMT-Atlantique Embedded Software 62 / 62

You might also like