CYCLONE-User-Manual.pdf - 第107页

User Manual For Cyclone LC Programmers 107 example programming commands are at the bottom of the file. Note: The command parameter formats starting_addr , ending_addr , base_addr , and byte, word are hexadecimal by defau…

100%1 / 149
User Manual For Cyclone LC Programmers 106
1 : Divide by 4 (usually and if applicable)
9.2.2.11.4 :BAUD n
Sets the baud rate to n. Serial port connection only If :BAUD is specified, include :FORCEPASS
followed by :SECURITYCODE.
9.2.2.11.5 :FORCEPASS
Specifies that security should be passed on startup of the software instead of waiting for an EM
(Erase Module) command. The :SECURITY code command must also be provided.
9.2.2.11.6 :SECURITYCODE hh hh hh hh hh hh hh hh
Specifies the 8 bytes of security code to use at startup which correspond to the addresses $FFF6-
$FFFD of the target HC08 device. The parameter for this is a string containing 8 bytes of data in
HEX separated by white spaces.
9.2.2.11.7 :DEVICETYPE string
Specifies the target device family. As an example, the device type for a 68HC908KX8 would be
KX. The allowed device type values are:
AB,AP,AS,AT,AZ,BD,EY,GP,GR,GR4/8,GT,GZ,JB12,JB16, JB1/8,JG,JK,JL,JR,JW,KX,LB,LD,
LJ,LK,LT,LV,MR4/8,MR16/32,QB,QC,QL,QT,QY,RF,RK,SR
9.2.2.12 Connection Related - STMicroelectronics’ STM8 Processors
9.2.2.12.1 :ARCHTYPE n
Processors: STM8
Specifies the STM8 family via the numeral n, where n indicates the following:
161 = STM8S/STM8A
162 = STM8L101X
163 = STM8L15X
164 = STM8L16X
9.2.2.12.2 :COMMSMODE 0
Processors: STM8
Indicates that communications speed should be controlled automatically.
9.2.2.12.3 :FORCEPASS
Processors: STM8
If this command is present, read-out protection will be ignored, i.e. the target will be unsecured and
the programming process will continue.
If this command is missing, read-out protection will NOT be ignored. If the device is protected the
programming process will not proceed.
9.2.2.12.4 :RSTLOWPOSTSAP
Processors: All
Drives the RESET signal LOW before and after SAP operations.
9.2.3 Programming Commands
Programming Commands are the commands that will be executed during the programming
process. These are the main commands that will manipulate and verify data on your device. A list
of programming commands and their formats is included below.
See Section 9.2.1 - Sample .CFG File to view programming commands within a CFG file. The
User Manual For Cyclone LC Programmers 107
example programming commands are at the bottom of the file.
Note: The command parameter formats starting_addr, ending_addr, base_addr, and byte, word are
hexadecimal by default.
BM Blank check module.
BR starting_addr ending_addr Blank check range.
CM Choose module (algorithm) file. Note: Certain modules may require a base address to be
specified
EB starting_addr ending_addr Erase byte range.
EW starting_addr ending_addr Erase word range.
EM Erase module.
EN Blank check and erase
GO Starts device running. Can be used as final command if you want the device to run for
testing. Should be immediately preceded by an 'RE' command.
PB starting_addr byte ... byte Program bytes.
PF feature_ID starting_addr Program feature data. feature_ID must be: datestr, datetimestr,
barcodestr, or runtestdata. See Section 6.1.4.9 - Program
Feature Data.
PW starting_addr word ... word Program words.
PM Program module.
PT Program trim (devices with trim only)
RE Reset chip.
SS path Specify binary data file (S19/Elf/Hex) Path indicates file path to the binary.
VC Verify the programmed device using a checksum
VM starting_addr ending_addr Verify module.
VR starting_addr ending_addr Verify range.
VV type Verify module CRC. Type is CRC8 or CRC16.
DE timeinms - Delays "timeinms" milliseconds
9.2.4 Using Command Line Parameters Inside a .CFG File
The user may wish to make their .CFG files more versatile by inserting one or more placeholders
into the script, and then specifying the values for those placeholders later, on the command line,
when calling the CSAP executable that will references that script.
The command-line parameter /PARAMn=s can be used to insert text into a .CFG file. It can
replace any part of the script including programming commands, filenames, and parameters. n is a
numeral from 0..9, which allows you to use multiple versions of this command line parameter in a
.CFG file. s represents a string which will replace any occurrence of /PARAMn in the script file.
As an example, the following section of a .CFG script features three instances of /PARAMn=s: /
PARAM1, /PARAM2, and /PARAM3:
RE ;Reset the MCU
CM /PARAM1 ;Choose Flash Module
EM ;Erase the module
BM ;Blank Check the module
SS /PARAM2 ;Specify the S19 to use
PM ;Program the module with the S19
/PARAM3 ;Verify the module again
User Manual For Cyclone LC Programmers 108
When the user calls the CSAP executable that will reference this CFG file they will need to specify
the values of these parameters on the command line. See the example below, where the first of
these parameters is used to specify a programming algorithm (.SRP), the second an .S19 file, and
the third a programming command (VM).
CSAPACMPZ
/PARAM1=C:\PEMICRO\Freescale_MK40X256_PFlash_DFlash.ARP
“/PARAM2=C:\PEMICRO\EXAMPLE FILES\TEST.S19"
/PARAM3=VM
Note: Notice that /PARAM2 is enclosed in double quotation marks. This is because the parameter has a
space in its value (Example Files). The surrounding double quotation marks are required in this
situation, in order to indicate to Windows that it is a single parameter.
The complete example command line would be as below (note that this is one continuous line; no
line breaks):
C:\PROJECT\CSAPACMPZ C:\PROJECT\GENERIC.CFG /
PARAM1=C:\PEMICRO\Freescale_MK40X256_PFlash_DFlash.ARP “/
PARAM2=C:\PEMICRO\EXAMPLE FILES\TEST.S19” /PARAM3=VM
9.2.5 Sample Batch File
Here is an example of how to call a command-line programmer and test its error code return in a
simple batch file. Sample batch files are given for both Windows 95/98/XP and Windows 2000/NT/
XP/Vista/7/8/10.
9.2.5.1 Windows NT/2000/Vista/7/8/10:
C:\PEMicro\CYCLONE\IMAGECREATION\IMAGECREATIONSUPPORTFILES\CSA
PACMPZ.EXE C:\PROJECT\ENGINE.CFG
PORT=USB1
if errorlevel 1 goto bad
goto good
:bad
ECHO BAD BAD BAD BAD BAD BAD BAD BAD
:good
ECHO done
Note: Path names of files that are relative to the CSAP executable can also be used.
9.3 CSAP Error Returns
An Error code is returned by the Image Compiler so that a script file or an application launching the
Image Compiler can check for it. The error codes used are:
0 - Program completed with no errors.
1 - Canceled by user.
2 - Error reading S record file.
3 - Verify error.
4 - Verify canceled by user.
5 - S record file is not selected.