38
Embedded Software 1 Dr. Richard Conway BM025 [email protected]

Embedded Software 1

Embed Size (px)

DESCRIPTION

Embedded Software 1. Dr. Richard Conway BM025 [email protected]. Aims & Objectives. - PowerPoint PPT Presentation

Citation preview

Page 1: Embedded Software 1

Embedded Software 1

Dr. Richard ConwayBM025

[email protected]

Page 2: Embedded Software 1

Aims & ObjectivesAims & Objectives

The aim of the module is to provide an introduction to embedded processor systems and applications. The main objectives are to provide the student with an overview of the architecture of a simple microprocessor, to explain the operating principles and provide a functional understanding of assembly language.

Page 3: Embedded Software 1

SyllabusSyllabus Describe what an embedded

system is. Detail application areas and examples.

Introduce a simple microprocessor architecture – Registers, buses, and memory organization and how it is used in embedded applications. Describe memory and I/O devices. Explain memory and I/O accesses.

Detail instruction machine formats, and instruction decoding. Introduce instruction sets, addressing modes, data move instructions, arithmetic instruction, stack operation and usage, Program flow control instructions, sub routines and loops.

 

Detail assembler directives and the program translation process. Review the build and load process for embedded application programs. Introduce simulation tools and debugging techniques. Introduce the monitor program and how to use it to test applications using target hardware.

Describe how to control/communicate with I/O devices through polling and interrupts. Interrupt service routines, interrupt priority, multiple interrupts, nesting.

Use practical programming examples to illustrate concepts.

Page 4: Embedded Software 1

Module EvaluationModule Evaluation

Final Exam 60% written examTerm Work 20% lab 20% midterm Lab starts week 4Repeat Exam 100% written exam

Page 5: Embedded Software 1

Module InformationModule Information

Recommended Text.“The 8051 Microcontroller”, 3rd Edition.I. Scott

MacKenzie, 1999

Available in Bookshop and Library (long term loan)

8052 tutorial available on http://www.8052.com

Page 6: Embedded Software 1

Embedded SystemEmbedded SystemComputing systems widely used today

PCs, laptops, Palm pilot, ServersEasily identifiable as computing systemsCan easily change the operation

Add programs/applicationsAdd hardware resources

Embedded SystemMicrowave, mobile phone, EMU in car, digital camera, etc…Computing system that is embedded within a device/systemMay not be obvious from the outsideOften fixed in operation Volume of sales in billions

Page 7: Embedded Software 1

Basic components of a computing system

Basic components of a computing system

All computing systems (big or small) contain CPU – brains of the system. Executes instructionsMemory – storage. Stores program (instructions) and dataInput/Output – Interaction with outside world

Communication achieved with busesGroups of signals to carry the data, address and control info

CPU Memory I/O

External System Bus

Control Address Data

Page 8: Embedded Software 1

BusesBuses

A bus is a collection of signals (wires) that are collectively referred to by a common name that identifies their common purpose

Example is the address bus. Could consist of 16 individual wires.

Rather than draw all the signals, a wider shape is used on schematics

Page 9: Embedded Software 1

Address BusAddress BusThe number of address lines that a CPU has determines the

amount of memory that can be used with the CPU*16 address lines allow 65536 (or 64K) unique address locations.For n address lines, there are 2n unique address locations

In CPU systems, the CPU supplies the address This could be the address of a memory location or an I/O device

* This is without consideration of paging and memory management (MM) techniques

CPU Memory I/O

External System Bus

Control Address Data

Page 10: Embedded Software 1

Data BusData BusThe data bus is used to transfer

data between Memory and CPUI/O devices and CPUI/O devices and Memory

The transfer can be either way, so the data bus is a bi-directional bus

Data bus size is normally a multiple of 8 bits (byte) and is usually the same size or less than the size of the CPU’s internal registers.

For example, an 8 bit processor has internal registers of size 8 bits and would have an 8 bit data bus

Clearly a bigger data bus means that more data can transferred, but this is at the cost of more pins and wider memories

