Faculty Orientation Program€¦ · CH 13.1 1 Host and Target Machines CH 13.2 Linking and Locating...

Post on 24-May-2020

4 views 0 download

Transcript of Faculty Orientation Program€¦ · CH 13.1 1 Host and Target Machines CH 13.2 Linking and Locating...

Faculty Orientation Program BE Revised Syllabus ( 2012 course) Under aegis of BOS Electronics, SPPU, Pune

UNIT 6: Embedded Software Development, Testing Process and

Tools

Prof. Varsha K. Harpale

Pimpri Chinchwad College of Engg. Pune

Syllabus Topics (6 Hrs.) Syllabus Topic Reference Topic Hours

Embedded Software development process and tools

R1

CH 13.1 1

Host and Target Machines CH 13.2

Linking and Locating Software CH 13.3

1 Getting Embedded Software into the Target System

CH 13.4

Issues in Hardware- Software Design and Co-design.

CH 13.5 1

Testing on Host Machine CH 14.1 1

Simulators CH 14.2

Laboratory Tools CH 14.3 1

Case study : Automatic Chocolate Vending Machine

CH 11.1

1 Case study : Mobile Phone http://www.ann.ece.ufl.edu/courses/eel6935_10spr/papers/Cellular_Phones_as_Embedded_Systems.pdf 6/13/2015 2

Lecture 1a: Embedded Software Development Process and Tools

Development Process

Consists of cycles of editing-testing- debugging.

Processor and hardware part once chosen remains fixed, the application software codes have to be perfected by a number of runs and tests.

6/13/2015 4

Development Process Of An Embedded System

6/13/2015 5

Edit-test-debug Cycle Implementation Phase Of The Development Process

6/13/2015 6

Software Tools Software Development Lit (SDK)

Source-code Engineering Software

RTOS

Integrated Development Environment

Prototyper

Editor

Interpreter

Compiler

Assembler

Cross Assembler

Testing and debugging tools

Locator

6/13/2015 7

Integrated Development Environment (IDE)

Consists of

Simulators

Editors,

Compilers,

Assemblers

Emulators

Logic analyzers

EPROM/EEPROM application codes burner.

6/13/2015 8

Simple IDE

6/13/2015 9

Sophisticated IDE

6/13/2015 10

Features of IDE Facility for defining a processor family

as well as defining its version.

Includes source code engineering tools that incorporate the editor, compiler for C and embedded C++,

Assembler, linker, locator, logic analyser, help to use various platforms

Optimizes the use of memory

6/13/2015 11

Features of IDE

Provides Windows on the screen for the

detailed information of ─

source code part with labels and

symbolic arguments,

registers as the execution continues,

status of peripheral devices,

status of RAM and ports,

status of stack and program flow as it continues

6/13/2015 12

Features of IDE

Verifies the performance of a target system that an emulator built into the development system, which remains independent of a particular targeted system,

Includes a logic analyzer for up to 256 or 512 transactions on the address and data buses after triggering

6/13/2015 13

Features of IDE Simulates on a host system (PC), the hardware unit

like emulator, peripherals, and I/O devices.

Supports conditional and unconditional breakpoints.

Debug by single stepping.

Facilitate for synchronizing the internal peripherals

Facility of a user-definable assembler to support a new version or type of processor.

Provision of a multi-user environment.

Design process divisibility into a number of sub parts.

Each programmer assigned independent but linked tasks

6/13/2015 14

IDE Example

IDE from Keil μVision 2 with RTX51 for 8051 family of microcontrollers

IDE from Keil μVision 3 RTX51 for ARM family of processors and microcontrollers

6/13/2015 15

Lecture1b: Host and Target Machines

Hardware Components of Host system

High performance processor with caches,

Large RAM memory

ROMBIOS (read only memory basic input-output system)

Very large memory on disk

Keyboard, Mice, Display monitor

Network connection

Program development kit for a high level language program or IDE

Host processor compiler and cross-Compiler, Cross- assembler

6/13/2015 17

Program Development Tool Kit

Editor─ used for writing C codes or assembly

