CYCLONE-User-Manual.pdf - 第108页

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 , w…

100%1 / 149
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.
User Manual For Cyclone LC Programmers 109
6 - Starting address is not in module.
7 - Ending address is not in module or is less than starting address.
8 - Unable to open file for uploading.
9 - File write error during upload.
10 - Upload canceled by user.
11 - Error opening algorithm file.
12 - Error reading algorithm file.
13 - Device did not initialize.
14 - Error loading .PCP file.
15 - Error enabling module just selected.
16 - Specified S record file not found.
17 - Insufficient buffer space specified by .PCP to hold a file S-record.
18 - Error during programming.
19 - Start address does not point into module.
20 - Error during last byte programming.
21 - Programming address no longer in module.
22 - Start address is not on an aligned word boundary.
23 - Error during last word programming.
24 - Module could not be erased.
25 - Module word not erased.
26 - Selected algorithm file does not implement byte checking.
27 - Module byte not erased.
28 - Word erase starting address must be even.
29 - Word erase ending address must be even.
30 - User parameter is not in the range.
31 - Error during algorithm-specified function.
32 - Specified port is not available or error opening port.
33 - Command is inactive for this .PCP file.
34 - Cannot enter background mode. Check connections.
35 - Not able to access processor. Try a software reset.
36 - Invalid algorithm file.
37 - Not able to access processor RAM. Try a software reset.
38 - Initialization canceled by user.
39 - Error converting hexadecimal command number.
40 - Configuration file not specified and file prog.cfg does not exist.
41 - Algorithm file does not exist.
42 - Error in io_delay number on command line.
43 - Invalid command line parameter.
44 - Error specifying decimal delay in milliseconds.
47 - Error in script file.
49 - Cable not detected
50 - S-Record file does not contain valid data.
51 - Checksum Verification failure - S-record data does not match MCU memory.
52 - Sorting must be enabled to verify flash checksum.