Вы находитесь на странице: 1из 10

How devices (modules) are programmed using PROG08.

This program, running on an IBM PC or compatible, talks to the processors


via the background debug mode using a special smart cable (ICD) or the
SPGMR or ICS board available from Motorola.
These devices connect the serial port of a PC to a standard 16 pin berg
connector on your target board. The berg connector provides access to the
MON08 signals of the appropriate processor chip mounted on
your target system hardware board. The software consists of two parts.
First is a program, PROG08S, which runs on the PC. It provides for
a set of general interface functions and six user specified functions
which are used to control the erasing, verifying, programming and viewing
of modules to be programmed. These generic functions are implemented for
a particular target configuration and chip set by a set of user supplied
routines which run on the target processor. These routines and a table of
their addresses and specific user constants are provided in a .08P file.
These special .08P files contain documentation information, tables, code
in the form of S records, and the screen setup for six user specified
functions.

You start the appropriate programmer by typing

PROG08Z n ; for Win 95/98/NT/XP version

The parameter n is either 1, 2 or 3 which stand for the serial port


you wish to use (COM1, COM2 or COM3). The default is COM1 if n is
not given and the program has not been previous run. If the application
has been run before, the last used configuration is the new default.
The PC will display a set of generic programming functions
most of which are disabled. In addition, it will automatically choose
the select .08P function. This causes the names of all the .08P files
which are in the current directory to be displayed. Use the arrow
keys to pick one and then press enter. The programmer will then be
initialized for that module. Any comments written in the .08P file
will be shown in the bottom window on your display. The .08P files can
be examined for more information using any text editor.

Any of the enabled features of your programmer can be selected using the
up and down arrow keys or typing the selection letters to the left of the
selection display. Pressing enter will execute the highlighted entry if
it is enabled. The user will be prompted for any additional information
which is required to execute the selected function. Before you can
program a module from an S record file, you must select such a file. If
you try to do a program module function and you have not selected a file,
you will be asked to select one.

Since timing is very important when programming EPROMs and EEPROMs,


PROG08 needs to know the execution speed of the target processor. The
programmer determines this by looking at the baud rate used to
communicate to the target.
The programmer then sets up constants which are provided to the
program/erase algorithms by placing them in processor registers at
startup. These constants are placed there every time a new .08P file is
selected. They should not be disturbed during the execution of user
supplied routines in the .08P files.

The table is the first part of the files which generate S records. The
origin or the table tells the PC program where the on chip RAM should be
configured during the programming process. The choice is made in a manner
which does not conflict with other things in the target system such as
the module to be programmed.

The table provides the starting addresses of user supplied routines and
necessary system values. The parameters passed to the user routines and
expected return values are listed in the help screens of the PROG08. User
routines executed on the target processor are always terminated with a
BGND instructions. This returns control to the PC when the function has
been completed or an error has occurred. If a specified routine is not
provided, a zero entry should be placed in that table location. The PC
software will detect this an not enable that function from the PC.

Each table entry consists of 32 bits (or 16 bits if SHORT_TABLE is


specified) and must be in the following order:

stack address - address of the stack during routine execution.


The stack is initialized each time one of the
user supplied routines is called.
buffer address - address of the buffer used to transfer data
from the PC to the target. This is data to be
placed into the module. The buffer should be at
least 258 bytes long in order to accommodate
the largest possible S record.
buffer length - length of available buffer space in bytes.
module address - the physical address of the beginning of the
module to be programmed or erased.
module length - length of the module to be programmed in bytes.
blank bytes address - routine to verify that a given range of bytes
has been erased. If either the blank bytes
routine or the blank words routine is provided,
then the blank module test is enable in the PC
selection menu.
blank words address - routine to verify that a given range of words
has been erased.
erase bytes address - routine to erase a range of bytes. Many modules
(chips) do not have this feature.
erase words address - routine to erase a range of words. Many modules
(chips) do not have this feature.
erase module address - routine which erases the entire module.
program bytes address - routine to program a block of bytes which have
been transferred to the buffer in the target by
the PC. Either this routine or the program
words routine should be provided or the program
module function will not be enabled on the PC
screen.
program words address - routine to program a block of words which have
been transferred to the buffer in the target by
the PC. If this routine is provided and program
bytes is not, the PC can still program bytes
since it knows how to program bytes in terms of
programming words.
on volts address - routine to turn on the programming voltage to
the module to effect an erase or program
function. If the programming voltage is left on
all the time, then this routine should be
implemented only as a BGND instruction. If no
routine is provided, then the user is asked to
turn on the voltage.
off volts address - routine to turn off the programming voltage to
the module. If the programming voltage is left
on all the time, then this routine should be
implemented only as a BGND instruction. If no
routine is provided, then the user is asked to
turn off the voltage.
enable address - routine to set up the programming process. This
routine is called once after a .08P module is
selected and each time a command is executed.
It is used to do things such as set up chip
selects, turn devices on, etc. The chip can be
set up using commands (such as WRITE_WORD) in
the .08P file, however, these commands are only
done when a .08P file is selected.
disable address - routine to provide a graceful shutdown of any
target resources. Usually not required.
before read address - routine which is called before reading data
from a module. Not required in most cases.
after read address - routine which is called after reading data from
a module. Not required in most cases.
user function address - optional routines (and table entries) to
provide an arbitrary user functions if as
specified in the .08P file. (See section on
USER function).