High end systems usually have wide data buses that reduce the bottleneck between CPU and memory

Page 11: Embedded Software 1

Data BusData Bus

Data bus contains data on its wires!

This could be actually representInstructionsData Values

> Integers, Characters, Floating point values, etc…

Addresses> An instruction may contain

an address> E.g. JUMP 459

Page 12: Embedded Software 1

Control BusControl Bus

These signals are used to control the transfer of data between memory, I/O and the CPU

The 2 most basic are Read signal (1 wire)Write signal (1 wire)

Both are outputs from the CPUOther control signals include

Reset, interrupt and direct memory access

Page 13: Embedded Software 1

Bus cyclesBus cycles

Transfer of data occurs betweenProcessor and memoryProcessor and I/OMemory and I/O (DMA)

Bus cycles are used to perform these transfersMost common types are

Memory readMemory writeI./O readI/O write

Bus cycles are concerned with the synchronisation of the data transfer

Cover in lecture

Page 14: Embedded Software 1

Bus cycle exampleBus cycle example

CPU Memory I/O

External System Bus

Control Address Data

Memory Read bus cycleCPU outputs address CPU activates read signalMemory responds with data on data busCPU reads data and deactivates read signal

Page 15: Embedded Software 1

CPUCPU

Intel introduced the first widely used microprocessor in 1971, the 8080

A computing system could be built using the microprocessor, memory devices and I/O devices on a printed circuit board

Page 16: Embedded Software 1

CPUCPUBrains of the system

Controls what operations happen

Performs operations on dataCPU understands a finite

number of instructions Actual instructions are defined

by the instruction set for the CPU

Example instruction ADD R1,R2,R3

Register file

ALU

Control Unit

Data Section Control Section

CPU has 2 main partsControl unit

Controls and sequences themicrosteps in the fetch-decode-execute cycle of each instruction.

Datapath sectionConsists of the register file

(group of registers) and the Arithmetic Logic Unit (ALU)

Page 17: Embedded Software 1

Lecture 2

Page 18: Embedded Software 1

CPUCPUDatapath section is most

important sectionRegister file, which is a group of

registers, some of which have general purpose use and some may have specific usage

Arithmetic Logic Unit (ALU), which is logic that performs operations on data, e.g. addition, multiplication, logical OR, etc.

The Program Counter (PC) register always stores the address of the next instruction to be fetched from memory.

Register File

ALU

To Data bus

To Address bus

From Data bus

InstructionRegister (IR)

Program CounterRegister (PC)

Page 19: Embedded Software 1

CPUCPUAn instruction read from

memory is stored in the instruction register (IR) register

The control unit decodes the instruction to determine what the instruction is and what to do to execute the instruction

After the instruction is executed, the same steps are repeated, I.e

FetchDecodeExecute

Register File

ALU

To Data bus

To Address bus

From Data bus

InstructionRegister (IR)

Program CounterRegister (PC)

A series of instructions that are combined to perform a task form a program. As such the CPU operates under the control of a program

Page 20: Embedded Software 1

Register File

ALU

To Data bus

To Address bus

From Data bus

InstructionRegister (IR)

Program CounterRegister (PC)

Memory CPU

Address bus

Data bus

Read Signal

Write Signal

97

371

371

INC R0

98

Fetch

Decode

Execute

Example operation of CPUExample operation of CPU

Page 21: Embedded Software 1

MemoryMemory

Programs and data are stored in memoryTypes of computer memory include

Semiconductor, considered primary Common classification is ROM (non-volatile) and RAM

(volatile)Magnetic and optical, considered secondary

CPU communicates directly with semiconductor memory.

Page 22: Embedded Software 1

Main MemoryMain MemoryRAM

Random Access Memory that can be read from and written to. Contents are volatile, so contents are lost when power removed

This type of memory is fast. Memories for computers are rated by their capacity in bytes.

ROMRead Only Memory can only be read from.

Contents are non-volatile, so contents are NOT lost when power is removed

Also fast access

Page 23: Embedded Software 1

