Embedded Systems Architecture
eBook - ePub

Embedded Systems Architecture

Explore architectural concepts, pragmatic design patterns, and best practices to produce robust systems

Daniele Lacamera

Condividi libro
  1. 324 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Embedded Systems Architecture

Explore architectural concepts, pragmatic design patterns, and best practices to produce robust systems

Daniele Lacamera

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Learn to design and develop safe and reliable embedded systemsAbout This Book• Identify and overcome challenges in embedded environments• Understand the steps required to increase the security of IoT solutions• Build safety-critical and memory-safe parallel and distributed embedded systemsWho This Book Is ForIf you're a software developer or designer wanting to learn about embedded programming, this is the book for you. You'll also find this book useful if you're a less experienced embedded programmer willing to expand your knowledge.What You Will Learn• Participate in the design and definition phase of an embedded product• Get to grips with writing code for ARM Cortex-M microcontrollers• Build an embedded development lab and optimize the workflow• Write memory-safe code• Understand the architecture behind the communication interfaces• Understand the design and development patterns for connected and distributed devices in the IoT• Master multitask parallel execution patterns and real-time operating systemsIn DetailEmbedded systems are self-contained devices with a dedicated purpose. We come across a variety of fields of applications for embedded systems in industries such as automotive, telecommunications, healthcare and consumer electronics, just to name a few.Embedded Systems Architecture begins with a bird's eye view of embedded development and how it differs from the other systems that you may be familiar with. You will first be guided to set up an optimal development environment, then move on to software tools and methodologies to improve the work flow. You will explore the boot-up mechanisms and the memory management strategies typical of a real-time embedded system. Through the analysis of the programming interface of the reference microcontroller, you'll look at the implementation of the features and the device drivers. Next, you'll learn about the techniques used to reduce power consumption. Then you will be introduced to the technologies, protocols and security aspects related to integrating the system into IoT solutions.By the end of the book, you will have explored various aspects of embedded architecture, including task synchronization in a multi-threading environment, and the safety models adopted by modern real-time operating systems.Style and approachSoftware developers and designers with experience in different fields, and who want to learn about embedded programming, will benefit from this book. Junior and less experienced embedded programmers willing to expand their knowledge in the field will also find it useful.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Embedded Systems Architecture è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Embedded Systems Architecture di Daniele Lacamera in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatik e Programmierung in C. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788830287
Edizione
1
Argomento
Informatik

Parallel Tasks and Scheduling

If the complexity of the system increases, and the software has to manage multiple peripherals and events at the same time, it is more convenient to rely on an operating system to coordinate and synchronize all the different operations. Separating the application logic into different threads offers a few important architectural advantages. Each component performs the designed operation within its own running unit, and it may release the CPU while it is suspended, waiting for input or a timeout event.
In this chapter, the mechanisms used to implement a multithreading embedded operating system are observed, through the development of a minimalistic operating system, tailored to the reference platform, and written step by step from scratch, providing a working scheduler to run multiple tasks in parallel.
The scheduler's internals are mostly implemented within system service calls, and its design impacts the system performance and other features, such as different priority levels and time constraints for real-time-dependent tasks. Some of the possible scheduling policies, for different contexts, are explained and implemented in the example code.
Running multiple threads in parallel implies that resources can be shared, and there is the possibility of concurrent access to the same memory. Most microprocessors designed to run multithreading systems provide primitive functions, accessible through specific assembly instructions, to implement locking mechanisms, such as semaphores. The example operating system exposes mutex and semaphore primitives that can be used by the threads to control access to the shared resources.
By introducing memory protection mechanisms, it is possible to provide a separation of the resources based on their addresses, and let the kernels supervise all the operations involving the hardware through a system call interface. Most real-time embedded operating systems prefer a flat model with no segmentation, to keep the kernel code as small as possible and with a minimal API, to optimize the resources available for the applications. The example kernel will show us how to create a system call API to centralize the control of the resources, using physical memory segmentation to protect the resources of the kernel, the system control block, the mapped peripherals' and the other tasks, with the purpose of increasing the level of safety of the system.
This chapter is split into the following sections:
  • Task management
  • Scheduler implementation
  • Synchronization
  • System resource separation

Task management

An operating system provides the abstraction of parallel running processes and threads, by alternating the applications to run in parallel. In fact, on systems with a single CPU, there can only be one running thread at a time. While the running thread executes, all the others are waiting in line until the next task switch.
In a cooperative model, switching the task is always a voluntary action requested by the thread implementation. The opposite approach, known as preemption, requires that the kernel periodically interrupts tasks at any point of their execution, to temporarily save the status and resume that of the next task in line.
Switching the running task consists of storing the first store of values of the CPU registers in RAM, and restoring those of the next task selected for running. This operation is better known as context switch, and is the core of the scheduling system.

The task block

Tasks have their representation in the system in the form of a task block structure. This object contains all the information needed for the scheduler to keep track of the state of the task at all times, and is dependent on the design of the scheduler. Tasks might be defined at compile time and started after the kernel boots, or spawned and terminated while the system is running.
Each task block may contain a pointer to the start function, that defines the beginning of the code executed when the task is spawned, and a set of optional arguments. Memory is assigned for each task to use it as its private stack region. This way, the execution context of each thread and process is separated from all the others, and the values of the registers can be stored in a task-specific memory area when the task is interrupted. The task-specific stack pointer is stored in the task block structure, and it will be used to store the values of the CPU register upon context switches.
Running with separate stacks requires that some memory is reserved in advance, and associated with each task. In the simplest case, all tasks are using a stack of the same size, are created before the scheduler starts, and cannot be terminated. This way, the memory reserved to be associated with private stacks can be contiguous and associated with each new task. The memory region used for the stack areas can be defined in the linker script.
The reference platform has a separate core-coupled memory, mapped at 0x10000000. Among the many possibilities to arrange the memory sections, we decide to map the start of the stack space, used to associate stack areas to the threads, at the beginni...

Indice dei contenuti