mnemonics or C++ or Java or Visual C++ using the keyboard of the host system (PC) for entering the program.

Using GUIs for allowing the entry, addition, deletion, insert, appending previously written lines or files, merging record and files at the specific positions.

Compiler, cross compiler, assembler, cross assembler

6/13/2015 18

Create source file that stores the edited file.

File given an appropriate name by the programmer

Can use previously created files

Can also integrate the various source files.

Can save different versions of the source files.

6/13/2015

Program Development Tool Kit

19

Target System Board

6/13/2015 20

Sophisticated Target System

6/13/2015 21

Target and Final systems Target system differs from a final system

Target system interfaces with the computer as well works as a standalone system

In target system might be repeated downloading of the codes during the development phase.

Target system copy made that later on functions as embedded system

Designer later on simply copies it into final system or product.

Final system may employs ROM in place of flash, EEPROM or EPROM in embedded system.

6/13/2015 22

Lecture 2a: Linking and Locating Software

Linker Links the compiled codes of application

software, object codes from library and OS kernel functions.

Linking necessitates because of the number of codes to be linked for the final binary file.

For example, standard codes for to program a delay task, must link with the assembled codes.

The delay code sequential from a beginning address.

6/13/2015 24

Linker cont......

The assembly software codes also sequential from another beginning address.

Both the codes have to at the distinct addresses as well as at the available addresses in the system. Linker links these

After linking, re-allocation of the sequences of placing the codes before actually placement of the codes in the memory

Linked file in binary for run on a computer commonly known as executable file or simply '.exe' file.

6/13/2015 25

Loader Program loaded in a computer RAM.

Loader program performs the task of reallocating the codes after finding the physical memory addresses available at a given instant.

Loader a part of the operating system and places codes into the memory after reading the '.exe' file.

Step necessary because the available memory addresses may not start from 0x0000, and binary codes have to be loaded at the different addresses during the run.

6/13/2015 26

Loader cont......

Loader finds the appropriate start address.

In a computer, after the loader loads into a section of RAM and after loading the program ready to run

6/13/2015 27

Locator

When the code embeds into ROM or flash, a system design process is locating these codes as a ROM image.

Codes are permanently placed at the actually available addresses in the ROM.

Embedded systems─ no separate program to

keep track of the available addresses at different times during the running, as in a computer .

6/13/2015 28

Locator The locator is specified by the programmer as

per available addresses at the RAM and ROM in target.

Programmer defines the available addresses in embedded systems for loading to load and creating files for permanently locating the codes using a device programmer

Uses cross-assembler output, a memory allocation map and provides the locator program output file.

6/13/2015 29

Locator cont......

Uses the cross compile codes in different cross-compiled segments for (i) instructions, (ii) initialized values and addresses (iii) constant strings (iv) uninitialized data.

Locates the I/O tasks and hardware device driver codes at the unchanged addresses.

These are as per the interfacing circuit between the system buses and ports or devices.

6/13/2015 30

Various software tools and chain of actions of linker at host and locator in an embedded system

6/13/2015 31

Memory Map for coding a locator program Memory map in Harvard Architecture

6/13/2015 32

Lecture 2b: Getting Embedded Software into the Target System.

Device PROM or Flash Programmer

Device programmer also called laboratory programmer

A programming system for a selected device

Device may be a PROM or EPROM chip or a flash or a unit in a microcontroller or PLA, GAL or PLC.

Selected device inserts into a socket Programmed (burned the codes) by transfer of the bytes for each address using the software at the host

6/13/2015 34

Burning in of the application software codes, data and tables using a device programmer

6/13/2015 35

Downloading the Finalized Codes into PROM or Flash

A process that places the codes.

Codes downloaded, according to ROM image (locator output)

Burning done in the laboratory using a device programmer into an erased EPROM or EEPROM or PROM or flash

6/13/2015 36

Lecture 3: Issues in Hardware- Software Design and Co-design

Two Approaches For The Embedded System Design

(1) When the software development cycle ends then the cycle begins for the process of integrating the software into the hardware at the time when a system is designed.

