25
EE446 Embedded Architectures (2014CSULA) 09/25/14 1 Instructor: Airs Lin Mentor: Dr. Charles Liu Time: SEC1:TR 01:30PM~03:10PM SEC2:TR 09:50AM~11:30AM Office Hour: TR 03:20am ~ 05:20pm Website: http://EE446.isanEngineer.com Email: [email protected]

EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

1

Instructor: Airs LinMentor: Dr. Charles Liu

Time: 

SEC1:TR 01:30PM~03:10PM

SEC2:TR 09:50AM~11:30AM

Office Hour: TR 03:20am ~ 05:20pm

Website: http://EE446.is‐an‐Engineer.com

Email: [email protected]

Page 2: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

2

Week 1: Introduction to Embedded Systems

Week 2, 3: UML in Embedded System Design

Homework 1: Embedded proposal

Homework 2: UML Week 4: Memory Technology

Week 5: Peripheral Interfaces

Week 6:

Microcontroller (Cypress PSoC 5)

PSoC Project

Week 7:

PSoC Project

Week 8:

Introduction to FPGA

Altera System on Chip (SoC)

Page 3: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

3

Week 9:

FPGA Project (Handshaking)

Week 10:

FPGA Project (Handshaking)

Final Week.

Page 4: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

4

Embedded Systems is a computer inside a product Computer system which is part of some other equipment

Typically dedicated software (may be user‐customizable)

May be required to respond to events in real time

A special‐purpose computer system  Designed to perform one or a few dedicated functions, sometimes with real‐time computing constraints.

Usually containing sensors and actuators (and its control loop)

Usually embedded as part of another system

Page 5: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

5

Providing pervasive computational intelligence

Appliance, equipment, facilities are getting more intelligent

Predicting your need

Optimizing consumption, performance

Coordinate with each other

Page 6: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

6

Early era: purposely built chips and boards Integrating mostly analog components

Hardwired computation logic Recent: rise of cheap general purpose microprocessors Programmable computation logic

On‐board memory

Networking and communication capabilities Two major types: FPGA (Field‐programmable Gate Array)

▪ Programmable at logic gate level

Microprocessor▪ Programmable by programming languages (C/C++, Assembly, Java)

Embedded Processors:• PIC MCUs(8/16/32 bit MCU)• 8051 (8bit MCU)• ZilogZ80(8bit MCU), Z8000 (16bit MCU)• Atmel  ATmega328 MCU (8bit)• …

Page 7: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

7

Embedded Processors:• ARM Cortex‐M3 CPU Core (32bit)

• Cypress PSoC 5• Atmel SAM3X8E (Arduino Due)

• Multi‐Core ARM Core CPU (32bit)• TI OMAP Dual ARM‐Cortex Core MCU• AllwinnerTech A20 Dual Core SoC MCU• Rockchip RK3188 Quad Core ARM Cortec‐A9 SoC

• Intel• Intel Quark SoC X1000 (32bit – Intel Pentium)

• AMD• AMD G‐T40E Dual‐Core x86 SoC

Page 8: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

8

Embedded systems integrating with other systems, and must be dependable: Reliability: R(t) = probability of system working 

correctly provided that is was working at the beginning (t=0)

Maintainability: M(d) = probability of system working correctly d time units after error occurred.

Availability: probability of system working at time t Safety: no harm to be caused Security: confidential and authentic communication

Embedded systems have small footprint and must be efficient: Energy efficient Code‐size efficient (especially for systems on a chip) Run‐time efficient Weight efficient Cost efficient

Specific to a certain application: Knowledge about behavior at design time can be used to minimize resources and to maximize robustness.

Specific user interface (no mouse, keyboard and screen)

Page 9: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

9

Real‐Time embedded systems are meant to be front‐end, and must meet real‐time constraints: A real‐time system must react to stimuli from the controlled object (or the operator) within the time interval dictated by the environment

For real‐time systems, right answers arriving too late are wrong

Frequently connected to physical environment through sensors and actuators, Hybrid systems (analog + digital parts) Embedded systems are reactive systems, in continual interaction with environment and executes at a pace determined by environment

General Purpose Computing System Embedded System

General Purpose: Broad class of applications. Specific Purpose: Limited applications that are implemented at design‐time.

Programmable by end user Not programmable by end user

Faster is better Fixed run‐time requirements (additional computing power not useful)

Criterial: cost, average speed Criteria: cost, power consumption, predictability

Page 10: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

10

Page 11: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

11

Requirements analysis & definition

Recognition of need

Definition of problem

▪ Customer Requirements▪ Trying to figure out what the customer is looking for

▪ Note: Customers might not know what they want

▪ Can always give platitudes, e.g. convenient, easy‐to‐use, lightweight, simple

▪ Digging deeper: find a design problem in customer original requests and refine the problem

Page 12: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

12

How much hardware do we need?

How big is the CPU? Memory?

Co‐Design: Hardware or Software ? Code Optimization Efficient Input / Output Embedding an Operating System or not?