The .08P files consist of four parts: comments, s records, up to six user
specified functions, and a set of setup commands which are listed below
under SETUP COMMANDS. Lines in the file which start with an 'Sn' are
considered to be s records. S1, S2 and S3 records are allowed. S7, S8 and
S9 termination records are ignored. The address field on the first S
record detected in the file is used as the starting address of target RAM
used by PROG08.

USER SPECIFIED FUNCTION

There can be up to six user specified functions specified in a .08P file.


Each user statement in the .08P file must have a corresponding address in
same order the table part of the S-records and an appropriate set of
code. A line which defines a user specified programming function has a
total of 57 characters in the form:

USER=uuuuuuuuuuuuuuuuuuuuuunpppppppppp/llllllll/uuuuuuuu/
where

USER= is the keyword to identify the line


uuuuuuuuuuuuuuuuuuuuuu is the 22 character string placed in the
selection menu window on the PC screen. The
first few characters define the menu select
function and should be unique.
n is one numeric digit between 0 and 4. If it is
zero, the program will not ask for a user
parameter. If it is nonzero, the user will be
asked for a parameter with n hexadecimal digits.
This parameter will be passed to the
corresponding user routine in RAM.
pppppppppp is the 10 character prompt used to solicit the
user input parameter.
/ is required for error checking.
llllllll is an 8 hex character lower bound on the user
parameter.
uuuuuuuu is an 8 hex character upper bound on the user
parameter.

SETUP COMMANDS

Setup Commands are used to initialize the target CPU when it is not
possible to do so using the enable function which must first be loaded
into target ram before execution. Setup commands appear alone on a
separate line of the .08P file starting in column one. All setup
commands must appear before the first S record in the .08P file or they
will be ignored.

The setup commands are:

BLANK_MODULE_ONLY - This command has 17 characters. It indicates to the


programer that if a blank byte address or blank word
address is provided they can only be used to enable
a blank module command.
SHORT_TABLE
- This command has 11 characters. It indicates to the
programmer that the algorithm table has 16 bit
entries as opposed to the normal 32 bit entries. It
is used to save space when only a small RAM is
available.

BLOCKING_MASK=mmmmmmmm/
- This command has 23 characters. First it tells the
programmer that only full blocks of data can be
programmed into the device and that blocks must
occur on a block boundary. The mask mmmmmmmm is
used to select those address lines which occur
within a block. For example, blocks of 8 bytes
would have a mask of 00000007. The buffer provided
in the target must in size be an integral multiple
of the blocking size in bytes.
SET_TIMING=nn/
- This command has 14 characters and tells the
programmer that at the end of executing
an enable, it should calculate nn timing parameters.
Enable passes back an address in ix which points to
the timing parameters in target RAM. The number in
each timing word (stored by enable) is multiplied by
a 10 microsecond timing constant and stored back in
the same location.

ADDRESS_PAGING=mmmmmmmm/oooooooo/
- This command has 33 characters and tell the
programmer that some form of address paging is
being used. Under these circumstances, the function
BEFORE_READ must set up the paging configuration
address. The masm mmmmmmmm is used to determine
which bits of the address represent the page
address so that page changes can be detected. The
actual address read is calculated by prog as
(address and not(mmmmmmmm)) + oooooooo.
DELAY=nnnn/ - Causes a delay of nnnn (decimal) milliseconds before
continuing to process the rest of the programming
algorithm header. This can be used to allow a clock
change time to stabilize or a Vpp voltage to rise.
NO_BASE_ADDRESS
or
NO_BASE_ADDRESS=bbbbbbbb/
- The 15 character command version tells the
prog software to use a base address of 0 and not
to ask the user to enter one.
the 25 character version is the same except it
sets the base address to bbbbbbbb.

