Title: Quick example
1SE 746-NT Embedded Software Systems
Development Robert Oshana Lecture
4 For more information, please
contact NTU Tape Orders NTU Media
Services (970) 495-6455
oshana_at_airmail.net
tapeorders_at_ntu.edu
2Reference book
3Reference book
4Lecture 4
5Understand the big picture
- Embedded systems designers will work with many
different hardware systems - At first only a general knowledge is required
- Read the Users guide of Programmers Guide
- May not have this for custom H/W
6Understand the big picture
- What is the overall purpose of the board?
- How does data flow through it?
- May want to create a data flow diagram
- Block diagrams are also helpful
- Refer to it throughout the project
7DFD for a printer sharing device
ROM (256K)
Serial Port A
computer
Zilog 85230 Serial Controller
Intel 80188EB Processor
Parallel port
Data bus
I/O Bus
printer
Address bus
Serial Port B
computer
RAM (128K)
8Examine the landscape
- Things that the processor can communicate with
- Memories
- Peripherals
- Peripherals specialized hardware devices that
coordinate interaction with the outside world
(I/O) or perform a specific hardware function - Serial ports
- timers
9Examine the landscape
- Address spaces
- Memory space mainly for memory devices
- I/O space reserved for peripherals
- When a peripheral is located within the memory
space, it is called a memory-mapped device - Look and act like memory devices (from processor
point of view)
10Examine the landscape
- Peripherals have specialized functions
- Interpret data as a command to do something
- Data to be processed in some way
- Embedded developers prefer memory mapped
peripherals - I/O space can be eliminated (cost)
- Programmer can use pointers, data structures,
unions to interact with peripherals more easily
11Memory map
- Embedded processors store programs and data in
memory - Also in external memory chips
- Located in processors memory space
- Communicate via address/data bus
- Write address on the bus
- transfer data over the bus
- Create a memory map
12Memory map a processors address book
FFFFFh E0000h C0000h 72000h 70000h 20000h
00000h
EPROM (128K)
Flash memory (128K)
Unused
Zilog SCC
Unused
SRAM (128K)
13Header files
- Create a header file that describes the boards
most important features - Abstract interface to the hardware
- Can refer to the various locations by name
instead of address - Application software more important
- Change affected lines of the board-specific
header file and recompile
14Header file for Arcom board
- /
-
- Memory map
-
- Base address Size Description
- ---------------------------------
- 00000000h 128K SRAM
- 200000000h Unused
- 700000000h Zilog SCC
Registers - 700001000h Zilog SCC
Int. Ack - 700002000h Unused
- C00000000h 128K Flash
- E00000000h 128K EPROM
-
- /
- define SRAM_BASE (void ) 0x00000000
- define SCC_BASE (void ) 0x70000000
- define SCC_INTACK (void ) 0x70001000
15I/O map
- Repeat the memory map for the I/O space
- Typically a large part of the I/O space will be
unused because most of the peripherals there will
have only a handful of registers
16I/O map a processors address book for
peripherals
Chips that control the parallel port and the
debugger port reside outside the
processor. Ports are used to communicate with
printer and host based debugger
FFFFh FF00h FE00h FD00h FC00h 0000h
Peripheral control block
Unused
Parallel port
Debugger port
Unused
17Header file for I/O peripherals
- /
-
- I/O map
-
- Base address Description
- ---------------------------------
- 0000h Unused
- FC00h SourceVIEW
Debugger port - FD00h Parallel I/O
Port - FE00h Unused
- FF00h Peripheral
Control Block -
/ - define SVIEW_BASE 0xFC00
- define PIO_BASE 0xFD00
- define PCB_BASE 0xFF00
18Learn how to communicate
- Two basic communication techniques
- Polling
- Interrupts
- Processor issues a command to the device by using
the memory and I/O space - Then wait for the device to complete the command
- Ask the timer to count down from 1000 to 0
19Polling
- are we there yet?
- Processor repeatedly checks to see if the task
has been completed - A large amount of time is spent performing this
checking - Wastes a lot of processor cycles
20Polling
Do // play game, read, listen to music,
etc. .. // poll to see if were there
yet status areWeThereYet() while (status
NO)
21Interrupts
- Interrupt is an asynchronous electrical signal
from a peripheral to the processor - Processor still issues commands to the processor
- Then waits for an interrupt to signal completion
of the assigned work - Free to continue doing other things
22Interrupts
- When interrupt occurs, processor stops what its
doing and executed a small piece of code called
an ISR - Programmer must write the ISR
- Programmer must install it and enable it to be
executed when the right interrupt occurs - Interrupts generally decrease the complexity of
the code and make it more structured
23Interrupts
- Interrupts are used when efficiency is paramount
or multiple devices must be monitored
simultaneously - Polling is used when the processor must respond
to some event more quickly than is possible using
interrupts
24Interrupt map
- Each interrupt has an interrupt pin and an ISR
- A mapping must exist between interrupt and ISR
- This is called an interrupt vector table
- Array of pointers to functions
- Processor uses the interrupt type (a unique
number associated with each interrupt pin) as its
index into the array
25Interrupt map
- Must initialize the interrupt vector table
correctly (or the wrong mapping will happen, if
at all) - Create an interrupt map that organizes the
relevant information
26Interrupt map
27- /
-
- Interrupt map
-
/ - /
- Zilog 85230 SCC
- /
- define SCC_INT 8
- /
- on-chip timer/counters
- /
- define TIMER0_INT 8
- define TIMER1_INT 18
- define TIMER2_INT 19
- /
28Get to know the processor
- Most processors look and act pretty much the same
if you are writing in C or C - Assembly language is a different story
- Look in the databooks
29Processors in general
- Most of the common processors are members of
families - Processor
- Microprocessors
- Microcontrollers
- Digital signal processors
30Microprocessor
- Chip that contains a powerful CPU that has not
been designed with any particular computation in
mind - Foundation of personal computers and high-end
workstations - Motorola 68K
- 80x86
31Microcontroller
- Similar to a microprocessor
- Designed specifically for use in embedded
applications - Contain CPU, small amount of RAM, ROM or both,
other peripherals on the same integrated circuit - Reduces cost of embedded systems
- Intel 8051, Motorola 68HCxx
32Digital signal processor
- Specially designed to perform discrete-time
signal processing calculations - Audio and video calculations very fast
- Powerful low cost alternative for designers of
modems and other telecommunications and
multimedia equipment - TMS320Cxx and 5600x
33SE 746-NT Embedded Software Systems
Development Robert Oshana 10 minute
break For more information, please
contact NTU Tape Orders NTU Media
Services (970) 495-6455
oshana_at_airmail.net
tapeorders_at_ntu.edu