Abstract view of memoryAbstract view of memory

Addresses

2 n

Number of bits at each address

m

Page 24: Embedded Software 1

MicrocontrollerMicrocontroller

A device similar to the microprocessor is a microcontroller

Early example is the Intel 8748 microcontroller

The key difference is the integration of memory and basic I/O functions on a single chip and low cost

The 8051 introduced in 1980

Original 8051 had an 8-bit CPU, 4K program memory, 128 bytes of RAM and I/O functions (ports, timers and serial transmission support) all on a single chip!

Page 25: Embedded Software 1

Examples of microcontroller uses

Examples of microcontroller uses

Page 26: Embedded Software 1

Fully working 8051 system!

Fully working 8051 system!

Page 27: Embedded Software 1

MicrcontrollerMicrcontrollerMany other companies that produce other microcontollers

Microchip, Motorola, Atmel, Philips, Hitachi, etc …Differ in internal architecture, instruction set, speed, size of on-chip

memories, package sizes, I/O support, power consumption, register size, cost

Companies other than Intel make 8051 devicesPhilips, Atmel, Analog Devices, Cygnal, etc…

Despite being over 25 years old, the 8051 microcontroller is still widely used! This is due to it’s proven track record and a wide knowledge base

Unlike personal computing where increased throughput is constantly required, there are still many embedded (not all) that require a low cost and simple microcontroller

Cover in lecture

Page 28: Embedded Software 1

Microcontroller vs Microprocessor

Microcontroller vs Microprocessor

Microprocessor MicrocontrollerMicroprocessor is a single chip CPU and requires many additional devices to form working system

Microcontroller is a single chip with CPU, memory (small amount) and I/O

Medium to high cost for system Low cost for system

Application is in microcomputer systems, with operation system and application software. Software and hardware can be easily upgraded

Application is in embedded system with fixed programs and low component count (also fixed). Typically control oriented application

Instruction set and internal architecture focused for processing intensive operations and can support many addressing modes (CISC machines) and support of operating systems (OS).

Instruction set and internal architecture focused on control of I/O and efficient use of on-chip resources. This can include bit instructions.

Small amount of ROM relative to amount of RAM and secondary memory. E.g. 128K ROM, 512M RAM and 80 G Harddisk

Large amount of ROM relativeto small amount of RAM and usually no secondary memory. E.g. 32K ROM, 4K RAM

Page 29: Embedded Software 1

Appendix Week 1

Page 30: Embedded Software 1

Ad from 1970s for 8080

Page 31: Embedded Software 1

PentiumPentium

Page 32: Embedded Software 1

General Purpose Computing SystemGeneral Purpose

Computing System

Page 33: Embedded Software 1

Magnetic DisksMagnetic Disks

Types Hard disks Floppy disks Zip disks

Provide long term storage (non-volatile). A hard disk cannot normally be removed and is

fixed internally in the computer. A floppy disk and zip disk can be removed or

inserted as needed. Disks store data using magnetic media. Accessing data on these disks is much slower

than RAM. Also known as secondary storage

Page 35: Embedded Software 1

Exercises Week 1

Page 36: Embedded Software 1

ExercisesExercises1. What are the basic components of a computing

system?2. With respect to a computing system, what is a bus?3. Describe the 3 buses that are used in a computing

system.4. Using Figure 1., detail the steps that are involved in a

memory write bus cycle

CPU Memory I/O

External System Bus

Control Address Data

Figure 1.

Page 37: Embedded Software 1

ExercisesExercises

5. What is CPU an acronym for?6. What are the main sections of a CPU?7. What is the purpose of the PC register?8. What is the purpose of the IR register?9. Fill in the missing word. The CPU operates by

repeatedly performing ________, decode and execute operations.

10. What is a non-volatile memory?

Page 38: Embedded Software 1

ExercisesExercises11. What is an ALU?12. List 5 examples of embedded systems

1. In the home2. In University3. In a car

13. What are the differences between a microcontroller and a microprocessor?

14. How many components (approximately) are needed for a simple working microcontroller system