(2)Both cycles concurrently proceed when co-designing a time critical sophisticated system.

6/13/2015 38

Hardware and Software Co-design Flow

6/13/2015 39

Hardware Implementation Advantages

(i) Reduced memory for the program.

(ii) Reduced number of chips but at an increased cost.

(iii) Simple coding for the device drivers.

(iv) Internally embedded codes, which are more secure than at the external ROM

(v) Energy dissipation can be controlled by controlling the clock rate and voltage

6/13/2015 40

Software Implementation Advantages (i) Easier to change when new hardware

versions become available.

(ii) Programmability for complex operations.

(iii) Faster development time.

(iv) Modularity and portability.

(v) Use of standard software engineering, modelling and RTOS tools.

(vi) Faster speed of operation of complex functions with high-speed microprocessors.

(vii) Less cost for simple systems.

6/13/2015 41

Selection of Components

Processor ASIP or ASSP / Multiple processors / System-on-Chip Processor Less System

Memory

Buses

Software Language

RTOS (real-time programming OS)

Code generation tools

Tools for finally embedding the software into binary image

6/13/2015 42

Processor Less System

6/13/2015 43

Microprocessor or Microcontroller or DSP

6/13/2015 44

Factors and Needed Features Taken into Consideration When the 32-bit system, 16kB+ on chip

memory and need of cache, memory management unit or SIMD or MIMD or DSP instructions arise, we use a microprocessor or DSP.

Video game, voice recognition and image-filtering systems− need a DSP.

Microcontroller provides the advantage of on-chip memories and subsystems like the timers.

6/13/2015 45

Factors for On-Chip Feature 8 bit or 16 bit or 32 bit ALU

Cache, Memory Management Unit

DSP calculations unit

Intensive computations at fast rate

Total external and internal Memory up to or more than 64 kB

Internal RAM, Internal ROM/EPROM/EEPROM, Flash

Timer 1, 2 or 3, Watchdog Timer

Serial Peripheral Interface Full duplex, Serial Synchronous Communication Interface (SI) Half Duplex

6/13/2015 46

Factors for On-Chip Feature

Serial UART

Input Captures and Out-compares

PWM

Single or multi-channel ADC with or

without programmable Voltage

reference (single or dual reference)

DMA Controller

Power Dissipation 6/13/2015 47

Porting issues in an Embedded Platform

Porting issues of OS

I/O instructions

Interrupt Servicing Routines

Data types

Interface specific data types

Byte order

Data Alignment

Linked Lists

Memory Page Size

Time Intervals 6/13/2015 48

Lecture 4a: Testing on Host Machine

Host and Test Systems During Development Process

Two systems with different CPUs or microcontroller and hardware architecture.

One system─ host, generally PC or

laptop or workstation.

Other system ─target, actual hardware

for the embedded system under development

6/13/2015 50

Host and Target Test Systems During Development Process

6/13/2015 51

Testing Steps at Host Machine

1. Initial Tests─ each module or segment at initial stage itself and

on host itself

2. Test data─ all possible combinations of data designed and taken

as test data

3. Interrupts and Exception condition tests ─ all possible

exceptions for the test.

4. Tests-1: hardware independent code

5. Tests-2:software running on host the target dependent codes and which have same start of code and port and device addresses as at the hardware.

6. Instructions– given from file or keyboard inputs.

7. Test ISR for Hardware dependent and independent interrupts.

8. Timer tests─ Hardware dependent code timing functions, clock

tick set, counts get, counts put, delay

9. Outputs–at host’s LCD display and saves at file 6/13/2015 52

Lecture 4b: Simulator

Target Debugging

6/13/2015 54

Simulator

Uses knowledge of target processor or microcontroller, and target system architecture on the host processor.

First does cross compilation of the codes and place these into host system RAM.

Behaviour of target system processor registers simulated

6/13/2015 55

Simulator cont...... Uses linker and locator to port the cross

compiled codes in RAM and functions like the code that would have run at the actual target system.

Simulates hardware units like emulator, peripherals, network and input-output devices on a host.

A simulator remains independent of a particular targeted system

