CYCLONE-User-Manual.pdf - 第99页
User Manual For Cyclone LC Programmers 99 HC08: CSAPMON08Z.exe MPC55XX-57XX: CSAPPPCNEXUSZ.exe RS08 : CSAPRS08Z.exe S12Z : CSAPS12ZZ.exe STM8: CSAPWIZ01.exe 9.1.2 Filename and Additional Command-Line Parameters After spe…

User Manual For Cyclone LC Programmers 98
9 SAP IMAGE COMPILER (SCRIPTED PROGRAMMING & IMAGE
CREATION)
PEmicro’s Cyclone SAP Image Compiler, or CSAP, is an essential component in the Stand-Alone
Programming (SAP) image creation process. It is designed to work in tandem with the Cyclone
Image Creation Utility, by running in the background, but it can also be called directly by the user.
The CSAP image compiler typically takes the .CFG file that was generated by the Image Creation
Utility and uses it to locate and combine all of the components that will be included in the specific
SAP image that is being created. However the user can also use a command line to submit a CFG
file and various Command-Line Parameters directly to the image compiler. This allows users to
write scripts that can automate the image creation/re-creation process.
In order for the user to do this, they will need to know what Command-Line Parameters are
available and how they are used, and what items can/must be included in a CFG file, including
Programming Commands and Configuration Commands. There is also a specific Command-Line
Parameter that allows the user to easily substitute values inside a specific CFG file. This can
enable a single CFG file to be used to create different SAP images.
9.1 Launching From the Command Line
The image compiler can be launched from the command line to create a SAP image. Below is an
example of a command-line that the user might put together, along with descriptions of its various
components.
9.1.1 Command-Line Example
Below is an example of using the command line to launch CSAP for ARM Cortex devices. The
command line specifies where to locate the .CFG file and other necessary information.
>csapacmpz.exe "C:\MyWorkspace\MyProject\KL25Z128_script.cfg" /image-
file "C:\MyWorkspace\MyProject\KL25Z128_image.sap"
Most command-line parameters can be used with any device, but some are specific to certain
architectures or device types.
9.1.1.1 CSAP Executable
The user must first specify the particular CSAP executable that is compatible with their device. See
the area of the example in green, which is specifically for ARM devices:
>csapacmpz.exe "C:\MyWorkspace\MyProject\KL25Z128_script.cfg"
/imagefile "C:\MyWorkspace\MyProject\KL25Z128_image.sap"
Below is a list of which executable corresponds to which architecture/device type.
Target Architecture / Executable Name
ARM-based devices (all manufacturers) : CSAPACMPZ.exe
MAC71XX, MAC72XX: CSAPARMZ.exe
HC(S)12(X): CSAPBDM12Z.exe
ColdFire V1: CSAPBDMCFV1Z.exe
ColdFire V2, V3, V4: CSAPBDMCFZ.exe
MPC5xx/8xx: CSAPBDMPPCZ.exe
DSC: CSAPDSCZ.exe
HCS08: CSAPHCS08Z.exe

User Manual For Cyclone LC Programmers 99
HC08: CSAPMON08Z.exe
MPC55XX-57XX: CSAPPPCNEXUSZ.exe
RS08: CSAPRS08Z.exe
S12Z: CSAPS12ZZ.exe
STM8: CSAPWIZ01.exe
9.1.2 Filename and Additional Command-Line Parameters
After specifying the executable, the user must also include the [filename] parameter, which
represents the path and filename of the .CFG file. This is shown in blue in the example below. The
user may also include one or more other command-line parameters. The area of the example in
violet shows these other command-line parameters.
>csapacmpz.exe "C:\MyWorkspace\MyProject\KL25Z128_script.cfg"
/imagefile "C:\MyWorkspace\MyProject\KL25Z128_image.sap"
9.1.3 List of Valid Command-Line Parameters
Here is the listing of valid parameters:
[executable] Specifies the particular CSAP executable that is compatible with the user’s device.
Mandatory.
[filename] A configuration file containing configuration commands and comments,
default = PROG.CFG. Mandatory.
[?] Use the '?' character option to cause the utility to wait and display the result of
configuration in the image compiler window. If the user does not use a batch
file to test error level, this provides a method to display the configuration
result. This option should be the FIRST command-line option.
[hideapp] This will cause the CSAP executable programmer to NOT display a visual
presence while running, with the exception of appearing on the taskbar. (32-
bit applications only)
[/logfile logfilename] This option opens a logfile of the name "logfilename" which will cause any
information which is written to the status window to also be written to this file.
The "logfilename" should be a full path name such as c:\mydir\mysub-
dir\mylog.log.
Note: When using Windows, if the logfilename path or filename include any white
spaces then the logfilename path and filename must be surrounded by dou-
ble quotation marks.
[/imagefile imagefilename]Used when the SAP file should be saved to disk instead of stored on the
Cyclone. This specifies the path and filename for the SAP file. A user may
later update a Cyclone with this image file.
Note: If the image path or filename include any white spaces then the image path
and filename must be surrounded by double quotation marks.

User Manual For Cyclone LC Programmers 100
[imagecontent] This command-line parameter is a string that can be used to describe the SAP
image, whether it is stored in a file or on the Cyclone. If the configuration com-
mand :DESCRIBEIMAGE is also present in the .CFG file, this will be overwrit-
ten.
[paramn=s] This is a type of command-line parameter that can be used within the .CFG
file as a placeholder for data, and this data can then be specified on the com-
mand-line. Multiple scripts can potentially reference the same .CFG file, each
specifying different data on the command-line.
The n is a numeral, which allows multiple parameters to be used within the
same .CFG file.
See Section 9.2.4 - Using Command Line Parameters Inside a .CFG File
for more information and examples.
9.2 Configuration (.CFG) File Contents
A Configuration (.CFG) file includes programming commands and the location of the binary files
and programming algorithm to be used during programming. It may also include configuration
commands and may refer to utilities that can augment the programming process, such as
serialization, or setup information for use of a bar code scanner during programming.
Because the CFG file is essential to the process of creating a SAP image, the command-line used
to call CSAP must always use the [filename] parameter to specify a .CFG file. This file will instruct
the image compiler which components will be used to create the eventual SAP image and where to
them, among other things.
9.2.1 Sample .CFG File
A .CFG file is a pure ASCII file that includes one command per line. It will always include two main
types of commands: Configuration Commands and Programming Commands. It can also include a
certain type of command-line parameter that can serve as a placeholder for some of the script
contents.
Below is a sample .CFG for NXP’s Kinetis KL25Z128 device. Lines in the file that begin with
semicolons are comment lines.
The first several lines are comments that describe some of the attributes of the programming
setup. The next several lines, which begin with a colon, are Configuration Commands that are read
before programming. The final several lines are the Programming Commands that will be executed
during the programming process.
; Automatically generated configuration file
; Silicon Manufacturer is NXP
; Silicon Architecture is ARM Based (Kinetis, LPC, etc.)
;
:ALLOWOUTOFRANGE 1
:DEVICE NXP_K7x_K70FN1M0M15
:USESWD 1
:DEBUGFREQUENCY 5560
:SAPGUIVERSION 352E3737
:PROVIDEPOWER
:POWERVOLTAGE 3.0
:POWERDOWNDELAY 250
:POWERUPDELAY 250
:KEEPPOWERON 0
:CUSTOMTRIMREF 31250.00