Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 23

CS4101 嵌入式系統概論

Design and Development

金仲達教授
國立清華大學資訊工程學系
9/16/2010
Slides from Computers as Components: Principles of Embedded
Computing System Design, Wayne Wolf, Morgan Kaufman;
An Embedded Software Primer, David E. Simon, Addison Wesley
Now, You Have Decided to

Save the Earth!


But how?

2
After Extensive Study, You Found
Fact 1: If every elevator in the world moves one
less floor, the annual world CO2 emission will be
reduced by X%

Fact 2: If a person climbs one floor, he or she will


burn Y calories

What a business to help exercises


& save earth!
3
Your Product Idea
 To develop a device that can record, for each
day, the number of floors that the user has
climbed and the number of floors that the user
has taken the elevator
 From this number, we can then calculate the amount
of CO2 saved and calories burned
 Let us call this device stair counter

How to start from here?

4
Typical Design Flow

requirements

Top-down
design specification

architecture Bottom-up
design

Real design component


development
often iterative
system
integration
5
requirements

Requirements specification

 Plain language description of what the architecture


user wants and expects to get
 e.g. to develop a device that can record, component
for each day, the number of floors that development
the user has climbed and the number of
system
floors that the user has taken the elevator integration
 Vision the end product used by the user
 May be developed in several ways:
 talking directly to customers
 talking to marketing representatives
 providing prototypes to users for comment

6
Requirements
 Often need to know target customers and
business model
 Stair counter as an add-on of cell phone

 Stair counter as a consumer product

 Stair counter as a gift

…

7
Requirements
Functional requirements:
Output as a function of input; internals as a black box
 Show number of stairs climbed and amount of calories
burned
 Show number of floors by elevator and amount of CO 2
saved
 Do not count in other cases
 Non-functional requirements:
 Performance, reliability, etc.
 Size, weight, etc.
 Power consumption
 Cost Describe “WHAT”, not “HOW”
…

8
Requirements Form

name Stair counter


purpose Count and show stairs climbed
and floors in elevators
inputs Power-on/off button
outputs Back-lit LCD 200 X 300
performance Update on every step
manufacturing cost $150
power 100 mW
physical size/weight No more than 2” X 3”, 4 oz.

9
requirements
Specification
specification
 More precise, usually quantitative
description of the system: architecture
 Should not imply a particular architecture
 List assumptions component
development
 e.g., update screen 0.25 sec after each
step, error rate < 95%, cost < $300 system
integration
 May include functional and
non-functional elements
 May be executable or may be in mathematical
form for proofs
 e.g. UML (Unified Modeling Language)

10
requirements
Architecture Design
specification
 What major components satisfy the
specification?  HOW architecture
 Need to know what are available
component
 Hardware components: development
 CPUs, peripherals, etc.
 e.g. 8051 CPU, 3-axis accelerometer system
integration
 Software components:
 Major programs and their operations
 e.g. no OS, accelerometer driver, LCD driver
 Must take into account functional and non-
functional specifications
11
Design Considerations
 Environment which the embedded system is in
 External and internal stimulus sources that
interact with the embedded system  I/O
 Actions and events caused by stimulus
 Elements of the embedded system that could be
affected by the stimulus
 Desired system responses to the stimulus, which
reflects one or more system requirements
 algorithm/workflow
 How the system responses can be measures

12
requirements
Component Development
specification
 Actual implementation of individual
hardware and software components architecture
 Must spend time architecting the system
before you start coding component
development
 Some components are ready-made,
some can be modified from existing system
integration
designs, others are to be designed
from scratch
 e.g. 8051 CPU, 3-axis accelerometer
 Good surveys help

13
requirements
System Integration
specification
 Put together the components
 Many bugs appear only at this stage architecture
 Require good interface definition from
the start component
development
 Have a plan for integrating
components to uncover bugs quickly, system
integration
test as much functionality as early
as possible

14
System Development
 Now that you have better idea of the
requirements, specifications, and
architecture of the stair counter requirements

specification
 How to proceed to develop the
components and integrate the
architecture
system?
But, component
 Real hardware? development
Programming environment?
system
integration

15
Development Environment
 Host: a computer running programming tools for
development
 Target: the HW on which code will run
 After program is written, compiled, assembled
and linked, it is transferred to the target

X86 8051

Host system Target system

16
What If Real HW Not Available?
 Development board:
 Before real hardware is built, software can be
developed and tested using development boards
 Development boards usually have the same CPU as
the end product and provide many IO peripherals for
the developed software to use
as if it were running on the
real end product

 Platform-based design

17
Platform-Based Design
 Platform: 一個已經有中央微處理器、記憶體、
匯流排、即時作業系統與基本周邊設備的開發環

 設計者可針對新的產品需求來加入額外的硬體模組,
或是重新燒錄 PLD 、修改嵌入式應用軟體等
 Common tools for program development
 Integrated Development Environment (IDE):
整合的圖形操作介面,以方便軟體開發,包括程式編
輯、編譯、鏈結、偵錯、下載等
 Toolchain: cross compiler, linker, loader, …
 OS and related libraries and packages

18
Cross Compiler
 Runs on host but generates code for target
 Target usually have different architecture from host.
Hence compiler on host has to produce binary
instructions that will be understood by target

19
Development
Process
 Process for creating
instructions that are
built on host but
meant for the target
 Tools are compatible
with each other
 a toolchain
 Binutils: as, ld
 Glibc : C runtime Lib
 GCC : C/C++ compiler

20
Linker/Locators
 For computers:
 Linker: creates an image file to be run on host
 Loader: loads image file into memory during run-time
 For embedded systems:
 Locater: creates a file, containing binary image or
other format, that will be copied onto target, which
run on its own (not through loader)
 It needs exact addresses beforehand
 Certain parts of program need in ROM and some
in RAM
 Normally done by dividing program in segments
 Locator needs to be told where in memory to place
segments

21
Getting Software into Target
 PROM Programmers
 Classic way – use output file to build a ROM or PROM
(if software still needs some changes)
 ROM Emulators
 Replace (emulate) ROM in the target system
 Look like a ROM with a serial port or network
connection to talk to host
 In-Circuit Emulators (ICE)
 Replace processor with an emulator for debugging
 Use overlay-memory to get software to target

22
Getting Software into Target
 Monitors
 Programs on target ROM that know how to load new
programs to the system
 Store user software sent from host through a
communications link (serial) to target RAM and run it
 Might also perform some locator and debugger
functions (setting breakpoints, checking register
values) etc. also

23

You might also like