General Purpose Systems

System Structure

Learning Outcomes

  1. Compare general purpose system and embedded systems
  2. Explain and use Syscall API
  3. Explain FSM design of embedded systems
  4. Implement FSM using (i) function-driven approach (ii) table-driven approach

Lets start by understanding the structure of general purpose system-like unix.


Three layers of abstraction: (i) Users and their applications, (ii) system software and resources, and (iii) the devices and device drivers. The interface between (i) and (ii) is the "system call API" and the interface between the system resources and the hardware is the kernel interface to the hardware.
Lets understand the system call concept. The steps in executing a system call read(fd,buffer,nbytes) is depicted below:


Now compare an embedded system with the general purpose system.

In a typical embedded system, the apps or applications are directly interfacing with the hardware. The embedded software is optimized to work with the embedded hardware.
Hmm....then how do we design an embedded system? What are the approaches?

Embedded System Design

Common embedded system design involves simple representation such as UML (Unified Modeling Language) state machine.
An FSM M = five tuple  { S, i, T, Σ, δ }
S = set of states
i = initial state
T = terminal state (s)
Σ = events that bring about transitions
δ = transitions

Embedded System design:You begin the design process by examining the problem description, the requirements stated in there, and then move on to design repesentation, build the prototype, test it and finally build the production system.
Problem--> requirements--> design--> prototype--> test--> final system.
Lets look at some simple examples.

Problem 1: Automatic vending machine money counter
Introduction:Embedded system (25Cent counter)
Input:Coins: 5, 10, 25 cent coins
output:Light turns on when count (total of coins input) reaches 25 or over
Design:FSM1

Problem 2: Drone avionics
Introduction: Is given in the form of an FSM.



Input: Commands or events triggering drone action
Output:Action of the drone
Design: FSM2 above
We will use two approaches (i) function-driven and (ii) table-driven to arrive at the solution for this problem. We will discuss the pros and cons of these two approaches for designing embedded systems.

Problem 3: Blind Bingo
Introduction: Design an application for Bling Bingo.



Input: Input from keyboard
Output:When all letters on the board are crossed out, a lights turns on.
Design: Cyclic executive