NO_ON_CHIP_RAM - This command has 14 characters and tells the


programmer not to turn on the on chip ram. You must
provide ram to run the calibration routines and
load your .08P file S records. If not deactivated by
this command, the on chip RAM is turned on after all
other setup commands are executed.

NO_TIMING_TEST
- This command has 14 characters and tells the
programmer not to evaluate the target processor
speed during the initialization process. Instead,
both timing constants are set to 1. This option is
only used when programming timing functions are not
needed.

WRITE_LONG=llllllll/aaaaaaaa/
- This command has 29 characters. It writes the hex
long llllllll to the hex address aaaaaaaa in the
current space.
WRITE_WORD=wwww/aaaaaaaa/
- This command has 25 characters. It writes the hex
word wwww to the hex address aaaaaaaa in the
current space.

WRITE_BYTE=bb/aaaaaaaa/
- This command has 23 characters. It writes the hex
byte bb to the hex address aaaaaaaa in the current
space.

SRECORD_SECTION_MASK=/aaaaaaaa/
- Especially on smaller devices, there may not be
enough RAM to hold the entire algorithm. The
algorithm can be split into different sections
which get loaded when required for a particular
routine. The way they are split is to change the
higher order address bits according to each
section. The SRECORD_SECTION_MASK is used to mask
off these bits while loading to ram, and also to
determine which part of the srecord to load for
different algorithms. Note that the enable MUST be
in the page with the table.

Example:

SRECORD_SECTION_MASK=/FFFF0FFF/ ; This is the mask to use


Table : $0050-$0090 ; Enable = $100
; Program_module =$110E
; Erase Module $2100
Enable Srecord : $0100-$0155
Program Srecord: $1100-$1220
Erase Srecord : $2100-$2190

On startup, only srecords who match mask XXXX0XXX would be loaded.


Whenever any routine is called from the main application, and the routine
isn't in the current block, The algorithm srecord is reloaded. The only
records which match the following criterion are loaded
(S19_RECORD_ADDRESS and NOT SRECORD_SECTION_MASK) = (ADDRESS_OF_ROUTINE
and NOT SRECORD_SECTION_MASK)

ADDR_RANGE=aaaaaaaa/bbbbbbbb/
- Normally the valid flash range is set by the
module_length constant in the algorithm which the
programmer then uses to decide how to display memory
in the code window. If not all memory between
module_address and module_address+module_length is
valid, this command can be used to override the
default functionality and describe to the programmer
what is valid memory which should be displayed and
changed. Note that these addresses are relative to
the base address of the flash. aaaaaaaa is the start
address relative to the base address and bbbbbbbb is
the end address relative to the base address.
REQUIRES_PROG_VERSION=x.xx/
- Sometimes algorithms will require features to be
built into the P&E flash programmer itself. If the
algorithm requires a minimum version number of the
programmer, use this command. The interactive
programmer will give the user a warning if the
programmer version is not greater than or equal to
the version referenced in this command. The
commandline programmer will halt with error 14.
BOUNDARY_MASK=mmmmmmmm/
- This command has 23 characters. It indicates to the
Programmer that when buffering data down to the
target, the data may not cross certain boundaries.
If a value of $FFFFFF80 was used, this would
indicate to the programmer that only 128 byte
sections may be programming at once (aligned on 128-
byte boundaries). This does not mean that the whole
128 bytes need to be programmed, only that
the flash programmer will split the data up to be
programmed in chunks which never cross a certain
boundary. This is very useful for paged memory, or
to adhere to block programming requirements of
certain motorola flash.
SET_SP=0000aaaa/ - Sets the algorithm stack pointer to be aaaa. The is
useful since often the stack pointer is in the
center of the RAM map.

CRC_KEEPOUT_RANGE=aaaaaaaa/bbbbbbbb/
- This command allows the user to specify an address
range that will be ignored when performing the
module CRC calculation. By default TRIM Ranges are
automatically ignored. For devices that have paging
memory, the user must define an unpaged range and
the equivalent paged range. This command must be
preceded by a NO_BASE_ADDRESS=bbbbbbbb command.
aaaaaaaa is the start address relative to the base
address and bbbbbbbb is the end address relative to
the base address.

COMMENTS

Any other lines in the .08P file are considered comments. If the .08P
file is selected, these comments are shown in the window at the bottom of
the PC screen. Comments are ususally place in the file to identify the
target system for which the .08P file was written and what module on the
target system it programs.

CPU08 .08P FILES

08P files define the functions necessary to program an EPROM or


