COME412 – Embedded Systems
Introduction to
   Embedded Systems
          CENGİZ RİVA
             Embedded System
• Billions of computing systems which are built every year for a very
  different purpose are embedded within larger electronic devices,
  repeatedly carrying out a particular function, often going
  completely unrecognized by the device’s user!
           Embedded System
An embedded system is nearly any computing system other than a
desktop, laptop, or mainframe computer but it is not designed to
be programmed by the end user in the same way that a PC is.
• Some common characteristics of embedded systems;
   • Single-functioned
   • Executes a single program, repeatedly
   • Tightly-constrained
   • Low cost, low power, small, fast, etc.
   • Reactive and real-time
   • Continually reacts to changes in the system’s environment
   • Must compute certain results in real-time without delay
            Embedded System
• Use feedback to influence the dynamics of the physical world by
  taking smart decisions in the cyber world
                 Efficiency
Efficiency & Specialization
    • Embedded systems must be efficient in 5 area:
        1.
        2.
        3.
        4.
       5.
                 Efficiency
Efficiency & Specialization
    • Embedded systems must be efficient in 5 area:
        1. Energy efficient
        2. Code‐size and data memory efficient
        3. Run‐time efficient
        4. Weight/Size efficient
        5. Cost efficient
              Design Challenge
• Unit cost: the monetary cost of manufacturing each copy of the
  system, excluding NRE cost
• NRE cost (Non-Recurring Engineering cost): The one-time
  monetary cost of designing the system
• Size: the physical space required by the system
• Performance: the execution time or throughput of the system
• Power: the amount of power consumed by the system
• Flexibility: the ability to change the functionality of the system
  without incurring heavy NRE cost
• Time-to-prototype: the time needed to build a working version of
  the system
• Time-to-market: the time required to develop a system to the
  point that it can be released and sold to customers
            Embedded System
• Design metric competition:
 • improving one may worsen others
   Embedded System
• Three key technologies for embedded systems
   • Processor technology
   • IC technology
   • Design technology
           Embedded System
• Processor technology
Embedded System
        Components of an
        Embedded System
• An embedded system is composed of following components
   • Processor
   • Memory
   • Peripherals
      • I/O boards
      • ADC/DACs
      • Timer
      • DMA
      • …
   • Software
             Components of an
             Embedded System
Processor:
• The main criteria for the processor is: can it provide the
  processing power needed to perform the tasks within the
  system?
• Performance , speed, capability of the instruction set,
  addressing capability, memory caching, interrupts, cost,
  availability, size, power consumption are the selection criterias.
• Processor or microcontroller selection.
• A Microcontroller has built in processor, limited memory, port
  and other peripherals.
           Components of an
           Embedded System
Memory:
• Memory is an important part of any embedded system design.
• It provides storage for
   • Software that processor will run,
   • Dynamic data such as variables, tables, etc.
• Different memory types are used to to store those data in an
  embedded system.
• A non-volatile memory is used to store the software called read
  only memory (ROM) and Random Access Memory (RAM) is
  used to store dynamic data.
           Components of an
           Embedded System
• A non-volatile memory that retains its contents when power is
  removed. This can be on-chip read only memory (ROM) or
  external EPROM.
• The software that it contains might be the complete program or
  an initialisation routine that obtains the full software from
  another source within or outside of the system.
• This initialisation routine is often referred to as a bootstrap
  program or routine.
• The boards that have embedded processors will often start up
  using software stored in an onboard EPROM and then wait for
  the full software to be downloaded from the memory.
           Components of an
           Embedded System
• Software needs some memory to store variables and to manage
  software structures such as stacks/heap.
• The amount of memory that is needed for variables is
  frequently less than that needed for the actual program.
• Therefore limited RAM boards are used for these purposes.
            Components of an
            Embedded System
Input Ports:
• An embedded system has to communicate with the outside world
   and this is done by peripherals.
• The first peripheral is the interface to external world which are
   ports composed of various single physical pins.
• These pins can read and write one bit of digital information.
• Input ports are usually associated with sensors that measure the
   external world.
• While processors operate in the digital domain, the natural world
   does not and tends to orientate to analogue values. As a result,
   ADC is needed to be converted from analogue to digital.
• The CPU processing speed must be faster than the sampling rate
   of ADC.
            Components of an
            Embedded System
Peripherals:
• Output ports are usually associated with displays, motor drivers,
  actuators, industrial devices such as valves, etc.
• Since these devices may also need analog signals, we need DAC
  (Digital Analogue Converter) in order to convert digital
  information produced in the embedded system to analogue
  voltages.
• By this way, they effectively control the output operations that
  the embedded system designed for.
            Components of an
            Embedded System
Timers:
• Some embedded applications require time based event controls.
• In this case we need to Timer peripherals.
• Timers are actually counters.
• A counter counts the ticks of system clocks.
• Generally system clocks are too fast for real time applications in
  industry therefore they have to be prescaled according to the
  need.
• Timers are capable of prescaling system clock with additional
  counters to adjust to the desired duration.
            Components of an
            Embedded System
DMA:
• When we want to read or write a continuous information to or
  from external world using sensors or output devices, we don’t
  want CPU to handle this bulky task.
• In order to offload CPU we use DMA (Direct Memeory Access)
  peripheral.
• With the help of DMA, the external device directly communicates
  with the memory either for read or for write operation.
           Components of an
           Embedded System
Software:
• The software components within an embedded system often
  encompasses the technology that adds value to the system and
  defines what it does and how well it does it.
• The software can consist of several different components:
   • Initialisation and configuration
   • Operating system or run-time environment
   • The applications software itself
   • Error handling
   • Debug and maintenance support.
Architecture of an
Embedded System
             Microprocessor or
              Microcontroller
• A microprocessor has only CPU.
• All peripherals must be externally provided.
• However, Microcontroller boards have built in various peripherals
  but they have limited peripherals due to board size.
• Generally for typical industrial applications, microcontrollers are
  more than enough, of course, right one must be selected.
• But in case these peripherals are not enough then
  microprocessor must be selected for the system because
  microprocessors uses external boards to have more peripherals
  to communicate these sensors or actuators.
      Coding and Debugging
• If a line of source program usually yields just one machine
  instruction, the translation process is called assembly and a
  program that performs this process is called an assembler.
• If a line of source program in a high level language (e.g. C )
  usually yields more than one machine instruction, this
  translation program is called a compiler.
                                   • Nowadays these compilers
                                     are     built in   IDEs
                                     (Integrated Development
                                     Environment).
          Coding and Debugging
• The host is connected to the target,
  invokes the download command on
  the target debugger and sends the file.
• The target debugger loads at the
  correct memory location.
• Afterwards, processor runs the software and provides physical
  outputs.
• There is also a communication with the host showing outputs
  using trace method.
• With this way, software can easily be checked for bugs.
                STM32CubeIDE
• It generates the corresponding C language initialization code
  according to the selected configuration.