‐ Real Time?‐ non  Real Time?

Testing and Debugging

ASIC

Reconfigurable Logic

CPLD

FPGA

Multiple Embedded Systems

Page 13: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

13

Custom‐designed circuits necessary if ultimate speed or energy efficiency is the goal and

large numbers can be sold Approach suffers from long design times and Lack of flexibility (changing standards) and

high costs▪ Product Cost = NRE + (RE * P)

Image Signal Processor ASIC for High-Quality CCD Camera

Video ASIC

Page 14: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

14

Full custom chips may be too expensive, software may be too slow Use of configurable hardware

▪ Complex Programmable Logic Device (CPLD)

▪ Field Programmable Gate Array (FPGA) Application areas Fast prototyping For smaller designs or lower 

production volumes Example: Xilinx Virtex‐5 FPGAs Altera Cyclone IV FPGAs

Page 15: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

15

Function inlining

Eliminate common sub‐expressions

Loop unrolling

Optimize code in assembly language

Optimize compiler

When to use inline function• Use inline instead of #define• The function is small and called very often

Page 16: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

16

Example: Common sub‐expression

Example: Common sub‐expression elimination

Replace re‐computation of expression by use of  tmp which holds value.

Example: Initializing an arrayUnrolled loop

Loop termination assembly code

Page 17: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

17

Example: Normal loop

Example: After loop unrolling

Assembly Code Use assembly language to implement some functions

Inline‐Assembler Mixing C and Assembler Code

Page 18: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

18

Most compiler has a range of optimization levels

Page 19: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

19

Microprocessor Unit (MPU)

Microcontroller Unit (MCU)

CPU (on single chip)• Microprocessor is heart of Computer System• It is just a processor. Memory and I/O components 

have to be connected externally

Memory

I/O Ports

Microprocessor

All in one chip: Reduced chip count for board design• Microprocessor• Memory• I/O Ports

BeagleBone Black Board 1GHz TI AM335x ARM Cortex‐A8 CPU 512MB DDR3, 4GB Flash Memory microSDCard Support I/O Expansion Headers 65 Digital I/O (3.3V only)▪ 7 Analog▪ 4 Serial▪ 2 SPI▪ 2 I2C▪ 8 PWMs▪ 4 Timers▪ …

Page 20: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

20

EXPANSION

EXPANSION

TI SitaraAM3358AZCZ

(ARM Cortex-A8)1GHz

512MB DDR3L

USB HOST

2GB/4GB eMMC

microSD

JTAG

RJ45PHY

HDMIHDMI

FRAMER

TPS65217C

DC

UARTHDR

USB

EagleSoC Development Board

67MHz Cypress PSoC 5LP ARM Cortex‐M3 CPU

64KB SDRAM, 128KB Flash, 2K EEPROM

72 I/Os (5V, 3.3V, and Vadj)

▪ 64 GPIO, 8 SIO, 2 USBIOs

▪ All GPIOs are reconfigurable

▪ I2C, SPI, UART, USB, A/D, D/A, OPAmp, Timer, PWM, CAN,…

Microcontroller

USB‐to‐UART

Page 21: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

21

Microprocessor Microcontroller

PerformanceHigh

(Multi‐Core, 800MHz, 1GHz…)

Low(Single‐Core, 16MHz, 

80MHz,…)

Entire Power Consumption

High Low

Circuit DesignComplex

(External Memory, I/O … chips)Simple

(On‐chip)

MemoryLarge

(128MB, 512MB, 1GB…)Small

(8KB, 32KB, 64KB, 128KB…)

OS SupportedEmbedded LinuxReal‐Time OS

Tiny Real‐Time OS

I/O InterfacesFew

Need extra chipsRich and flexible

Page 22: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

22

EE‐446Embedded Architectures (System)

ProgrammingComputer

OrganizationAlgorithms

OS &Networks

EEFundamentals

Control Systems

Digital Signal 

Processing

Read‐Time 

SystemsRobotics Applications …

C/C++, Assembly

DSP, FPGA

uCLinux, uC/OS, QNX, …

Page 23: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

23

Start out with a good embedded development kit (PSoC, Arduino…)

Setup a hardware development environment Carefully study datasheet Fully understand communication protocols Learn digital and analog circuit design Learn Soldering and PCB layout Use equipment to debug signals Multimeter

Digital Oscilloscope

Page 24: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

24

Learn C programming before start learning Microcontroller/Embedded Systems

Re‐write all the code, not just copy‐paste Get good source control (version control) Learn assembly language Study algorithms Learn the tools well for whatever chip you’re working on

Build a debugging information into the code

Embedded Design Proposal

Page 25: EE 446 Embedded Architectures (2014CSULA) 09/25/14 · EE‐446 Embedded Architectures (2014CSULA) 09/25/14 4 Embedded Systems is a computer inside a product Computer system which

EE‐446 Embedded Architectures (2014CSULA) 09/25/14

25