EEPROM attached to a CPU08 family processor using the PROG08
program. Currently, 08P files contain Motorola S record lines
and comment lines. Any line starting with an "S" in column 1
is considered an S record. All other lines are comments. The
S records are loaded into on chip RAM on the CPU08 and provide
the functions necessary to carry out the functions specified
below. All other records are written to the screen when that
08P file is selected for programming. 08P files must have the
DOS file name extension ".08P" in order for PROG08 to find them.
The files are in ASCII and are thus readable using most text
editors. The S records for a 08P file can be generated using
most any assembler. The sample source file "xxxxxx.ASM" shows
the structure necessary to produce the S records of a 08P file.
It is a structured file which contains a table of essential
system constants and routine addresses. This table is followed
by the definitions of the routines. Register and memory usage
conventions must be followed when your insert your own set of
routines. Any routine which can not or need not be provided is
given a zero (0) address in the table. The table, routines,
stack and buffer reside in the CPU on chip RAM during the
execution of PROG08.

The table contains the following long word (32 bit) entries in
exactly the order listed. In addition, the table is assembled
at the starting address at which the on chip RAM will be
configured during execution of PROG08. Furthermore, the table
must be the first thing assembled to insure that it is the
first S record in the .08P file. The entries in the table are:

NAME FUNCTION

____________ ________________________________________________

STACK The address of the top of the stack used by any


of the execution routines.

BUFFER The address of the buffer which holds either


bytes of words to be programmed into the
modules.

BUFFER_LENGTH The length of the buffer in bytes. This buffer


should contain at least 258 bytes.

MODULE The address at which the module is physically


addressed. During execution, the user specified
base address is translated to the module
address. Thus, the module need not have the
addresses at which the user code/data is
programmed.

MODULE_LENGTH The length of the module being programmed in


bytes.

BLANK_BYTES The address of a routine to check a block of


bytes to see if they are erased. Word (sp+2)
contains the starting address, and word (sp+4)
contains the number of bytes to check. Checking
is done on a byte by byte basis. If (sp+4)<>0 on
return then an error occured at word address
(SP+4)-1.

BLANK_WORDS The address of a routine to check a block of


words to see if they are erased. Word (sp+2)
contains the starting address, and word (sp+4)
contains the number of bytes to check. Checking
is done on a word by word basis. If (sp+4)<>0 on
return then an error occured at word address
(SP+4)-2.

ERASE_BYTES The address of a routine to erase a block of


bytes. Word (sp+2) contains the starting address,
and word (sp+4) contains the number of bytes to
check. Checking if done is on a byte by byte basis.
If (sp+4)<>0 on return then an error occured.

ERASE_WORDS The address of a routine to erase a block of


words. Word (sp+2) contains the starting address,
and word (sp+4) contains the number of bytes to
check. Checking if done is on a word by word basis.
If (sp+4)<>0 on return then an error occured.

ERASE_MODULE The address of a routine which erases the entire


module. Word (sp+2) contains the starting address,
and word (sp+4) contains the number of bytes to
check. Checking if done on a word by word or a
byte by byte basis. If (sp+4)<>0 on return then an
error occured.

PROGRAM_BYTES The address of a routine which programs a block


of bytes residing in the buffer. Word (sp+4) contains
the length of the block in bytes. Word (sp+2) contains
the starting address at which they are to be
programmed. Returning with h:x non zero indicates
an error.

PROGRAM_WORDS The address of a routine which programs a block


of words residing in the buffer. Word (sp+4) contains
the length of the block in bytes. Word (sp+2) contains
the starting address at which they are to be
programmed. Returning with h:x non zero indicates
an error.

VOLTAGE_ON The address of a routine which turns on the


voltages necessary to program/erase the
module. If this routine does not exist, the
user will be prompted to turn the voltages on.

VOLTAGE_OFF The address of a routine which turns off the


voltages necessary to program/erase the
module. If this routine does not exist, the
user will be prompted to turn the voltages off.

ENABLE The address of a routine which sets up and


enables the module at startup. Returning with
h:x <> 0 indicates an error.

DISABLE The address of a routine which shuts down the


module.

BEFORE_READ The address of a routine which sets up the


module to do a read. Word (sp+2) contains
the address to be read.

AFTER_READ The address of a routine which takes the


module out of read mode.

USER_FUNCTION These are the optional user functions. They


are created with USER= statements in the 08P
file and corresponding address as an extra
address in the table. On entry, word (sp) is
buffer_pointer, (sp+2) is module_address, h:x
is user parameter. On return, if h:x <>0 an
error occured.

Вам также может понравиться