Results expected from codes at target system RAM, peripherals, network and input-output devices obtained at the host system RAM

6/13/2015 56

Development processes using simulator

6/13/2015 57

Simulator Features Defines the processor or processing device

family as well as its various versions for the target system.

Monitors the detailed information of a source code

Provides the detailed information of the status of RAM, ports, interfacing devices, registers and status of stack during single stepping execution.

Provides tracing and breakpoints facility

6/13/2015 58

Simulator Features cont......

Facilitates synchronizing the internal peripherals and delays.

Employs RTOS scheduler that preempts task.

Simulates the inputs from the interrupts, the timers, ports and peripherals.

Provides network driver and device driver support

6/13/2015 59

Simulator Limitations

Processor speed at target processor may not be adequately mapped with the host for calculating time responses and calculating output instances and throughputs at the target.

May not be able to take into account portability problems.

A simulator may fail to show a bug from shared data as it arises from an interrupt in some particular situation.

6/13/2015 60

Lecture 5: Laboratory Tools

Tools Used In The Embedded Design and Development Process.

6/13/2015 62

Hardware Diagnostic Laboratory Tools Volt-Ohm meter

LED test

Logic Probe

Oscilloscope

Logic Analyser

Bit Rate meter

ICE

System Monitor Codes

6/13/2015 63

Use of Bit rate meter

A measuring device that finds numbers of ‘1’s and ‘0’ in the preselected time spans.

Measures throughput.

Can estimate bits ‘1’s and ‘0’s in a test message and then use bit rate meter to find whether that matches with the message.

6/13/2015 64

In-Circuit Emulator (ICE)

A circuit for emulating target system remains independent of a particular targeted system and processor

Emulator or ICE provides great flexibility and ease for developing various applications on a single system in place of testing that multiple targeted systems.

6/13/2015 65

Emulator

6/13/2015 66

Emulator cont......

Emulates MCU inputs from sensors

Emulates controlled outputs for the

peripheral interfaces/systems

Emulates target MCU IOs and socket

to connect externally MCU

6/13/2015 67

ICE

6/13/2015 68

ICE cont......

Interface COM port of a computer

Emulates target MCU IOs

ICE socket connects MCU externally.

Uses computer developed object files and hex files for the MCU

Uses debugger at the computer developed files for the MCU application

6/13/2015 69

Difference in Emulator and ICE

Emulator uses the circuit consisting of the microcontroller or processor itself.

The emulator emulates the target system with extended memory and with codes downloading ability during the edit-test debug cycles.

ROM Emulator emulates only a ROM.

ICE uses another circuit with a card that connects to target processor (or circuit) through a socket.

6/13/2015 70

Lecture 6: Embedded Case Studies

AUTOMATIC CHOCOLATE VENDING MACHINE (AVCM)

ACVM Specifications

Alphanumeric display and keypad for user interaction (GUI based)

Function : Displays menus, entered text, pictograms, and welcome, thank and other messages, and time and date.

Coin insertion for depositing coin, delivery slots for delivering chocolate, and Internet port for remote usage.

6/13/2015 72

Basic system in ACVM

6/13/2015 73

ACVM Design metrics

Power Dissipation:

Performance: One chocolate in two minutes and 256 chocolates before next filling of chocolates into the machine.

Process Deadlines: Machine waits for

maximum 30 s for the coins and machine should deliver the chocolate within 60 s.

6/13/2015 74

ACVM Design metrics cont......

User Interfaces: Graphic at LCD or touch screen display on LCD and commands by user or machine owner through fingers on keypad or touch screen.

Engineering Cost

Manufacturing Cost

6/13/2015 75

State Diagram ACVM

6/13/2015 76

Block diagram of ACVM hardware including Microcontroller

6/13/2015 77

Software architecture (ISRs and Tasks) for ACVM

6/13/2015 78

References:

R1: Raj Kamal, “Embedded Systems – Architecture, Programming and Design" 2nd edition, Mc Graw Hill.

Other Reference : Arnold S. Berger , “Embedded Systems Design: An Introduction to Processes, Tools, and Techniques” CMP Books

6/13/2015 80