Anda di halaman 1dari 171

7465468

REV B PAGE A

CONTROLLED DOCUMENT

14NOV2002

() TITLE: ST40 LOADER AND COMMAND LANGUAGE REFERENCE MANUAL TYPE : MSSRDI (PRODUCT DATASHEETS) ******************************************************************************** Copyright STMicroelectronics Unauthorised reproduction and communication strictly prohibited ******************************************************************************** NOTICE: This document may have been revised since it was printed. Check Document Control System for latest version before using or copying ******************************************************************************** REV: B RELEASED: 14NOV2002 CHANGE DESIGNATOR: DOCUMENT CHANGE This document incorporates the comments made on the previous revision. There should be no reason to reject this document, however, you can approve it with comments if required. Suzanne Burton 11 November 2002 APPROVAL HISTORY 11NOV2002 12NOV2002 11NOV2002 12NOV2002 14NOV2002 ELAINE SNARY (BRISTOL, UK) SUZANNE BURTON (DVD DOCUMENTATION,BR) ANTONY KING (MICRO CORE DEV TOOLS) RHYS LANKESTER (DVD DOCUMENTATION,BR) RAY MOGFORD (DVD MARKETING,BR)

7465468

REV B CONTROLLED DOCUMENT 14NOV2002 PAGE B ******************************************************************************** Copyright STMicroelectronics Unauthorised reproduction and communication strictly prohibited ******************************************************************************** NOTICE: This document may have been revised since it was printed. Check Document Control System for latest version before using or copying ******************************************************************************** No References

7465468

REV B CONTROLLED DOCUMENT 14NOV2002 PAGE C ******************************************************************************** Copyright STMicroelectronics Unauthorised reproduction and communication strictly prohibited ******************************************************************************** NOTICE: This document may have been revised since it was printed. Check Document Control System for latest version before using or copying ******************************************************************************** CUSTOM ATTRIBUTES St_title Change designator Status Cycle type Dispatcher Working Vault Replication sites Classification Technology Group Division Mask set design rev Originator ST40 LOADER AND COMMAND LANGUAGE REFERENCE MANUAL DOCUMENT CHANGE ACTIVE ACTIVE SNARYE BRI EXTERNAL MCDT ANTONY KING

EX TE

RN

Last updated 30 October 2002

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

ST40 Loader and Command Language Reference Manual


EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 1/168

ii

Issued by the MCDT Documentation Group on behalf of STMicroelectronics

The ST logo is a registered trademark of STMicroelectronics.

EX TE

STMicroelectronics Group of Companies Australia - Brazil - Canada - China - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - U.S.A. http://www.st.com

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

SuperH is a registered trademark for products originally developed by Hitachi, Ltd. and is owned by Hitachi Ltd. Windows and WindowsNT are registered trademarks of Microsoft Corporation in the United States and/or other countries. Sun and Solaris are trademarks of Sun Microsystems, Inc. in the US and other countries. Linux is a registered trademark of Linus Torvalds. Red Hat is a registered trademark of Red Hat Software, Inc. 1998, 1999, 2000, 2001, 2002 STMicroelectronics. All Rights Reserved.

EX

TE

RN

Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of STMicroelectronics.

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 2/168

Preface

RN AL

EX

TE

Contents

RN AL
v
v v

Document identification and control Notation

ST40 target loader


1.1 1.2 1.3 1.4 Introduction User interface
1.2.1

TE

EX

Examples

AL

Startup scripts

Special variables

RN

Interfacing to a target

TE

EX

2.1 2.2

Introduction Defining target hardware


Overview of target definition Supplied backends

AL

2.2.1 2.2.2

EX TE

RN

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX
1
1 2
5

9 10
11 15

TE
5 6

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 3/168

iv

Loading Linux
3.1 3.2 Introduction Procedures
3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 BootLinuxKernel ConfigureLinuxKernel ConfigureLinuxOptions LoadLinuxKernel LoadLinuxImage Examples

RN AL TE EX

3.3.1

Examples

RN AL

3.3

Command line

A B

List of commands Command language


B.1 B.2 Introduction
B.2.1 B.2.2 B.2.3 B.2.4 B.2.5 B.2.6 B.2.7

TE

EX

Command language basics


Language format Comments Operators Output formats Input formats Command language objects Command language constructs

AL

AL

Revision history Index

EX

B.3 B.4

TE

Command language syntax Alphabetical list of commands

RN

RN

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

EX
17
17 17
18 19 20 21 21 21

23
23

27 31
31 32
32 32 32 34 34 35 41

44 49

155 157

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 4/168

Document identification and control


This manual carries a unique identifier in the form: ADCS nnnnnnnx Where,

nnnnnnn is the document number and x is the revision.

Notation

Syntax definitions are presented in a modified Backus-Naur Form (BNF). Briefly:

EX TE

RN

4 Each phrase definition is built up using a double colon and an equals sign to separate the two sides. 5 Alternatives are separated by vertical bars (|).

AL

3 If a non terminal string of the language starts with a non italicized part, it is equivalent to the same non terminal string without that non italicized part. For example, vspace-name.

EX

2 Nonterminal strings of the language, that is, those built up by rules of the language, are printed in italic teletype font. For example, name.

TE

1 Terminal strings of the language, that is, those not built up by rules of the language, are printed in teletype font. For example, void.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

Whenever making comments on this document the complete identification should be quoted.

TE

RN AL

EX

TE

Preface

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 5/168

vi

6 Optional sequences are enclosed in square brackets ([ and ]). 7 Items which may be repeated appear in braces ({ and }).

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 6/168

1.1 Introduction

Host

AL

EX

TE

st40load provides a facility to configure an ST40 target platform and then download and run code on the platform over an ethernet network using an ST Micro Connect interface adaptor connected to the UDI connector of the board.

RN AL

EX TE

RN

st40load is supplied with configuration scripts for each of the supported ST40 target platforms and scripts for the loading and configuration of various applications. The only application explicitly supported by st40load in this way at present is Linux (see Chapter 3: Loading Linux on page 17).

AL

st40load may be used purely from the command line or a combination of the command line and interactively. The command line interface for st40load is described in Section 1.2: User interface.

EX

The scripting language and the commands accepted by st40load are described in Appendix B: Command language on page 31.

TE

Figure 1: Interfacing over ethernet with ST Micro Connect

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Ethernet Network

ST Micro Connect

EX

ST40 target loader

TE

1
ST40 Target

Debug Port

STMicroelectronics ST40 Loader and Command Language Reference Manual

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 7/168

User interface

1.2 User interface


The st40load command line is as follows: st40load {options}* [--] [arguments] where:

options is a list of zero or more of the options given in Table 1. You may enter options in any order, separated by spaces or combined. arguments are the arguments to be passed onto the target application which are stored in a string by the _ST_st40load_arguments command language variable (see Section 1.4: Special variables on page 6). -- indicates that the remainder of the command line should be passed as arguments to the target application instead of being interpreted as st40load options.

-b exeFile

RN

-d level -e elfFile

TE

-I cmdFile

AL

EX

-i cmdFile

EX TE

RN

Table 1: st40load command line options

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

AL

EX

Option

TE

The syntax of the st40load command line conforms to that accepted by the widely available C library function getopt (see getopt(3)).
Description

Download the application executable file exeFile onto the connected target and set the PC register to the executable entry point. The format of the executable file may either be ELF or S-record.

Set the command language information level to level. Download the ELF executable file elfFile onto the connected target. This option may be multiply specified. Execute the command language program in the script file cmdFile in batch mode. This option may be multiply specified. Note that the script file is executed before the target is connected (see Table 2: st40load option evaluation order). Execute the command language program in the script file cmdFile in batch mode. This option may be multiply specified. Note that the script file is executed after the target is connected (see Table 2).

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 8/168

User interface

Option -l libPath

Description

Add the directory libPath to the directory search list for script files. This option may be multiply specified. Do not autorun the application and instead operate st40load in interactive mode (see Interactive mode on page 4). Execute the command language program in command. This option may be multiply specified. Connect to the target target as defined by a target command. Verify the loading of executables. Wait for a key before terminating. Only valid in batch mode. Download the binary image file imageFile at the address address onto the connected target. Note that there must be no white space around the comma between address and imageFile.

-n

-p command

-t target

-v -w -z address,imageFile

-V

Table 1: st40load command line options

The order the options to st40load are evaluated and their equivalent command language commands are listed in Table 2.
Option -d level -l libPath -I cmdFile

RN

AL

EX

Display st40load version information.

TE

TE

clinfo level directory libPath include cmdFile connect target load -nocheckimage elf elfFile load exeFile loadimage address imageFile

-e elfFile

EX TE

RN

-b exeFile -z address,imageFile

AL

-t target

EX

Table 2: st40load option evaluation order

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

STMicroelectronics ST40 Loader and Command Language Reference Manual

RN AL

EX

Command

TE

RN AL

EX

TE
3

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 9/168

User interface

Option -i cmdFile -p command include cmdFile parse command

Command

Table 2: st40load option evaluation order

Note:

If no options or arguments are specified then st40load shows brief help information. Otherwise st40load may be used in one of two modes. Interactive mode Interactive mode is invoked using the -n command line option. In interactive mode, st40load displays the command language prompt (>) and waits for keyboard input after processing the command line options. Batch mode is the default if the -n command line option is not specified. In this mode the -t command line option is mandatory. In batch mode st40load terminates after processing the command line options unless the -w command line option is specified (in which case st40load waits until a key is pressed before terminating).

Batch mode

_ST_st40load_bootfile,

_ST_st40load_imageaddr,

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

_ST_st40load_imagesize,

_ST_st40load_verifyload.

AL

_ST_st40load_imagefile,

EX

_ST_st40load_arguments,

TE

The following command language variables are set as a result of specifying the various st40load command line options (see Section 1.4: Special variables on page 6):

RN

AL

EX

TE

RN AL

If the -n option is not specified then st40load invokes the run command (see run on page 128) as the final step before terminating.

EX

If the -v option is specified then the load commands issued by st40run as a result of specifying the -b and -e options are amended to include the -verify option (see load on page 95).

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 10/168

Startup scripts

1.2.1 Examples

After connecting to the target sh4, the following command line loads the application vmlinux-2.4.5, starts the target and then terminates. st40load -t sh4 -b vmlinux-2.4.5

One or more startup command language scripts can be executed automatically on starting up st40load. On starting up, st40load normally executes the scripts listed below before processing any command line arguments. If they exist, the following command language scripts are executed, in the order shown below. 1 The st40load.cfg command language script file in the stdcfg sub-directory of the st40load installation directory. st40load.cfg normally includes the script files containing the commands for describing each of the target platforms supported by st40load and to define some standard command language variables used by these scripts (see Section 2.2: Defining target hardware on page 10). 2 For Red Hat Linux/Solaris 2.x: The .st40loadrc command language script file in the home directory (identified by the HOME environment variable). .st40loadrc should be used to contain the target commands defining the available targets (see Specifying the target on page 14).

RN

EX TE

AL

For Windows NT: The st40load.rc command language script file in the home directory (identified by the HOME environment variable, or if not present the combination of the HOMEDRIVE and HOMEPATH environment variables). st40load.rc should be used to contain the target commands defining the available targets (see Specifying the target on page 14).

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

1.3 Startup scripts

EX

st40load -t sh4 -i vmlinux.cfg

TE

After connecting to the target sh4, the following command line executes the commands in the script file vmlinux.cfg, starts the target and then terminates.

RN AL

EX

TE
5

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 11/168

Special variables

3 For Red Hat Linux/Solaris 2.x:

For Windows NT:

The command language is described in Appendix B: Command language on page 31.

1.4 Special variables


_ST_st40load_arguments

st40load sets various command language variables depending on its command line.

_ST_st40load_bootfile

The command language variable _ST_st40load_bootfile is set to the string which is the executable file name parameter of the -b option to st40load.

_ST_st40load_imagefile
The command language variable _ST_st40load_imagefile is set to the string which is the binary image file name parameter of the -z option to st40load.

_ST_st40load_imageaddr
The command language variable _ST_st40load_imageaddr is set to the integer value which is the binary image load address parameter of the -z option to st40load.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

The command language variable _ST_st40load_arguments is set to the string which is the result of the concatenation of the tokens (space separated) passed as the arguments to st40load.

TE

RN AL

EX

TE

The st40load.rc command language script file in the directory in which st40load was invoked.

RN AL

The .st40loadrc command language script file in the directory in which st40load was invoked.

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 12/168

Special variables

_ST_st40load_imagesize

The command language variable _ST_st40load_imagesize is set to the integer value which is the size in bytes of the binary image file parameter of the -z option to st40load.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

The command language variable _ST_st40load_verifyload is set to the integer value 1 if the -v option is passed to st40load otherwise it is undefined.

TE

_ST_st40load_verifyload

RN AL

EX

TE
7

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 13/168

Special variables

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 14/168

2.1 Introduction

the type of the target,

the target memory organization,

EX TE

RN

AL

EX

This chapter also describes how to use the st40load command language to create target descriptions and how to associate these descriptions with specific instances of these targets. Standard target descriptions are defined by st40load on startup from the standard command language script st40load.cfg (see Section 1.3: Startup scripts on page 5).

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

the initialization sequence for the target.

AL

the name of backend DLL with which to interact with the target,

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

To load and run an application on a target, st40load needs to know the following about the target:

TE

st40load connects to targets via a target specific backend DLL (Dynamic Linked Library). st40load supports ST40 silicon connected to the UDI port, and interfaced to the host via an ST Micro Connect interface adaptor.

RN AL

EX

Interfacing to a target

TE

2
EX

RN AL

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 15/168

10

Defining target hardware

2.2 Defining target hardware

Command processor type chip type memory name address size type sysregister name -set value reset -r [-hard]

RN AL

The commands listed in Table 3 are normally used in st40load command language configuration procedures to describe the type and memory organization of ST40 target platforms and the initialization of these target platforms. These configuration procedures are usually invoked as part of the connect sequence to a target platform by specifying them in the target commands defining targets.

Define the core type of the chip. Define the type of the chip.

EX

Table 3: Target configuration commands

The startup script st40load.cfg (see Section 1.3: Startup scripts on page 5) declares a set of command language procedures which describe the standard set of ST40 target platforms supported by st40load, which are listed in Table 4.
Chip ST40RA166 ST40RA166 ST40RA166

TE

RN

AL

Platform

TE

Define a memory segment on the target. Write to a memory mapped register. Reset the target.

EX

EX

ST40STB1-ODrive Board ST40RA166 HARP Board

db457_setup mb293_setup mb360_setup mb350_setup mb317a_setup

AL

ST40RA-EVAL Board ST40RA166 Extended HARP Board ST40GX1-Demo Evaluation Board Rev. A

EX TE

RN

ST40RA166 ST40GX1

Table 4: Standard target platforms

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

TE

Before you can connect to a target platform, it needs to be defined. This involves defining the target platforms name, the name of the corresponding backend DLL, the core type, the memory organization and the configuration of the memory mapped registers appropriate for the target (for example, the EMI and PLL register settings).

Description

RN AL
Procedure

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 16/168

Defining target hardware

Chip ST40GX1 ST40GX1

Platform ST40GX1-Demo Evaluation Board Rev. B STMediaRef-Demo Board

Procedure mb317b_setup

mediaref_setup

Table 4: Standard target platforms

Command target targname dllname arguments [procname]

Table 5: Target definition commands

These commands are fully documented in Appendix B: Command language on page 31.

2.2.1 Overview of target definition


A target platform configuration typically includes the following commands: the core type of the chip, defined by a processor command (see processor on page 118), the type of the chip, defined by a chip command (see chip on page 53), the size, type and location of memory and memory mapped devices on the target platform, each segment defined by a memory command (see memory on page 101), configuration of memory mapped registers by sysregister commands (see sysregister on page 142), Note: poke commands (see poke on page 116) may also be used in the configuration of memory mapped registers but should not be used in preference to sysregister commands. a reset command to reset the target (see reset on page 123).

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

Define a target.

EX

The commands listed in Table 5 are used in st40load command language scripts to define the targets available to st40load. Typically these commands are placed in the startup script .st40loadrc (see Section 1.3: Startup scripts on page 5).
Description

TE

RN AL

EX

TE
11

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 17/168

12

Defining target hardware

Example configuration

An example describing the configuration of an ST40 evaluation board is illustrated below using the following configuration procedures. proc ST40_RA166_memory_define { ## Configuration registers on memory FMI_regs 0x07f00000 memory LMI_regs 0x0f000000 memory PCI_regs 0x17000000 memory ST_regs 0x1b000000 ## Configuration registers in memory STOREQ_data 0xe0000000 memory ICACHE_addr 0xf0000000 memory ICACHE_data 0xf1000000 memory ITLB_addr 0xf2000000 memory ITLB_data1 0xf3000000 memory ITLB_data2 0xf3800000 memory OCACHE_addr 0xf4000000 memory OCACHE_data 0xf5000000 memory UTLB_addr 0xf6000000 memory UTLB_data1 0xf7000000 memory UTLB_data2 0xf7800000 memory CORE_regs 0xfc000000

eval ST40_RA166_memory_define }

RN

proc mb360_LMI_configure { sysregister SYSCONF_SYS_CON2[0] -set 0x0000b900 sysregister LMI_MIM -set 0x04000281 sysregister LMI_STR -set 0x00001b4f

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

AL

EX

TE

proc ST40_RA166_define { processor ST40 chip ST40STB1

RN

AL

P4 0x04000000 0x01000000 0x01000000 0x01000000 0x00800000 0x00800000 0x01000000 0x01000000 0x01000000 0x00800000 0x00800000 0x04000000

RN AL

EX

TE

EX

SuperHyway 0x00100000 0x01000000 0x01000000 0x01000000

(via P2) DEV DEV DEV DEV

TE

DEV DEV DEV DEV DEV DEV DEV DEV DEV DEV DEV DEV

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 18/168

Defining target hardware

proc mb360_memory_define { memory Flash 0x00000000 (16 * M) ROM memory LMI_SDRAM 0x08000000 (32 * M) RAM } proc mb360_setup { eval ST40_RA166_define eval mb360_memory_define reset -r -hard

eval ST40_RA166_si_regs le eval mb360_LMI_configure

processor type

2 The chip type is defined:

RN

EX TE

AL

where type is st40.

chip type

where type can be ST40GX1 or ST40STB1.

EX

1 The processor core type is defined:

TE

sysregister CCN_CCR -set 0x0000090b

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

sysregister sysregister sysregister sysregister sysregister sysregister sysregister sysregister sysregister sysregister sysregister

LMI_SDRA0 LMI_SDRA1 LMI_SCR LMI_SCR LMI_SCR LMI_SDMR0 LMI_SDMR1 LMI_SCR LMI_SCR LMI_SCR LMI_SCR

-set -set -set -set -set -set -set -set -set -set -set

0x0a001400 0x0a001400 0x00000003 0x00000001 0x00000002 0x00000190 0x00000190 0x00000004 0x00000004 0x00000004 0x00000000

TE

RN AL

EX

TE
13

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 19/168

14

Defining target hardware

3 The memory segments are defined: memory name address size type

where name is a unique segment name, address is the base address, size is the size in bytes and type is RAM, ROM or DEV. Note: address is a real physical address and not an ST40 P-region address.

5 The target memory mapped registers are configured:

where name is the name of the memory mapped register and value is the value to be written to the register. Note: The names of the memory mapped registers and their locations are defined by evaluating the configuration procedure ST40_RA166_si_regs (see sysregister on page 142 for further details). The device memory regions are defined by evaluating the configuration procedure ST40_RA166_memory_define.

Specifying the target

The syntax of the target command is: target targname dllname arguments [procname] targname is the name given in the connect command (see connect on page 60) to define a target st40load may use. Each target may be defined with any number of names, and any number of targets can share the same name. If a shared target name is specified in a connection then the first free target with that name is selected.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

dllname is the name of the backend DLL. st40load ignores this parameter since st40load is pre-configured to use the ST40 silicon backend DLL (see ST40 silicon in Section 2.2.2).

AL

EX

TE

RN

AL

The target command is used by st40load to declare a target name and associate it with a backend DLL and target configuration procedure.

EX

TE

RN AL

sysregister name -set value

EX

4 The target is then initialized with the reset command. The reset command results in the memory system and register contents of the target being initialized to their power-on values.

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 20/168

Defining target hardware

procname is a string specifying a command language program which is evaluated (see parse on page 111) after st40load has connected to the target (via the connect command).

ST40 silicon
-big to specify a big endian target.

The backend DLL name is bkends4si. Possible options for arguments are:

-little to specify a little endian target.

Example

target st40 bkends4si -little -linkspeed 312.4KHz -ip STMC01 mb360_setup This defines an ST40 silicon little endian target called st40 with a debug link speed of 312.4 kHz connected to the ST Micro Connect called STMC01.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

-linkspeed to specify the debug link speed to be one of the following speeds: 20 MHz (the default), 10 MHz, 5 MHz, 2.5 MHz, 1.25 MHz, 625 kHz, 312.4 kHz, 156.25 kHz, 78.125 kHz, 39.062 kHz, 19.531 kHz, 9.765 kHz, 4.882 kHz, 2.441 kHz, 1.22 kHz, 610.3 Hz.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-ip ipAddressOrName to specify the network address of the ST Micro Connect interface which may be by name or by IP address.

TE

RN AL

EX

This section defines the backends supplied as standard with st40load. For each backend DLL, the possible values for the arguments parameter to the target command are specified.

TE

2.2.2 Supplied backends

RN AL

arguments is a string which specifies the configuration options for the backend DLL the interpretation of which varies according to the dllname parameter.

EX

TE
15

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 21/168

16

Defining target hardware

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 22/168

3.1 Introduction

BootLinuxKernel,

ConfigureLinuxOptions,

EX TE

RN

LoadLinuxKernel, LoadLinuxImage.

AL

ConfigureLinuxKernel,

EX

The vmlinuxprocs.cfg command language script defines the following command language procedures:

TE

3.2 Procedures

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

These command language procedures can be used in conjunction with the command line options of st40load to allow the user to modify the default behavior of these procedures. The application of the st40load command line options for the downloading of Linux kernels is described in Section 3.3: Command line on page 23.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

In order to provide the user with a simple interface to download and configure Linux kernels the st40load software package is distributed with the command language script vmlinuxprocs.cfg which declares several command language procedures for this task. The script vmlinuxprocs.cfg can be found in the installation area under the directory stdcfg. These command language procedures are described in Section 3.2.

TE

RN AL

EX

Loading Linux

TE

3
EX

RN AL

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 23/168

18

Procedures

3.2.1 BootLinuxKernel
BootLinuxKernel [arguments]

Load and configure a Linux kernel and optionally load a Linux image:

where arguments is an optional string containing the Linux kernel command line configuration options. The configuration options set by BootLinuxKernel is the string resulting from the concatenation of the st40load command line arguments (derived from the command language variable _ST_st40load_arguments, see Section 1.4: Special variables on page 6) with arguments. The BootLinuxKernel command language procedure combines the command language procedures ConfigureLinuxKernel, ConfigureLinuxOptions, LoadLinuxKernel and LoadLinuxImage into a simple interface for downloading and configuring a Linux kernel (and an optional associated Linux file system RAM disk image) in cooperation with the command line options of st40load. Note: BootLinuxKernel assumes that the Linux kernel executable is an ELF executable and that the base address of the memory area in which the configuration parameters for the Linux kernel are stored is the address of the empty_zero_page symbol in the ELF symbol table of the executable.

EX

TE

The command language variables listed in Table 6 should be assigned to provide the necessary defaults to the BootLinuxKernel command language procedure if the corresponding command line options of st40load have not been supplied:
Variables -b exeFile -z address,imageFile Option

_ST_default_linux_image

RN

_ST_default_linux_image_addr Table 6: BootLinuxKernel default variables

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

AL

_ST_default_linux_kernel

RN

AL

EX

TE

RN AL

EX

TE

RN AL

The command language procedure BootLinuxKernel is expected to be the standard means for the downloading and configuration of Linux kernels. The other command language procedures should only be required for non-standard Linux kernels.

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 24/168

Procedures

If the -z command line option is not specified to st40load then BootLinuxKernel only calls LoadLinuxImage if a default (from the command language variables _ST_default_linux_image and _ST_default_linux_image_addr) is defined. Example

3.2.2 ConfigureLinuxKernel
Set the Linux kernel configuration parameters: ConfigureLinuxKernel configAddr where configAddr is the base address of the memory area in which the configuration parameters for the Linux kernel reside.

EX TE

RN

The following configuration parameters are set by ConfigureLinuxKernel for the Linux kernel. Mount the root file system as read-only. Enabled (parameter set to 1).

Options for the loading of a RAM disk. Disabled (parameter set to 0).

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

which loads and configures the Linux kernel vmlinux-stb1overdrive with the Linux file system RAM disk image from the file initrd.img (loaded at the address 0x8d000000) and setting the Linux kernel command line configuration options: console, root, ramdisk_size, ip and mem.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

BootLinuxKernel \ console=ttySC0,115200 \ root=/dev/ram \ ramdisk_size=4096 \ ip=ipaddresses \ mem=32m

TE

RN AL

_ST_default_linux_kernel = vmlinux-stb1overdrive _ST_default_linux_image = initrd.img _ST_default_linux_image_addr = 0x8d000000

EX

Example of BootLinuxKernel to load a Linux kernel configured to use a RAM disk:

TE

RN AL

If the -b command line option is specified to st40load then BootLinuxKernel calls ConfigureLinuxKernel instead of LoadLinuxKernel with the default (from the command language variable _ST_default_linux_kernel).

EX

TE
19

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 25/168

20

Procedures

The location (relative to the Linux kernel) and size (in bytes) of a Linux file system RAM disk image in memory. Optional; enabled if either the -z command line option to st40load is specified or the LoadLinuxImage procedure is invoked (either directly or indirectly via BootLinuxKernel). If the -z command line option is specified then the location and size are obtained from the _ST_st40load_imageaddr and _ST_st40load_imagesize command language variables, see Section 1.4: Special variables on page 6. ConfigureLinuxKernel should only be invoked after the Linux kernel has been downloaded since the memory area in which the configuration parameters reside is zero initialized during the download of the kernel executable. Note: If LoadLinuxKernel is invoked to download the Linux kernel then ConfigureLinuxKernel is automatically invoked by LoadLinuxKernel.

ConfigureLinuxOptions configAddr [arguments]

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

As for ConfigureLinuxKernel, ConfigureLinuxOptions should only be invoked after the Linux kernel has been downloaded.

TE

The configuration options set by ConfigureLinuxOptions is the string resulting from the concatenation of the st40load command line arguments (derived from the command language variable _ST_st40load_arguments, see Section 1.4: Special variables on page 6) with arguments.

RN

AL

where configAddr is the base address of the memory area in which the configuration parameters for the Linux kernel reside and arguments is an optional string containing the Linux kernel command line configuration options.

EX

Set the Linux kernel configuration options:

TE

3.2.3 ConfigureLinuxOptions

RN AL

EX

TE

RN AL

The major and minor device identifier for the root file system. Enabled (parameter set to 0x200).

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 26/168

Procedures

3.2.4 LoadLinuxKernel
Load and configure a Linux kernel: LoadLinuxKernel configAddr exeFile

3.2.5 LoadLinuxImage

Load a Linux file system RAM disk image and configure the Linux kernel: LoadLinuxImage configAddr imageAddr imageFile where configAddr is the base address of the memory area in which the configuration parameters for the Linux kernel reside, imageAddr is the address at which the image should be loaded and imageFile is the name of the Linux binary image file. LoadLinuxImage should only be invoked after the Linux kernel has been downloaded.

Examples illustrating the use of the following command language procedures: ConfigureLinuxKernel, ConfigureLinuxOptions, LoadLinuxKernel, LoadLinuxImage.

EX TE

Note:

RN

to implement the equivalent of BootLinuxKernel to download and configure a Linux kernel with and without a Linux file system RAM disk image.

All the examples assume that neither the -b or -z command line options of st40load are specified and instead only the above command language procedures are used.

AL

EX

TE

3.2.6 Examples

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

ConfigureLinuxKernel is automatically invoked by LoadLinuxKernel with the argument configAddr. Also, if the _ST_st40load_verifyload command language variable is set to 1 (see Section 1.4: Special variables on page 6) then the load of the executable file is verified (see load on page 95).

EX

TE

where configAddr is the base address of the memory area in which the configuration parameters for the Linux kernel reside and exeFile is the name of the Linux kernel executable file.

RN AL

EX

TE
21

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 27/168

22

Procedures

Example 1

LoadLinuxKernel 0x82001000 vmlinux-stb1overdrive ConfigureLinuxOptions 0x82001000 \ console=ttySC0,115200 \ root=/dev/nfs \ nfsroot=/opt/hardhat/devkit/sh/sh4/target \ ip=ipaddresses \ mem=32m Note:

0x82001000 is the base address of the Linux kernel configuration parameters memory area and is usually the address of the empty_zero_page symbol in the ELF symbol table. ipaddresses is the IP address configuration for the primary network interface of the Linux kernel.

LoadLinuxKernel 0x82001000 vmlinux-stb1overdrive LoadLinuxImage 0x82001000 0x8d000000 initrd.img ConfigureLinuxOptions 0x82001000 \ console=ttySC0,115200 \ root=/dev/ram \ ramdisk_size=4096 \ ip=ipaddresses \ mem=32m

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

Downloading and configuring a Linux kernel with a Linux file system RAM disk image:

TE

Example 2

RN AL

EX

TE

RN AL

Downloading and configuring a Linux kernel without a RAM disk image and instead configuring the Linux kernel to mount its file system over NFS:

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 28/168

Command line

3.3 Command line

The command line options of st40load may be used to replace one or more of the procedures described in Section 3.2: Procedures on page 17. However, the command line options are normally used in cooperation with these procedures to modify and augment their normal operation. The following are the command line options of st40load which may be specified for the downloading and configuring of a Linux Kernel: -b exeFile -p command -z address,imageFile

plus any arguments to st40load (see Section 1.2: User interface on page 2). Note: The -b command line option is incompatible with the LoadLinuxKernel command language procedure and the -z command line option is incompatible with the LoadLinuxImage command language procedure. However both command line options are compatible with the BootLinuxKernel command language procedure since BootLinuxKernel is sensitive to these options being specified (see Section 3.2.1: BootLinuxKernel on page 18).

Note:

These examples use the -p command line option of st40load to invoke the procedure required to complete the configuration of the Linux kernel.

EX TE

RN

AL

EX

TE

All the examples assume that the vmlinuxprocs.cfg command language script file has already been included (for example by the standard startup script file .st40loadrc, see Section 1.3: Startup scripts on page 5).

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Examples illustrating the use st40load command line options in conjunction with the command language procedures described in Section 3.2: Procedures on page 17.

AL

3.3.1 Examples

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
23

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 29/168

24

Command line

Example 1

Note:

sh4 is the name of the target system onto which to download the Linux kernel and ipaddresses is the IP address configuration for the primary network interface of the Linux kernel. Example 2

Invoking st40load to download and configure a Linux kernel with a Linux file system RAM disk image: st40load -t sh4 \ -b vmlinux-stb1overdrive \ -z 0x8d000000,initrd.img \ -p BootLinuxKernel \ console=ttySC0,115200 \ root=/dev/ram \ ramdisk_size=4096 \ ip=ipaddresses \ mem=32m

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

st40load -t sh4 \ -b vmlinux-stb1overdrive \ -p BootLinuxKernel \ console=ttySC0,115200 \ root=/dev/nfs \ nfsroot=/opt/hardhat/devkit/sh/sh4/target \ ip=ipaddresses \ mem=32m

TE

RN AL

Invoking st40load to download and configure a Linux kernel without a RAM disk image and instead configuring the Linux kernel to mount its file system over NFS:

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 30/168

Command line

Example 3

Note:

The BootLinuxKernel command language procedure should always be invoked in preference to ConfigureLinuxKernel and ConfigureLinuxOptions unless: the Linux kernel executable is not an ELF executable, the ELF symbol table is missing from the Linux kernel executable, the location of the Linux kernel configuration parameters memory area is not the address of the empty_zero_page symbol in the ELF symbol table (see Section 3.2.1: BootLinuxKernel on page 18).

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

st40load -t sh4 \ -b vmlinux-stb1overdrive \ -z 0x8d000000,initrd.img \ -p ConfigureLinuxKernel 0x82001000 \ -p ConfigureLinuxOptions 0x82001000 \ console=ttySC0,115200 \ root=/dev/ram \ ramdisk_size=4096 \ ip=ipaddresses \ mem=32m

EX

TE

RN AL

Invoking st40load to download and configure a Linux kernel with a Linux file system RAM disk image and instead invoking the ConfigureLinuxKernel and ConfigureLinuxOptions command language procedures:

EX

TE
25

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 31/168

26

Command line

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 32/168

The following table lists the available commands in alphabetical order. Information for each of the commands is provided in the specified section of the manual.
Command #line Summary See #line on page 50 addhelp on page 51 cd on page 52 chip on page 53 clerror on page 55 clinfo on page 57 clsymbol on page 58 connect on page 60 cpumemory on page 62 cputype on page 65 directory on page 66 disconnect on page 67

Set command language line number and filename Add help to a specific procedure Change directory

addhelp cd chip clerror

Define or display the chip type of a target

clinfo

clsymbol

EX

connect

AL

cpumemory cputype

RN

directory disconnect

EX TE

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Define command language behavior on error Set the level of command language debugging information Display command language variables, procedures and commands Connect to a target Display contents of physical memory Display the core CPU type Add a directory to the search space Disconnect from a target Table 7: Alphabetical list of commands

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

List of commands

TE

A
RN AL EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 33/168

28

Command dllpath dump elfsymbols

Summary Manage the DLL search path Dump the contents of memory to a file Display symbol table of an ELF32 executable file Invokes a named command language procedure or command

See

dllpath on page 68 dump on page 69

elfsymbols on page 71

eval

event fappend fclose feof fgets fopen forcewhen fputs fread fwrite getenv help include load

Force execution of an events when clauses

EX

Close an opened file Test for end-of-file Read a line from a file Open a file

RN AL

Append a list of strings to a file

TE

Write a string to a file

EX

Force execution of an events when clauses

Write a list of strings to a file

AL

Read a value from a file into a variable

RN

Get the value of an environment variable Display help associated with a command Include a command language script file Load connected target with an ELF32 or SRECORD19 executable Load connected target with a binary image Log the output of commands to a file Manage memory regions of a target Write a string to a memory location Table 7: Alphabetical list of commands

TE

EX

loadimage

AL

log

RN

memory memcpy

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

TE

eval on page 73 event on page 74 fappend on page 76 fclose on page 78 feof on page 79 fgets on page 80 fopen on page 82 forcewhen on page 84 fputs on page 86 fread on page 88 fwrite on page 90 getenv on page 91 help on page 92 include on page 93 load on page 95 loadimage on page 97 log on page 99 memory on page 101 memcpy on page 100

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 34/168

Command memset

Summary Write a repeating value to continuous memory locations Make a list of directories Convert a string to a number Convert a number to a string Rename a file Parse and execute a program Manage the path mappings

See

memset on page 103 mkdir on page 105

mkdir mknum mkstr mv parse pathmap peek plugin poke processor pwd quit remove reset rewind rm rmdir run

EX

RN AL

Read a value from a memory location Manage the plugin tools

Define the core CPU type of a target Display the current working directory Exit st40load

TE

Write a value to a memory location

EX

Remove a named object Reset the current target

AL

RN

Move the file pointer to the start of the file Remove a list of files Remove a list of directories Run a loaded program Specify run time system to use Manage the system options Set the default output format and mode Display all user defined procedure names Table 7: Alphabetical list of commands

TE

EX

runtime set

AL

setomode

RN

showprocs

EX TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

STMicroelectronics ST40 Loader and Command Language Reference Manual

TE

mknum on page 106 mkstr on page 108 mv on page 110 parse on page 111 pathmap on page 112 peek on page 113 plugin on page 115 poke on page 116 processor on page 118 pwd on page 119

quit on page 120 remove on page 121 reset on page 123 rewind on page 125 rm on page 126 rmdir on page 127 run on page 128 runtime on page 130 set on page 131 setomode on page 133 showprocs on page 135

RN AL

EX

TE
29

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 35/168

30

Command site

Summary Send a back end specific command to the current site Sleep for a period of time Specify the start state Display the definition of a target Execute a host system command Manage memory mapped registers Manage the targets

See

site on page 136

sleep startstate status sys sysregister target token when

sleep on page 137

EX

RN AL

Select a token from a string

Setup commands to be executed on event occurrence Display a list of strings

TE

write

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

Table 7: Alphabetical list of commands

TE

startstate on page 138 status on page 140 sys on page 141 sysregister on page 142 target on page 147 token on page 149 when on page 151 write on page 153

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 36/168

B.1 Introduction

The st40load command language provides an interface to control the st40load features. This section describes the general features of the language and the programming constructs. When running code, the command language provides: specification of the target platform, its memory configuration and startup configuration (for example, programming of EMI and PLLs), the generation of customized inspection and alteration commands. The st40load command language supports several programming constructs to enable users to create customized functionality. The syntax and semantics are similar to a subset of C.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

Command language

TE

B
RN AL EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 37/168

32

Command language basics

B.2 Command language basics


B.2.1 Language format

{ command1 command2 command3 } and

are equivalent.

B.2.2 Comments

B.2.3 Operators

All C-like operators on variables are supported, including: relational operators: == (is equal to), != (is not equal to), >, >=, <, <= arithmetic operators: +, -, *, /, % (remainder), >>, << pre- and post-increment and decrement: ++, - logical operators: && (and), || (or), ! (not)

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

bitwise operators: & (and), | (or), ^ (exclusive or), ~ (not)

+=, -=, >>=, <<=, &=, !=, ^=, *=, \= and %=

AL

EX

TE

RN

AL

Comments are introduced with two hash signs (##). Anything following the ## up to the end of the line is ignored by the command interpreter.

EX

TE

{ command1; command2; command3 }

RN AL

EX

TE

The command language is not free format. New lines may be inserted only after a command, construct, an opening brace ({) or closing brace (}) or after the procedure name in a procedure definition. A set of commands can be sequenced by enclosing the commands in braces. The end of a command is either a new-line or a semicolon.

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 38/168

Command language basics

+ String concatenation, simply works like strcat().

- Removes the second string from the first, if present. If the second string is not a substring in the first, the first is left unchanged.

EX TE

RN

AL

Compound versions of all binary string operators also work, for example, +=, -=, >>=, <<=, /=, %=, *= do the same as above but with assignment.

EX

| This copies characters from one string into spaces in another, for example, 1 3 5 7 9 | 2 4 6 8 returns 123456789, and one one | +++++++ returns one+one.

TE

& This selects characters from one string based on non-space characters in another, for example, 1234567890 & x x x x x returns 1 3 5 7 9 . Any leading spaces are trimmed off the result, so lament & eeee returns amen.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

* This takes an input string and a regular expression string, and returns any match of the regular expression in the input, for example, hello world * e.*r returns ello wor. Operators supported are: [^-]^$*?+.()|\.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

~, ! These flip and lower the case of alphabetic characters in strings respectively, for example, ~hElLo WoRlD returns HeLlO wOrLd, and !Lower Me returns lower me.

TE

/, % These chop the tail or head of a string off respectively, given a substring at which to cut, for example, hello world / wor returns hello , chop.me % . returns me. The substring is always part of the string removed, so is never in the resulting string. If the substring is empty, the string is returned unchanged, for example, foobar / returns foobar.

RN AL

<<, >> These take a string and an integer, for example, hello world << 5, and return a specified number of characters from the head/tail of the string, for example hello world << 5 returns hello, glove >> 4 returns love. If more characters are asked for than are present, the whole string is returned.

EX

TE

Relational operators: == (is equal to), != (is not equal to), >=, <, <=

RN AL

The operands must be separated from the operator by spaces. Some operators may also be used with string variables.

EX

TE
33

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 39/168

34

Command language basics

B.2.4 Output formats


st40load can display data in several formats. Decimal numbers

Decimal numbers are output using conventional notation, for example, 42. Decimal numbers are also entered in this format. Hexadecimal numbers are output preceded by 0x, for example, 0x80000A70. Hexadecimal numbers are also entered in this format. Octal numbers are output preceded by 0, for example, 01234. Octal numbers are also entered in this format. Binary numbers are output preceded by 0b, for example, 0b1010. Binary numbers are also entered in this format.

Hexadecimal numbers

Octal numbers Binary numbers

B.2.5 Input formats Numbers

Strings

Example: to write ## in a string escape the second # thus:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

> write Title #\# enter title !! Title ## enter title !!

AL

EX

A string may be enclosed in quotation marks (), and must be enclosed in quotation marks if it contains spaces. Inside quoted strings, the back slash character (\) is interpreted as the escape character, as in C quoted strings. Thus \n is a new line character, \t is a tab character, \\ is the back slash character, and \33 is the character with ASCII octal code 33.

TE

RN

AL

The command language supports 64 bit integer data. Thus data is input using either decimal, hexadecimal, octal or binary formats. The command language does not currently support floating-point values.

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 40/168

Command language basics

B.2.6 Command language objects Literal integers

Literal integers may be written in several formats as described in Section B.2.5: Input formats.

Arguments

This can produce surprising results for the programmer used to C syntax. For example: > proc addtwo { $$ = $1 + 2 } > x = addtwo (8) + 7 > write (x) 10

Arguments to commands and procedures are normally passed as strings (see Strings on page 34). If an argument is enclosed in parentheses (), the command language attempts to evaluate it as an expression yielding an integer, before passing it as an argument. If the parameters are omitted the expression is passed as a string. For example:

EX TE

RN

> x = 3 > write x x > write (x) 3

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

> proc addtwo { $$ = $1 + 2 } > x = (addtwo (8)) + 7 > write (x) 17

AL

Here the + 7 is treated as an extra unused argument to addtwo. This can be avoided as follows:

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

The arguments of a command or procedure consist of all the text following the command or procedure name up to the next statement terminator. This may be a comma, a new-line or a right bracket () or }) corresponding to a left bracket before the function call.

EX

TE

RN AL

EX

TE
35

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 41/168

36

Command language basics

For example: > x = 4 > write (x=, x) x=4 > write (x=, x) syntax errorwrite (x=, x) ^ > write (x=10, x) 10 10

Filenames

Variables

A variable is created and its type decided when it is assigned. Local variables may be defined and initialized in a procedure definition, or in a when statement. Variables may be removed using the remove command.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

The command language supports three kinds of variables; scalars, structures and arrays. A variable name consists of a sequence of alphanumeric characters starting with an alphabetic character.

RN

AL

A full or relative path name for the file may be supplied. Inside quoted strings, the back slash character (\) is interpreted as the C escape character. For this reason, MS-DOS-style path names must not be enclosed in quotes ().

EX

Filenames may be supplied as arguments to some commands. A simple filename with no path may be supplied for files in the current directory for the tool. The current directory may be changed using the cd command and output by the pwd command.

TE

RN AL

EX

TE

RN AL

The command language also accepts comma separated lists of arguments within parentheses, analogous to the normal C function calling syntax. In this case, each argument is treated as if it were enclosed in its own set of parentheses.

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 42/168

Command language basics

Scalars There are two types of scalar variables; strings and integers.

An integer variable can be assigned any expression yielding an integer. For example:

Scalars can change their type freely between string and integer, simply by assigning them an expression of the other type. For example: > x = 1048576 > y = foobar > x = y > write (y) foobar

To remove a scalar variable simply use remove name. For example: > remove x Structures

> mystruct.value = 5

EX TE

RN

> remove mystruct.value Entire structures can be deleted using remove structurename. For example: > remove mystruct

AL

Element names can be any valid variable name. Structure elements can be deleted using remove fullelementname. For example:

EX

An element of a structure is defined simply by assigning to it. For example:

TE

The command language supports structures of variables using C-like syntax. An element of a structure is denoted by the name of the structure followed by a point (.) followed by the name of the element, for example, date.day.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

> x = hello world > y = hello + world

EX

String variables are assigned with a quoted string or an expression yielding a string. For example:

TE

> x = 4 > y = 16 + x

RN AL

EX

TE
37

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 43/168

38

Command language basics

Note:

The order in which the elements are listed is undefined. Arrays

The entire array can be deleted with the syntax remove arrayname[]. The trailing square brackets are optional. For example: > remove myarray > remove myarray[]

An arrays elements and their values can be listed just like those of a structure, using write arrayname. For example: > myarray[0] = 123 > myarray[foo] = 234 > write (myarray) foo=234 0=123

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

> remove myarray[foo] > remove myarray[1234]

TE

Individual array elements can be removed using remove elementname. For example:

RN AL

The command language supports arrays of variables using C-like syntax. Any expression that evaluates to a string or integer can be used as a subscript, for example myarray[i+1], myarray[foo]. Space is allocated for an element of the array when that element is first assigned to.

EX

TE

> mystruct.member1 = the quick > mystruct.member2 = brown fox > write (mystruct) member1=the quick member2=brown fox

RN AL

A structures elements and their values can be listed with the write command, using the syntax write structure. For example:

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 44/168

Command language basics

Multi-dimensional arrays

> foo[0][0] = 42 > foo[0][1] = 24

It should be noted that a sub-array is just another element within the parent array. This can be seen more easily if the write command is used on a multi-dimensional array:

EX TE

RN

> myarray = [6, 23, 41, 7] > write (myarray[1]) 23

AL

An array literal is a set of values within square brackets, for example, [7, 5, 3, 1], and can be used in any place that a normal array can be used. The position of a value determines its index, so element 1 in the array literal [5, 4, 3] is 4. For example:

EX

Array literals

TE

> foo[0] = 1 > foo[1][0] = 9991 > foo[1][1] = 9992 > foo[2] = 2 > write (foo) 0=1 1=<array> 2=2 > write (foo[1]) 0=9991 1=9992

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

This means an array can contain a mixture of arrays and scalar variables. This allows code such as:

RN AL

> bar[0][0] = 10 > bar[0][1] = 20 > write (bar) 0=<array>

EX

TE

RN AL

Command language arrays can contain other arrays, resulting in a variable that functions just like a C multi-dimensional array. As with all variables, the elements are created when they are assigned to. For example:

EX

TE
39

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 45/168

40

Command language basics

> myarray = [foo => 99, bar => 100] > write (myarray) foo=99 bar=100

Named and unnamed elements may be mixed in the same array literal. For example: [1, 2, foo => 3, 4]

Type conversion
> x = hello world + 3

Expressions are type checked at run time. For example:

> > > >

n s x y

= = = =

3 3 5 + (mkstr (n)) 5 + (mknum (s))

assigns the variable x to be the string value 53 and y to the integer value 8.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

results in an error. To convert to a string or an integer the builtin commands mkstr and mknum are provided. For example:

RN

AL

EX

> myarray = [1, 2, 3, [4, 5, 6], 7] > write (myarray) 0=1 1=2 2=3 3=<array> 4=7

TE

RN AL

Array literals can also contain array literals, just as arrays can contain arrays. For example:

EX

TE

RN AL

Elements of an array literal may optionally be named by prefixing the value with a string expression and the => operator. For example:

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 46/168

Command language basics

B.2.7 Command language constructs Conditionals

A conditional command can be achieved using an if construct. The if construct can take an else. if (condition) command [else command]

Loops
while (condition) command

for (command1; condition; command2) command3 This for loop executes command3 until the condition is zero. The command1 is executed once before the condition is tested for the first time and the command2 is executed before the condition is tested but after the command3 is executed on each iteration of the loop. command1 and command2 are optional. Note: command3 can be a command sequence (see Section B.2.1: Language format).

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

The while loop executes the command until the condition is zero. Note that command can be a command sequence (see Section B.2.1: Language format on page 32).

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

Loops can be achieved using a while or for construct.

TE

RN AL

if (condition) { commands } else { commands }

EX

The condition is true if its value is non zero. Note that command in the if or else clause can be a command sequence (see Section B.2.1: Language format on page 32):

TE

RN AL

EX

TE
41

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 47/168

42

Command language basics

Procedures

Procedures can be defined to enable new commands to be created. The syntax for defining a procedure is: proc name localVariablesList { commandList }

declares x, y and z as local variables in the procedure xyz.

Arguments and return values


Arguments can be passed to a procedure, and are referenced using $1, $2 and so on. If arguments are passed, they are always passed by value; that is, a unique copy is made for the procedure to use that exists only in the scope of the procedure. The number of arguments supplied to the procedure is available in the pseudo variable $#. The list of arguments can be referenced using the pseudo variable $*. An argument may be specified using the value of a variable; for example if the variable i had the value 4, the expression $(i) would be equivalent to $4. When an argument is used in an operation that requires an integer (for example, x = $4) the argument is considered to be an integer expression and is evaluated when it is referenced. It is an error to use an argument in an integer operation when the value of the argument is not an integer expression.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

The type of an argument is evaluated when it is referenced. Run time errors occur if an argument is invalid in its context. For example, if a procedure is executed that contains the line: > x = $4 + 20

AL

EX

TE

RN

AL

EX

TE

proc xyz x = 3; y = write write write }

2; z = (x=, (y=, (z=,

1 { (x)) (y)) (z))

RN AL

EX

This defines a procedure called name which is equivalent to commandList. localVariablesList is a sequence of variable declarations that declare variables that are local to the procedure. A global variable of the same name as a local variable cannot be accessed locally. Variable declarations in the list are separated by semicolons (;) and each declaration consists of the variable name optionally followed by = and an initial value. For example:

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 48/168

Command language basics

error-illegal operation on type(s): (string) + (int)

Any kind of value can be returned from a procedure by assigning to the pseudo variable $$.

Invoking procedures

A procedure is invoked by the name of the procedure followed by its actual arguments, as follows:

Procedures may be invoked recursively.

Using such calls, a builtin command, such as run, can be used in a command language program where a procedure would be used. Each actual parameter to a procedure is a string. If a string with spaces or tabs is to be passed to a procedure then the string must be enclosed by double quotes (). If a string is to be evaluated before being passed to a procedure then that string should be bracketed. For example, the value of the variable k may be passed to a procedure called enter as follows: > enter (k)

> enter k

> enter (k)

Argument semantics are the same for invoking both procedures and commands.

EX TE

RN

AL

EX

TE

If the string (k) is to be passed to enter then the command should be:

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

If, however, the string k is to be passed to enter then the command should be:

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

name actualArgument1 actualArgument2 ...

EX

TE

RN AL

and $4 evaluates to a string, the following message is output and execution of the procedure stops:

EX

TE
43

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 49/168

44

Command language syntax

Include files

A command language script can read in from a file, called a command file, and can contain any command language construct or command. A command file may be used as a means for customizing the command language or executed as a startup routine. A command file can be executed on demand or included in another command file using the include command (see include on page 93): include fileName

EX TE

toplevelStatement: expression statementTerminator | compoundStatement | IF ( expression ) statement | IF ( expression ) statement ELSE statement | FOR ( forExpression ; expression ; forExpression ) statement | WHILE ( expression ) statement ;

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

statement: toplevelStatement | terminator ;

TE

RN

list: /* nothing */ | list terminator | list procDefinition | list toplevelStatement | list HASHLINE NUMBER terminator | list HASHLINE NUMBER filename terminator | list INCLUDE filename terminator | list DIRECTORY filename ;

AL

EX

TE

In the following syntactic description, terminals are shown either single quoted or as upper case words. Non-terminals are shown as lower case words. Production rules end with a new line character. Production rules with the same left-hand side are separated with a vertical bar character (|).

RN AL

B.3 Command language syntax

EX

A command file may also be executed automatically on starting st40load.

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 50/168

Command language syntax

procDefinition: PROC IDENTIFIER assignmentList compoundStatement ; expression: argument | arrayLiteral | argExpression | varExpression | procExpression | whenExpression | expression binaryOp expression | prefixUnaryOp expression | expression postfixUnaryOp | ( expression ) ; argExpression: $NUMBER | $# | $( expression ) ;

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

statementTerminator: ; | \n | ELSE | } ;

RN AL

terminator: ; | \n | END_OF_FILE ;

EX

TE

statementList: statement | statementList statement ;

RN AL

compoundStatement: { statementList } | { } ;

EX

TE
45

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 51/168

46

Command language syntax

whenExpression: WHEN ( expression ) assignmentList compoundStatement | WHEN ( ) assignmentList stop compoundStatement ; arrayLiteral: [ elementList ] | [ ] ; elementList: element | elementList , element ;

EX TE

expressionList: /* nothing */ | expression | expressionList , expression ;

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

argumentList: /* nothing */ | argumentList argument | argumentList $NUMBER | argumentList $* | argumentList $# | argumentList $( expression ) | argumentList ( expressionList ) ;

EX

TE

RN

element: expression | expression => expression ;

AL

EX

TE

RN AL

EX

TE

procExpression: IDENTIFIER argumentList ;

RN AL

varExpression: IDENTIFIER | varExpression [ expression ] | varExpression . IDENTIFIER ;

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 52/168

Command language syntax

EX TE

RN

postfixUnaryOp: -- | ++ ;

AL

prefixUnaryOp: - | + | ! | ~ | -- | ++ ;

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

binaryOp: assignOp | arithmeticOp | relativeOp | logicalOp | bitOp ;

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

argument: NUMBER | STRING | IDENTIFIER ;

TE

RN AL

localVar: IDENTIFIER | localVar [ expression ] | localVar [ ] | localVar . IDENTIFIER ;

EX

assignmentList: /* nothing */ | assignmentList terminator | assignmentList localVar | assignmentList localVar = expression ;

TE

RN AL

forExpression: /* nothing */ | expression ;

EX

TE
47

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 53/168

48

Command language syntax

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

bitOp: >> | << | & | | | ^ ;

AL

EX

logicalOp: && | || ;

TE

RN

relativeOp: == | != | < | > | <= | >= ;

AL

EX

TE

arithmeticOp: + | - | * | % | / ;

RN AL

EX

assignOp: = | += | -= | *= | %= | /= | >>= | <<= | &= | |= | ^= ;

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 54/168

Alphabetical list of commands

B.4 Alphabetical list of commands

Command descriptions are laid out in a standard format. First, the command name is given, highlighted in large type, followed on the same line by a brief summary of its action.

Heading Syntax Arguments Options Results Errors Description Example See also

Information given The command name and argument details.

A list of the commands arguments and their meanings. A list of the options available and their meaning. The result(s) returned.

A detailed description of the command and hints on usage. An example of the commands use, where appropriate. A list of related commands, where appropriate. Table 8: Information about headings of the commands

Format of definitions
Italics is used to show argument names. [Braces] are used to show optional arguments and options. When options are mutually exclusive a | character is used to designate this.

EX TE

RN

AL

EX

TE

Bold is used to show command and option names.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

The action(s) taken on error.

RN AL

EX

TE

The command name is followed by detailed information about the command under the following heading.

RN AL

EX

TE
49

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 55/168

50

Alphabetical list of commands

Set command language line number and filename

#line lineNumber [fileName]

Arguments
lineNumber specifies file line number. fileName specifies the filename.

Results
Returns no value.

Errors
None

#line is intended for use in scripts.

See also

include on page 93.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

Description

AL

EX

TE

RN AL

EX

TE

Syntax

RN AL

#line

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 56/168

Alphabetical list of commands

Add help to a specific procedure

addhelp procName helpString

Arguments

helpString specifies the help string to be associated with procedure.

Results
Returns no value.

Errors
None

addhelp associates helpString with the procedure procName.

See also

clsymbol on page 58 and help on page 92.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Description

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

procName specifies the name of a command language procedure.

EX

TE

Syntax

RN AL

addhelp

EX

TE
51

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 57/168

52

Alphabetical list of commands

Change directory

cd directory

Arguments

Results

Returns zero on success and non zero on failure.

Errors
cd error-argument(s) needed If directory does not exist:

If an incorrect number of arguments is supplied:

cd error-file I/O error - cannot change to directory directory

cd changes the current working directory.

See also

pwd on page 119.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

Description

RN

AL

EX

TE

RN AL

directory specifies the directory which will become the current directory.

EX

TE

Syntax

RN AL

cd

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 58/168

Alphabetical list of commands

Define or display the chip type of a target

Arguments

chipType specifies the type of the chip. Valid types include ST40GX1 and ST40STB1.

-q[uiet] quiet mode, do not display chip type.

Results

If an unknown chip type is supplied: chip error-bad args: unknown chip type

chip error-specified chiptype unsupported by this backend

chip error-not connected

EX TE

RN

AL

If not connected to a target:

EX

If a known, but unsupported, chip type is supplied:

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Errors

AL

Returns the chip type of the connected target.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

Options

RN AL

EX

chip [-q] chip chipType

TE

Syntax

RN AL

chip

EX

TE
53

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 59/168

54

Alphabetical list of commands

Description

If a chipType is supplied to chip then the chip type of the connected target is set to chipType. If no chipType is supplied then chip displays the chip type of the connected target. The chip type for the connected target must be set before the connected target can be reset.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

cputype on page 65, memory on page 101, processor on page 118 and reset on page 123.

EX

See also

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 60/168

Alphabetical list of commands

Define command language behavior on error

clerror [errorString] [-i|-s]

Arguments
errorString specifies the error string to report.

Options

-i[gnore] ignore errors that occur while executing command language programs. -s[top] when errors occur during command language execution, stop at the point of error. This is the default.

Results
Returns no value.

Errors
None.

EX TE

RN

AL

The clerror command reports an error and causes the command language execution to terminate. The -ignore option enables the program to continue execution. The -stop option restores the default error behavior.

EX

Description

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

clerror

EX

TE
55

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 61/168

56

Alphabetical list of commands

Example
> clerror -ignore > peek 0xac000000 -4 > write still going

The following always outputs still going even if the peek command fails.

The following outputs should never get here and stops when the if statement is executed. > if (value == 4) { clerror should never get here }

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 62/168

Alphabetical list of commands

Set the level of command language debugging information

clinfo level

Arguments

Results
Returns no value.

If an incorrect number of arguments is supplied: clinfo error-arguments(s) needed

Description

Level 1, information on each file that is opened (included).

EX TE

RN

Level 3, information on each file that is opened (included), information on each command language procedure called and information on each source line that is executed.

AL

Level 2, information on each file that is opened (included) and information on each command language procedure called.

EX

Level 0, no information (default value).

TE

clinfo defines the amount of information output by the command language processor.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

Errors

TE

RN AL

level specifies the amount of information output by the command language as it executes a command language program.

EX

TE

Syntax

RN AL

clinfo

EX

TE
57

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 63/168

58

Alphabetical list of commands

Display command language variables, procedures and commands

clsymbol [symbolName] [-all|-vars|-procs|-commands]

Arguments
symbolName specifies the name of a symbol.

Options

-all lists all command language symbols.

-vars lists all command language variables.

-commands lists all command language commands.

Results

None.

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

The clsymbol command can be used to test if a variable, procedure or command is available. It can also be used to display all symbols that are available or to display only variable names, procedure names or command names.

AL

EX

Errors

TE

If symbolName is not supplied then no value is returned. Otherwise, return 0 if the symbol is not defined, 1 if the symbol is a variable, 2 if the symbol is a procedure and 3 if the symbol is a command.

RN

AL

EX

-procs lists all command language procedures.

TE

RN AL

EX

TE

Syntax

RN AL

clsymbol

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 64/168

Alphabetical list of commands

Example

The following tests if the variable value exists. If is does not exist then it creates the symbol and defines its value. > if (!(clsymbol value)) { value = 1 }

See also
remove on page 121.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
59

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 65/168

60

Alphabetical list of commands

Connect to a target

connect targetName [-v] [-ded]

Arguments

Options
-v display information on connection.

-ded disable automatic disconnect on DTF exit.

Results
Returns no value.

If an incorrect number of arguments is supplied: connect error-invalid command incorrect number of arguments If targetName does not exist: connect error-no such target

connect error-already connected to targetName

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

If the dllName corresponding to the named target (see target on page 147) allows fewer active instances than are requested: backend[dllName] only supports up to X simultaneous instances connect error-unable to open connection

AL

If already connected to a target:

EX

TE

RN

Errors

AL

EX

TE

RN AL

targetName specifies the name of the target to be connected.

EX

TE

Syntax

RN AL

connect

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 66/168

Alphabetical list of commands

Description

connect establishes a connection to targetName and executes the command language procedure associated with the target. The target must be a valid target as defined by a target command. If there is more than one target with the supplied target name then connect tries each target until a connection can be made or there are no targets left.

disconnect on page 67, reset on page 123 and target on page 147.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

See also

TE

RN AL

EX

TE
61

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 67/168

62

Alphabetical list of commands

Display contents of physical memory

Arguments

address specifies the base address (aligned in accordance with display type). length specifies the number of elements to display.

-q[uiet] quiet mode, do not display value. -l display towards higher addresses (default is to display towards lower addresses). This is the default when displaying instructions. -n do not display address.

-ium ignore undefined memory.

-2 element size of 2 bytes, display in default output format.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

-4 element size of 4 bytes, display in default output format. This is the default. -8 element size of 8 bytes, display in default output format. -f element size of 4 bytes, display as single-precision floating-point. -k element size of 8 bytes, display as double-precision floating-point.

EX

-1 element size of 1 byte, display in default output format.

TE

type is one of the following options which determine the size of each element and their output format:

RN

-z columns display in columns columns.

AL

EX

TE

Options

RN AL

EX

cpumemory address length [type] [format] [-q] [-l] [-n] [-z columns] [-ium]

TE

Syntax

RN AL

cpumemory

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 68/168

Alphabetical list of commands

-a element size of one byte, display as ASCII. -i element size of one instruction, display as instruction.

format is one of the following options which overrides the default output format (see setomode on page 133): -b display as binary number. -d display as signed decimal number. -o display as octal number. -u display as unsigned decimal number. -x display as hexadecimal number.

Results

Note:

If an incorrect number of arguments is supplied: cpumemory error-invalid command incorrect number of arguments

cpumemory error-invalid number of elements If address is an undefined memory location: cpumemory error-address does not exist If the address is not aligned to the size of the display type:

EX TE

RN

cpumemory error-address not aligned to access size of X

If not connected to a target: cpumemory error-not connected

AL

EX

TE

If length exceeds the maximum number of elements:

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

Errors

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

The value returned by the -f and -k options is an integer conversion of the floating-point value.

TE

Returns the contents of the last memory address as a number. Only valid with the options -1, -2, -4, -8, -f or -k otherwise zero is returned.

RN AL

EX

TE

RN AL

EX

TE
63

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 69/168

64

Alphabetical list of commands

Description

Displays the memory region contents from address for length elements using the supplied type and output format options.

Example
To display a block of memory: > cpumemory 0xac000000 4 -x 0xac00000c 0xdf24d427 0xac000008 0x0009e111 0xac000004 0x00090009 0xac000000 0x00090009

To display the same block using different parameters: > cpumemory -x -1 -z 0xac00001f 0x03 0xc9 0xac00001b 0x00 0xe6 0xac000017 0x23 0xd4 0xac000013 0x40 0x37 0xac00000f 0x27 0xd4 0xac00000b 0x11 0xe1 0xac000007 0x09 0x00 0xac000003 0x09 0x00 4 0xac000000 32 0x53 0x60 0x23 0xd5 0x2c 0x8b 0x28 0xd7 0x24 0xdf 0x09 0x00 0x09 0x00 0x09 0x00

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

memory on page 101, peek on page 113, poke on page 116 and setomode on page 133.

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 70/168

Alphabetical list of commands

Display the core CPU type

cputype [-q]

Arguments
None.

Options

-q[uiet] quiet mode, do not display core CPU type.

Results

Returns the core CPU type of the connected target.

Errors

cputype error-not connected

Description

Display the core CPU type of the connected target.

chip on page 53 and processor on page 118.

EX TE

RN

AL

See also

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

If not connected to a target:

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

cputype

EX

TE
65

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 71/168

66

Alphabetical list of commands

Add a directory to the search space

directory pathName

Arguments

Results
Returns no value.

Errors
syntax errordirectory ^

If an incorrect number of arguments is supplied:

Description

See also

include on page 93.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

directory adds pathName to the command language filename search space. The search path is then used by the include command to find command language script files which can be included.

RN

AL

EX

TE

RN AL

pathName specifies the path to be added to the search space.

EX

TE

Syntax

RN AL

directory

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 72/168

Alphabetical list of commands

Disconnect from a target

disconnect

Arguments
None.

Results
Returns no value.

Errors
If not connected to a target:

disconnect closes the current connection to a target.

See also

connect on page 60, reset on page 123 and target on page 147.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Description

AL

disconnect error-not connected

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

disconnect

EX

TE
67

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 73/168

68

Alphabetical list of commands

Manage the DLL search path

Arguments

pathName specifies the path to be added to the DLL search path.

Options

-r[eset] reset the DLL search path to the default.

Description

Under st40load this command is ignored.

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

plugin on page 115 and target on page 147.

RN

AL

EX

TE

-q[uiet] quiet mode, do not display search path.

RN AL

EX

dllpath [-q] [-r] dllpath pathName

TE

Syntax

RN AL

dllpath

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 74/168

Alphabetical list of commands

Dump the contents of memory to a file

dump fileName address length [-h|-s|-b]

Arguments
fileName specifies the name of the dump file. address specifies the base address.

length specifies the number of bytes to dump.

Options

-s[record] file format is SRECORD19.

Returns no value.

Errors

If an incorrect number of arguments is supplied:

If address is an undefined memory location:

EX TE

RN

dump error-address does not exist If not connected to a target: dump error-not connected

AL

dump error-invalid command incorrect number of arguments

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Results

AL

-b[inary] file format is binary.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-h[ex] file format is hex. This is the default.

TE

RN AL

EX

TE

Syntax

RN AL

dump

EX

TE
69

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 75/168

70

Alphabetical list of commands

Description

The dump command reads the contents of memory into the file specified by fileName starting at the location specified by address on the connected target for length number of bytes. The address is checked against known memory regions and only accepts a valid address.

See also
peek on page 113.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 76/168

Alphabetical list of commands

Display symbol table of an ELF32 executable file

elfsymbols [-q] [-file fileName] [-addrof symbol] [-a|-o|-f]

Arguments
None.

Options

-q[uiet] quiet mode, do not display symbols.

-file fileName the name of an ELF32 executable file.

-a[ll] display all symbols in the symbol table. This is the default.

-f[unction] display only function symbols in the symbol table.

Results

If -addrof is supplied then return the address of symbol, otherwise no value is returned.

Errors

If no program loaded onto the target:

EX TE

RN

elfsymbols error-no program loaded If symbol does not exist:

elfsymbols error-symbol does not exist

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

-o[bject] display only object symbols in the symbol table.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-addrof symbol display the address of symbol in the symbol table.

TE

RN AL

EX

TE

Syntax

RN AL

elfsymbols

EX

TE
71

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 77/168

72

Alphabetical list of commands

If not connected to a target: elfsymbols error-not connected

Description

Note:

See also
startstate on page 138.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

When searching the symbol table in an ELF32 executable only symbols with a leading underscore (_) are considered and the leading underscore is removed when displaying the symbols. Functions are distinguished by () being appended to their name.

EX

If -file fileName is not supplied then elfsymbols displays symbols from the symbol table in the executable file of the program loaded onto the connected target.

TE

The elfsymbols command is used to display the symbols in the symbol table of an ELF32 executable file and to display the address of a supplied symbol.

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 78/168

Alphabetical list of commands

Invokes a named command language procedure or command

eval command arguments

Arguments

arguments specifies the arguments to the procedure or command.

Results

Returns the result of the command if one is returned.

Errors

eval error-arguments(s) needed

Description

See also

parse on page 111.

EX TE

RN

AL

EX

The eval command invokes a named command language procedure or command. This command may be used to implement the passing of procedure names or commands as procedure parameters.

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

If an incorrect number of arguments is supplied:

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

command specifies the name of the procedure or command to be invoked.

EX

TE

Syntax

RN AL

eval

EX

TE
73

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 79/168

74

Alphabetical list of commands

Force execution of an events when clauses

event eventId

Arguments
eventId specifies a particular event to force.

Results
Returns no value.

Errors

If an incorrect number of arguments is supplied:

Example

To setup a when program and force it to execute:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

> when (42) { write when clause for event 42 } > event 42 when clause for event 42

AL

EX

This command is synonymous with the forcewhen command.

TE

The event command forces all when clauses associated with the supplied event to be executed. This is useful for testing scripts to ensure that when clauses are correct. If no when clauses are associated with the supplied event, nothing happens.

RN

Description

AL

event error-arguments(s) needed

EX

TE

RN AL

EX

TE

Syntax

RN AL

event

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 80/168

Alphabetical list of commands

See also
forcewhen on page 84 and when on page 151.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
75

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 81/168

76

Alphabetical list of commands

Append a list of strings to a file

fappend fileName stringList

Arguments
stringList specifies a list of strings to write.

Results
Returns no value.

Errors

fappend error-arguments(s) needed

Description

Example

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

> fappend afile A string to a file\n

AL

EX

The fappend command writes strings to the file fileName. If the fappend command is the first file operation on the file then it is opened for appending. Subsequent fappend commands to fileName append to the file and the file is only closed when a fclose command is called on the fileName. Special characters such as new line (\n) should be enclosed in double quotes ().

TE

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

fileName specifies the file to which the strings are to be appended.

EX

TE

Syntax

RN AL

fappend

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 82/168

Alphabetical list of commands

See also

fclose on page 78, fread on page 88, fwrite on page 90 and write on page 153.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
77

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 83/168

78

Alphabetical list of commands

Close an opened file

fclose fileName

Arguments
fileName specifies the file to be closed.

Results

Returns zero on success and non zero on failure.

Errors

If an incorrect number of arguments is supplied:

If the fileName is not open:

fclose error-file I/O error - file fileName is not open.

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

fappend on page 76, fopen on page 82, fread on page 88 and fwrite on page 90.

AL

EX

The command fclose closes the open file fileName. A subsequent call with fwrite overwrites the file while fappend opens the file for appending. Once a file has been closed fread reads from the first line in the file if called.

TE

Description

RN

AL

fclose error-arguments(s) needed

EX

TE

RN AL

EX

TE

Syntax

RN AL

fclose

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 84/168

Alphabetical list of commands

Test for end-of-file

feof fileName

Arguments
fileName specifies the file to be tested.

Results
Returns non zero if at the end-of-file.

Errors

If an incorrect number of arguments is supplied:

If the fileName is not open:

feof error-file I/O error - file fileName is not open

See fgets on page 80.

EX TE

RN

See also
fclose on page 78, fgets on page 80, fputs on page 86 and rewind on page 125.

AL

Example

EX

The command feof tests whether a previous call to fgets has encountered the end-of-file marker.

TE

Description

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

feof error-arguments(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

feof

EX

TE
79

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 85/168

80

Alphabetical list of commands

Read a line from a file

fgets fileName

Arguments

Results
Returns the line read from the file.

Errors

If an incorrect number of arguments is supplied:

If the access mode is not read only: fgets error-file I/O error - file fileName is open for write only fgets error-file I/O error - file fileName is open for append only

fgets error-file I/O error - file fileName is not open

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

The command fgets reads a line from the file fileName. It returns the string read, without any terminating new line character. Successive uses of the command returns successive lines from the file.

AL

EX

If the fileName is not open:

TE

RN

AL

fgets error-arguments(s) needed

EX

TE

RN AL

fileName specifies a file previously opened for input.

EX

TE

Syntax

RN AL

fgets

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 86/168

Alphabetical list of commands

Example

Note:

fclose on page 78, feof on page 79, fputs on page 86 and rewind on page 125.

EX TE

RN

AL

See also

EX

fgets strips new line (\n) characters from the end of a line, therefore, they have to be added back in the fputs call.

TE

if (lineCount > 0) { fopen(file, w); for (lineIndex = 0; lineIndex < lineCount; lineIndex++) { if ((lines[lineIndex] * foobar) == ) { fputs(file, lines[lineIndex] + \n); } } fclose(file); }

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

if (fopen(file, r) == -1) { write(could not open, file, !); } else { while (!feof(file)) { lines[lineCount++] = fgets(file); } fclose(file); }

RN AL

EX

lineCount = 0; file = afile;

TE

Read a file into a command language array variable and then write the back the file minus any lines containing the word foobar.

RN AL

If an attempt is made to read past the end of the file, an empty string is returned. Because this could be confused with empty lines, a call to feof should be made to determine whether the end of the file has really been reached.

EX

TE
81

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 87/168

82

Alphabetical list of commands

Open a file

fopen fileName [-r] [-w] [-a]

Arguments
fileName specifies the file to be opened.

Options
-r opens fileName for read access. -w opens fileName for write access.

Returns zero on success and non zero on failure.

Errors

If an incorrect number of arguments is supplied: fopen error-arguments(s) needed If the access mode is invalid:

If the file is already open in a different mode:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

fopen error-file I/O error - file fileName is already open in a different mode

AL

fopen error-file I/O error - invalid file access mode

EX

TE

RN

AL

Results

EX

-a opens fileName for append access.

TE

RN AL

EX

TE

Syntax

RN AL

fopen

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 88/168

Alphabetical list of commands

Description

The command fopen opens the file fileName for reading, writing or appending.

Example
See fgets on page 80.

fclose on page 78, feof on page 79, fgets on page 80, fputs on page 86 and rewind on page 125.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

See also

TE

RN AL

EX

TE
83

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 89/168

84

Alphabetical list of commands

Force execution of an events when clauses

forcewhen eventId

Arguments
eventId specifies a particular event to force.

Results
Returns no value.

Errors

If an incorrect number of arguments is supplied:

This command is synonymous with the event command

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

To setup a when program and force it to execute:

> when (42) { write when clause for event 42 } > forcewhen 42 when clause for event 42

AL

Example

EX

TE

The forcewhen command forces all when clauses associated with the supplied event to be executed. This is useful for testing scripts to ensure that when clauses are correct. If no when clauses are associated with the supplied event, nothing happens.

RN

Description

AL

forcewhen error-arguments(s) needed

EX

TE

RN AL

EX

TE

Syntax

RN AL

forcewhen

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 90/168

Alphabetical list of commands

See also
event on page 74 and when on page 151.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
85

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 91/168

86

Alphabetical list of commands

Write a string to a file

fputs fileName string

Arguments
string the string to write.

Results
Returns no value.

Errors

fputs error-arguments(s) needed If the access mode is read only:

If the fileName is not open: fputs error-file I/O error - file fileName is not open

EX TE

The command fputs writes the supplied string to the file fileName. If the file was opened for writing fputs overwrites existing text in that file. If the file was opened for appending fputs appends the string at the end of the file. The string is written as-is, with no new line appended.

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

Description

EX

TE

fputs error-file I/O error - file fileName is open for read only

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

fileName specifies a file previously opened for output.

EX

TE

Syntax

RN AL

fputs

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 92/168

Alphabetical list of commands

Example
See fgets on page 80.

See also

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

fclose on page 78, feof on page 79, fgets on page 80 and rewind on page 125.

RN AL

EX

TE
87

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 93/168

88

Alphabetical list of commands

Read a value from a file into a variable

fread fileName variable

Arguments
fileName specifies the file to read.

variable specifies the variable into which a value is read.

Results

Returns zero on failure and non zero on success.

Errors

fread error-arguments(s) needed If the fileName is not open: fread error-file I/O error - file fileName is not open

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

The fread commands reads values from the file fileName into a variable. If the fread command is the first file operation on the file then the file is opened for reading. Subsequent fread commands to fileName read the next line in the file and the file is only closed when a fclose is called on the fileName.

EX

TE

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

EX

TE

Syntax

RN AL

fread

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 94/168

Alphabetical list of commands

Example
ok = 1 while (ok) { ok = fread datafile value if (ok) write (value) }

See also

fappend on page 76, fclose on page 78 and fwrite on page 90.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
89

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 95/168

90

Alphabetical list of commands

Write a list of strings to a file

fwrite fileName stringList

Arguments
fileName specifies the file to be written to. stringList specifies a list of strings to write.

Results
Returns no value.

Errors

fwrite error-arguments(s) needed

Description

Example

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

> fwrite afile A string to a file\n

See also
fappend on page 76, fclose on page 78, fread on page 88 and write on page 153.

AL

EX

The fwrite command writes strings to the file fileName. If the fwrite command is the first file operation on the file then it is opened for overwriting. Subsequent fwrite commands to fileName append to the file and the file is only closed when a fclose command is called on the fileName. Special characters such as new line (\n) should be enclosed in double quotes ().

TE

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

EX

TE

Syntax

RN AL

fwrite

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 96/168

Alphabetical list of commands

Get the value of an environment variable

getenv envName

Arguments
envName specifies the environment variable name.

Results

Returns the value of the environment variable.

Errors

If an incorrect number of arguments is supplied:

The getenv command returns the value of an environment variable envName.

Example

> write (getenv ST40ROOT)

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Description

AL

getenv error-arguments(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

getenv

EX

TE
91

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 97/168

92

Alphabetical list of commands

Display help associated with a command

help [command]

Arguments
command specifies the command to display help on.

Results

Returns a list of available commands as a string if no command is supplied.

Errors
None.

Description

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

addhelp on page 51.

TE

RN

The help command displays detailed help on command. If no command is supplied then help displays the available commands.

AL

EX

TE

RN AL

EX

TE

Syntax

RN AL

help

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 98/168

Alphabetical list of commands

Include a command language script file

include fileName

Arguments

Results
Returns no value.

Errors
syntax errorinclude ^

If an incorrect number of arguments is supplied:

error-file I/O error - cannot open fileName for reading

Description

EX TE

RN

If no directory is supplied, the current command language search path is searched. This command cannot be used within a command procedure or within any other command language construct, for example, an if or while loop.

AL

The include command is equivalent to inserting the contents of the command file fileName in place of the include command. The include command may be used in a command file or at the st40load command prompt. All the commands in the included command file are treated as though they appeared at the location of the include command and are interpreted accordingly.

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

If the fileName is not valid:

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

fileName specifies the command language script file to include.

EX

TE

Syntax

RN AL

include

EX

TE
93

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 99/168

94

Alphabetical list of commands

See also
directory on page 66.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 100/168

Alphabetical list of commands

Load connected target with an ELF32 or SRECORD19 executable

Arguments

fileName specifies the executable to load onto the target.

Options

-verifynoload verify the executable without loading it. -v[erbose] display information on the load/verify operation. -attach load the file that has already been loaded into memory. -nocheckimage the image is not checked for its type, the PC entry point and DTF synchronization word locations. imageType maybe either elf or srec. Note: The user must supply the appropriate startstate commands to set the PC entry point and DTF synchronization word locations when using -nocheckimage.

Returns no value.

Errors

EX TE

RN

If an incorrect number of arguments is supplied:

load error-invalid command incorrect number of arguments If not connected to a target:

AL

EX

Results

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

-verify load and verify the executable.

RN AL

EX

load fileName [-v] [-verify|-verifynoload] [-attach] [-nocheckimage imageType]

TE

Syntax

RN AL

load

EX

TE
95

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 101/168

96

Alphabetical list of commands

load error-not connected If the file is not found: load error-file not found If the file is not an ELF32 or SRECORD19 format file: load error-unknown file type

If the file is not a valid ELF32 or SRECORD19 format file: load error-unable to check image If the file is not a valid ELF32 file: load error-bad file format

If the file is not a valid SRECORD19 file:

load error-not a valid SREC file If the file is of the wrong endianness:

If the file fails to verify:

Description

Loads an ELF32 or SRECORD19 format executable onto the target, and optionally verifies it. The executable to be loaded must be in the same endian format as the connected target. If neither the -verify or -verifynoload option is supplied the default is to load without verifying the file. If either the -verify or -verifynoload option is supplied then the executable is verified: read back all the target memory which has been written and compare to the expected values.

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

run on page 128 and startstate on page 138.

AL

EX

TE

RN

AL

#target error: verify failed, address ADDRESS, read X, expected Y load error-failed to verify

EX

load error-file is opposite endianess to target

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 102/168

Alphabetical list of commands

Load connected target with a binary image

loadimage address fileName

Arguments
address specifies the address to load the image at.

fileName specifies the binary image to load onto the target.

Results

Returns the size, in bytes, of the binary image file.

Errors

loadimage error-invalid command incorrect number of arguments If address is an undefined memory location: loadimage error-address does not exist If not connected to a target:

If the file is not found:

EX TE

RN

Description
Loads a binary image onto the target at a specified address.

AL

loadimage error-unable to open executable file

EX

loadimage error-not connected

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

If an incorrect number of arguments is supplied:

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

loadimage

EX

TE
97

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 103/168

98

Alphabetical list of commands

See also
load on page 95.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 104/168

Alphabetical list of commands

Log the output of commands to a file

Arguments

fileName specifies the name of the file into which the log is created.

Options

-close disable logging and close the log file. -off disable logging (flushing any pending output to the log file). -on enable logging.

Returns no value.

Errors

If no fileName has been supplied as a log file: log error-log file name must be supplied

Description

EX TE

Note:

RN

The log command is used to copy input commands and their output to a log file specified by fileName.

If a log file is already open and another log file is supplied then the existing log file is closed before opening the new log file.

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Results

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

-c[reat] open the log file for overwriting (the default is to append).

RN AL

EX

log fileName [-c] log [-close|-on|-off]

TE

Syntax

RN AL

log

EX

TE
99

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 105/168

100

Alphabetical list of commands

Write a string to a memory location

memcpy address string

Arguments
address specifies the address to write. string specifies the string to write.

Results
Returns no value.

Errors

memcpy error-invalid command incorrect number of arguments If address is an undefined memory location: memcpy error-address does not exist If not connected to a target:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

The memcpy command writes the string string to the memory location specified by address on the connected target. The address is checked against known memory regions and only accepts a valid address.

See also
poke on page 116.

AL

Description

EX

memcpy error-not connected

TE

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

EX

TE

Syntax

RN AL

memcpy

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 106/168

Alphabetical list of commands

Manage memory segments of a target

Arguments

name specifies a unique name for the memory segment. address specifies the base address of the memory segment, which must be word aligned.

type specifies the type of the memory, which may be ROM, RAM or DEV.

Options

-q[uiet] quiet mode, do not display memory segments.

Results

If insufficient arguments are supplied:

If not connected to a target:

EX TE

RN

memory error-not connected If the memory region is not unique: memory error-overlapping address

AL

memory error-invalid command incorrect number of arguments

EX

Errors

TE

Returns the memory regions.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

size specifies the size of a memory segment in bytes.

RN AL

EX

memory name address size type memory [-q]

TE

Syntax

RN AL

memory

EX

TE
101

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 107/168

102

Alphabetical list of commands

If an invalid attribute is supplied: memory error-only ROM, RAM and DEV are supported

Description

The memory command may also be used to display the memory regions of the connected target.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

The memory command is used to define the memory regions that are referenced by subsequent commands. When used as an input to st40load, memory declares a memory region associated with the connected target.

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 108/168

Alphabetical list of commands

Write a repeating value to continuous memory locations

memset address value length [-big|-little] [-1|-2|-4|-8]

Arguments
address specifies the base address to set. value specifies the value to set.

length specifies the number of bytes to set.

Options

-little set the value in little endian format.

-2 set a 2 byte value. -4 set a 4 byte value. -8 set a 8 byte value.

Returns no value.

Errors

EX TE

RN

If an incorrect number of arguments is supplied:

memset error-invalid command incorrect number of arguments

AL

EX

Results

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

-1 set a 1 byte value. This the default.

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-big set the value in big endian format.

TE

RN AL

EX

TE

Syntax

RN AL

memset

EX

TE
103

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 109/168

104

Alphabetical list of commands

If address is an undefined memory location: memset error-address does not exist If address is not aligned: memset error-address not aligned to access size If not connected to a target: memset error-not connected

Description

See also
poke on page 116.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

The memset command writes value to the memory location specified by address on the connected target repeated for length number of bytes. The address is checked against known memory regions and only accepts a valid address. By default the memset command writes the value in the endianness of the connected target unless overridden by the -big or -little options.

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 110/168

Alphabetical list of commands

Make a list of directories

mkdir directoryList

Arguments

Results

Returns zero on success and non zero on failure.

Errors

If an incorrect number of arguments is supplied:

If a directory already exists: File exists

The mkdir command creates the list of directories in the file store.

Example

> mkdir hello.1 hello.2

EX TE

RN

See also
rm on page 126 and rmdir on page 127.

AL

EX

TE

Description

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

mkdir error-arguments(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

directoryList specifies a list of directories to create.

EX

TE

Syntax

RN AL

mkdir

EX

TE
105

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 111/168

106

Alphabetical list of commands

Convert a string to a number

mknum arg

Arguments

Results

If an incorrect number of arguments is supplied: mknum error-arguments(s) needed

mknum error-expected integer invalid number

Description

The mknum and mkstr commands are used to convert from numbers to strings and vice-versa. They are used in command language programming because the command language does not perform implicit type conversion.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

If arg is not a string of numbers:

AL

EX

Errors

TE

mknum returns the argument as a number. If the argument is a string convert into a number otherwise leave as is.

RN AL

arg specifies the argument to be converted into a number.

EX

TE

Syntax

RN AL

mknum

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 112/168

Alphabetical list of commands

Example

The following show the mknum and mkstr commands being used in the context of the addition operator. If these commands are not used then attempts to mix string and integer operands to this operator would result in a error. > > > > z > > z x = 3 y = 1 z = 3 + write z is 4 z = y + write z is 13

mknum(y) is (z) mkstr(x) is (z)

See also
mkstr on page 108.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
107

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 113/168

108

Alphabetical list of commands

Convert a number to a string

mkstr [format] arg

Arguments

Options
format is one of the following options. -b or -b* binary number. -c ASCII character. -d signed decimal number. -o or -o* octal number.

-u unsigned decimal number. -x or -x* hexadecimal number.

Results

mkstr returns the argument as a string. If the argument is a number convert into a string in the supplied format otherwise leave as is.

Errors

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

If an incorrect number of arguments is supplied:

mkstr error-arguments(s) needed

AL

EX

TE

RN

AL

EX

TE

RN AL

arg specifies the argument to be converted into a string, in the supplied format if supplied, or as signed decimal if no format is supplied.

EX

TE

Syntax

RN AL

mkstr

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 114/168

Alphabetical list of commands

Description

The mknum and mkstr commands are used to convert from numbers to strings and vice-versa. They are used in command language programming because the command language does not perform implicit type conversion. Note that arguments to the format options are formatted to the minimum width except for the -b, -o and -x options whose arguments are formatted to the maximum width.

Example

mknum on page 106.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

See also

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

> > > > z > > z

x = 3 y = 1 z = 3 + write z is 4 z = y + write z is 13

mknum(y) is (z) mkstr(x) is (z)

TE

RN AL

The following show the mknum and mkstr commands being used in the context of the addition operator. If these commands are not used then attempts to mix string and integer operands to this operator would result in a error.

EX

TE

RN AL

EX

TE
109

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 115/168

110

Alphabetical list of commands

Rename a file

mv oldFileName newFileName

Arguments
oldFileName specifies the old filename. newFileName specifies the new filename.

Results

Returns zero on success and non zero on failure.

Errors

mv error-invalid command incorrect number of arguments If the file does not exist:

No such file or directory

Description

The command mv renames oldFileName to newFileName.

Example

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

> mv hello.1 hello.2

AL

EX

TE

RN

AL

If an incorrect number of arguments is supplied:

EX

TE

RN AL

EX

TE

Syntax

RN AL

mv

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 116/168

Alphabetical list of commands

Parse and execute a program

parse program

Arguments

Results

Returns the return result of the executed command language program.

Errors

If an incorrect number of arguments is supplied:

EX TE

RN

See also
eval on page 73.

AL

> parse x = 42 > write (x) 42

EX

Example

TE

The command parse takes a string argument that is parsed and executed as a command language program.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Description

AL

parse error-argument(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

program specifies the command language program to parse and execute.

EX

TE

Syntax

RN AL

parse

EX

TE
111

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 117/168

112

Alphabetical list of commands

Manage the path mappings

Arguments
pathName1 specifies the path prefix to be replaced. pathName2 specifies the replacement path prefix.

-r[eset] reset the path mappings to the default.

Results
Returns no value.

Errors
None.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

If pathName1 and pathName2 are supplied to pathmap then the mapping from the path prefix pathName1 to pathName2 is added to the path mappings. If no pathName1 and pathName2 are supplied and -reset is not supplied then pathmap displays the path mappings.

EX

Description

TE

RN

AL

EX

TE

Options

RN AL

EX

pathmap [-r] pathmap pathName1 pathName2

TE

Syntax

RN AL

pathmap

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 118/168

Alphabetical list of commands

Read a value from a memory location

peek address [-q] [-big|-little] [-1|-2|-4|-8]

Arguments
address specifies the address to peek.

Options

-q[uiet] quiet mode, do not display value. -big peek the value in big endian format.

-1 peek a 1 byte value. -2 peek a 2 byte value.

-4 peek a 4 byte value. This the default. -8 peek a 8 byte value.

Results

If an incorrect number of arguments is supplied:

EX TE

RN

peek error-invalid command incorrect number of arguments If address is an undefined memory location: peek error-address does not exist

AL

Errors

EX

Returns the value at the location specified by address.

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-little peek the value in little endian format.

TE

RN AL

EX

TE

Syntax

RN AL

peek

EX

TE
113

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 119/168

114

Alphabetical list of commands

If address is not aligned: peek error-address not aligned to access size If not connected to a target: peek error-not connected

Description

The output format used to display the address is defined by setomode (see setomode on page 133).

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

poke on page 116 and setomode on page 133.

TE

RN AL

The peek command reads the contents of memory at the location specified by address on the connected target. The address is checked against known memory regions and only accepts a valid address. By default the peek command reads the value in the endianness of the connected target unless overridden by the -big or -little options.

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 120/168

Alphabetical list of commands

Manage the plugin tools

plugName specifies the name of the plugin tool.

dllName specifies the name of the associated DLL.

-q[uiet] quiet mode, do not display plugin tools. -active display the active plugin tools.

-start plugName start the plugin tool plugName.

-args arguments arguments for a specific instance of the plugin tool. -stop cid stop the plugin tool associated with CID cid.

EX TE

RN

Under st40load this command is ignored.

See also
dllpath on page 68.

AL

Description

EX

TE

-q[uiet] quiet mode, do not display start and stop messages.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

-remove plugName remove the plugin tool plugName.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

Options

TE

arguments specifies the default arguments for all instances of the plugin tool.

RN AL

Arguments

EX

plugin plugName dllName arguments plugin [-q] [-active] [-remove plugName] [-stop cid] [-start [-q] plugName [-args arguments]]

TE

Syntax

RN AL

plugin

EX

TE
115

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 121/168

116

Alphabetical list of commands

Write a value to a memory location

poke address value [-big|-little] [-1|-2|-4|-8]

Arguments
address specifies the address to poke. value specifies the value to poke.

Options

-big poke the value in big endian format.

-1 poke a 1 byte value. -2 poke a 2 byte value.

-4 poke a 4 byte value. This the default. -8 poke a 8 byte value.

Results

If an incorrect number of arguments is supplied:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

poke error-invalid command incorrect number of arguments If address is an undefined memory location: poke error-address does not exist

AL

Errors

EX

Returns no value.

TE

RN

AL

EX

-little poke the value in little endian format.

TE

RN AL

EX

TE

Syntax

RN AL

poke

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 122/168

Alphabetical list of commands

If address is not aligned: poke error-address not aligned to access size If not connected to a target: poke error-not connected

Description

See also

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

memcpy on page 100 and peek on page 113.

RN AL

The poke command writes value to the memory location specified by address on the connected target. The address is checked against known memory regions and only accepts a valid address. By default the poke command writes the value in the endianness of the connected target unless overridden by the -big or -little options.

EX

TE

RN AL

EX

TE
117

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 123/168

118

Alphabetical list of commands

Define the core CPU type of a target

processor coreType

Arguments

Results
Returns no value.

Errors

If an incorrect number of arguments is supplied:

If an unknown core CPU type is supplied: processor error-coretype ST40, ST50 needed If not connected to a target: processor error-not connected

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

See also
chip on page 53 and cputype on page 65.

AL

Set the core CPU type of the connected target to coreType.

EX

TE

RN

AL

processor error-invalid command incorrect number of arguments

EX

TE

RN AL

coreType specifies the core CPU type. Valid types are ST40 and ST50.

EX

TE

Syntax

RN AL

processor

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 124/168

Alphabetical list of commands

Display the current working directory

pwd [-q]

Options
-q[uiet] quiet mode, do not display directory.

Arguments
None.

Results

Returns the current working directory.

Errors
None.

Displays the current working directory.

EX TE

RN

AL

EX

TE

Description

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

pwd

EX

TE
119

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 125/168

120

Alphabetical list of commands

Exit st40load

quit

Arguments
None.

Results
Returns no value.

Errors
None.

Description
Exit from st40load.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

Syntax

RN AL

quit

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 126/168

Alphabetical list of commands

Remove a named object

remove [object]

Arguments

Returns no value.

Errors

remove error-invalid command procedure is active If an active when is supplied:

The remove command deletes a command language symbol (either a variable or procedure) or deletes a when clause. Note: If no argument is supplied and is invoked as part in a when clause (either directly or indirectly) then the when clause is removed on completion.

EX TE

RN

AL

EX

Description

TE

remove error-invalid command when is active

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

If an active procedure is supplied:

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

Results

RN AL

object specifies either the integer identifier of a when clause (as returned by a when command) or command language symbol (either a variable or procedure name). If object is not supplied then the current when is implicitly referred to.

EX

TE

Syntax

RN AL

remove

EX

TE
121

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 127/168

122

Alphabetical list of commands

Example
To remove a when program: > whenid = when (42) { write event 42 when clause } > remove (whenid) when 0 removed To remove a variable: > x = 42 > write (x) 42 > remove x variable x removed

See also

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

clsymbol on page 58 and when on page 151.

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 128/168

Alphabetical list of commands

Reset the current target

reset [-r [-h]] [-a] [-suspend] [-unsuspend]

Options
-a[ttach] attach to the target without reset. -r[eset] reset the target.

-h[ard] perform a hardware target reset. This is equivalent to pushing reset button on the board. -suspend suspend a running target.

Results
Returns no value.

Errors

reset error-not connected If connected to a target but no chip type has been defined: reset error-unspecified chip type If incompatible options are supplied:

EX TE

RN

reset error-only one of -attach, -reset, -suspend, -unsuspend permitted

AL

EX

TE

If not connected to a target:

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

-unsuspend unsuspend a stopped target.

TE

RN AL

EX

TE

Syntax

RN AL

reset

EX

TE
123

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 129/168

124

Alphabetical list of commands

Description

The reset command is used to perform a reset on the connected target. Note that before a reset can be performed the chip type for the target must be defined by the chip command.

chip on page 53.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

See also

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 130/168

Alphabetical list of commands

Move the file pointer to the start of the file

rewind fileName

Arguments

Results
Returns no value.

Errors

If an incorrect number of arguments is supplied:

If the fileName is not open:

rewind error-file I/O error - file fileName is not open

EX TE

RN

fclose on page 78, feof on page 79, fgets on page 80, fopen on page 82 and fputs on page 86.

AL

See also

EX

The rewind command moves the file pointer for fileName back to the start of the file so that it may be re-read.

TE

Description

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

rewind error-argument(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

fileName specifies a file previously opened for input.

EX

TE

Syntax

RN AL

rewind

EX

TE
125

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 131/168

126

Alphabetical list of commands

Remove a list of files

rm fileList

Arguments
fileList specifies a list of files to remove.

Results

Returns zero on success and non zero on failure.

Errors

If an incorrect number of arguments is supplied:

If a file does not exist:

No such file or directory

The rm command removes the list of files from the file store.

Example

> rm hello.1 hello.2

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

See also
mkdir on page 105 and rmdir on page 127.

AL

EX

TE

Description

RN

AL

rm error-arguments(s) needed

EX

TE

RN AL

EX

TE

Syntax

RN AL

rm

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 132/168

Alphabetical list of commands

Remove a list of directories

rmdir directoryList

Arguments

Results

Returns zero on success and non zero on failure.

Errors

If an incorrect number of arguments is supplied:

If a directory does not exist:

No such file or directory

The rmdir command removes the list of directories in the file store.

Example

> rmdir hello.1 hello.2

EX TE

RN

See also
mkdir on page 105 and rm on page 126.

AL

EX

TE

Description

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

rmdir error-arguments(s) needed

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

directoryList specifies a list of directories to remove.

EX

TE

Syntax

RN AL

rmdir

EX

TE
127

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 133/168

128

Alphabetical list of commands

Run a loaded program

run [-args arguments]

Arguments
None.

Options

-args arguments arguments for the target application.

Results
Returns no value.

Errors

run error-not connected If no program loaded onto the target: run error-no program loaded

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

The run command starts the connected target with the supplied arguments. If none are supplied then the arguments are taken from the command line to st40load. Unless specified by the startstate command the start address of the target is the entry point of the loaded program (extracted from the executable file for the loaded program).

AL

EX

TE

RN

If not connected to a target:

AL

EX

TE

RN AL

EX

TE

Syntax

RN AL

run

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 134/168

Alphabetical list of commands

See also
startstate on page 138.

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

RN AL

EX

TE
129

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 135/168

130

Alphabetical list of commands

Specify run time system to use

Arguments

name specifies the name of the run time system to use.

Options

Returns no value.

Errors

If not connected to a target:

The runtime command is used to display and specify the run time operating system for the current target.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

Description

TE

runtime error-not connected

RN

AL

EX

Results

TE

-a[ll] display all supported run time operating systems.

RN AL

EX

runtime [-a] runtime name

TE

Syntax

RN AL

runtime

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 136/168

Alphabetical list of commands

Manage the system options

name specifies the name of the system option.

value specifies the value for the system option.

Options

-q[uiet] quiet mode, do not display value. -create create a system option if it does not exist. -delete delete a system option.

-unlock disable read only lock on a system option.

Results

Returns the value of a system option.

None

EX TE

RN

AL

Errors

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

-lock enable read only lock on a system option.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

Arguments

EX

set name value [-create] set [name] [-q] set name [-delete|-lock|-unlock]

TE

Syntax

RN AL

set

EX

TE
131

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 137/168

132

Alphabetical list of commands

Description

The set command is used to create system options and change their values, display the value of a system option or all system options, lock or unlock a system option for read only access and to delete a system option.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 138/168

Alphabetical list of commands

Set the default output format and mode

setomode [format] [-n|-s|-i]

Options
-s symbolic output mode. Unused. -i instruction output mode. Unused. format is one of the following options: -a ASCII character. -b binary number. -d signed decimal number. -o octal number.

-x hexadecimal number. -f single-precision floating-point number.

Results

Returns no value.

EX TE

RN

Errors
If more than one output mode is supplied: setomode error-only one of -n, -s, -i permitted

AL

EX

-k double-precision floating-point number.

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

-u unsigned decimal number.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

-n non-symbolic output mode. Unused. This is the default.

EX

TE

Syntax

RN AL

setomode

EX

TE
133

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 139/168

134

Alphabetical list of commands

If more than one output format is supplied:

Description

To display the current output mode and format: > setomode omode = -x -n

To set the default output format to signed decimal:

cpumemory on page 62, peek on page 113 and sysregister on page 142.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

See also

EX

> setomode -d

TE

RN AL

Example

EX

The setomode command sets the default output mode and format. These defaults are inherited by other commands when displaying their output. Note that at present the default output mode is unused. If no options are supplied then setomode displays its current settings.

TE

RN AL

setomode error-only one of -f, -k, -d, -u, -x, -o, -b, -a permitted

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 140/168

Alphabetical list of commands

Display all user defined procedure names

showprocs

Arguments
None.

Results
Returns no value.

Errors
None.

Description

clsymbol on page 58.

EX TE

RN

AL

EX

TE

See also

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Displays all user defined command language procedure names.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

EX

TE

Syntax

RN AL

showprocs

EX

TE
135

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 141/168

136

Alphabetical list of commands

Send a backend specific command to the current site

site [-bkcmd command]

Options

Results

Returns the result from the back end (optional).

Errors
If not connected to a target: site error-not connected If no options are supplied:

site error-option -bkcmd required

The site command is used to send commands to the back end.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

Description

RN

AL

EX

TE

RN AL

-bkcmd command specifies the command to be passed to the back end.

EX

TE

Syntax

RN AL

site

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 142/168

Alphabetical list of commands

Sleep for a period of time

sleep msecs

Arguments

Results
Returns no value.

Errors
None.

Description

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

Sleep for the specified period of time (in milliseconds).

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

msecs specifies the number of milliseconds to sleep.

EX

TE

Syntax

RN AL

sleep

EX

TE
137

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 143/168

138

Alphabetical list of commands

Specify the start state

Arguments

htSyncAddr specifies the location of the DTF host to target transfer synchronization word. thSyncAddr specifies the location of the DTF target to host transfer synchronization word.

-pc entryAddr set the initial PC address to entryAddr. The target executes from this address when started by the run command. -dtfon enable the DTF mechanism and set the DTF synchronization addresses to htSyncAddr and thSyncAddr. -dtfoff disable the DTF mechanism.

Results

If no options are supplied:

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

startstate error-option -pc, -dtfon or -dtfoff required If not connected to a target: startstate error-not connected

AL

Errors

EX

Returns no value.

TE

RN

AL

EX

Options

TE

RN AL

EX

startstate [htSyncAddr thSyncAddr] [-pc entryAddr | -dtfon | -dtoff]

TE

Syntax

RN AL

startstate

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 144/168

Alphabetical list of commands

If the target has already been started: startstate error-already running If incompatible options are supplied:

startstate error-only one of -pc, -dtfon, -dtfoff permitted

Description

Example

To load an SRECORD19 executable file and explicitly set its state:

To load an SRECORD19 executable file and to set its state from symbols extracted from its corresponding ELF32 executable file: >load rom.srec >startstate -pc (elfsymbols -file rom.elf -addrof ENTRY_POINT) >startstate -dtfon (elfsymbols -file rom.elf -addrof _ST_DTF_SYNC_HT) (elfsymbols -file rom.elf -addrof _ST_DTF_SYNC_TH)

EX TE

RN

See also
elfsymbols on page 71, load on page 95 and run on page 128.

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

>load rom.srec >startstate -pc 0xac000000 >startstate 0x8a00 0x8a08 -dtfon

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

The startstate command is required when a program is loaded from an executable file format which does not provide the information to allow this state from being automatically set (for example, from an SRECORD19 file) or when starting execution from ROM based systems.

RN AL

If the target has been loaded with a program from an ELF32 executable file then this state is automatically extracted and set during the loading of the ELF32 file (see load on page 95). The information is extracted from the symbol table in the ELF32 executable.

EX

The startstate command is used to setup the state of the connected target prior to starting it (with the run command).

TE

RN AL

EX

TE
139

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 145/168

140

Alphabetical list of commands

Display the definition of a target

status target

Arguments
resource specifies the name of the target.

Results
Returns no value.

Errors

If an incorrect number of arguments is supplied:

If the resource does not exist:

status error-no such target

The status command is used to query the definition of a supplied target.

Example

> status ST40 st40 bkends4sim -instr -little -ncache

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

See also
target on page 147.

AL

EX

TE

Description

RN

AL

status error-invalid command incorrect number of arguments

EX

TE

RN AL

EX

TE

Syntax

RN AL

status

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 146/168

Alphabetical list of commands

Execute a host command

sys command

Arguments

Results

None.

Description

The sys command executes a host command. If arguments are to be passed to the host command then the whole command should be enclosed in double quotes ().

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

Errors

TE

Returns zero on success otherwise return non zero.

RN AL

command specifies the host command to execute, if command contains spaces then it should be enclosed in double quotes.

EX

TE

Syntax

RN AL

sys

EX

TE
141

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 147/168

142

Alphabetical list of commands

Manage memory mapped registers

Arguments

name specifies the name of a register or register group.

readSize specifies the write access size of a register. Default is 4 bytes. writeSize specifies the read access size of a register. Default is readSize. Options

-g[roup] groupName place a register into the group groupName.

-w[riteonly] access type is write only. -v[irtual] access type is virtual.

-q[uiet] quiet mode, do not display value.

-l[ist] display register or group definitions.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

-n[umber] display number of registers or groups. -p[rint] display register values. -delete delete register or group.

AL

-all apply to all registers or groups.

EX

-set value assign value to a register.

TE

RN

-r[eadonly] access type is read only.

AL

EX

TE

address specifies the location of a register.

RN AL

sysregister [-r|-w|-v] sysregister sysregister sysregister

name address [readSize [writeSize]] [-g groupName] name -set value [name] [-q] [-all] [-l] [-n] [-p] [format] [name] [-all] [-delete]

EX

TE

Syntax

RN AL

sysregister

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 148/168

Alphabetical list of commands

-a display as ASCII character. -b display as binary number. -d display as signed decimal number. -o display as octal number. -u display as unsigned decimal number. -x display as hexadecimal number.

-k display as double-precision floating-point number.

Results

Returns the value of a register if the -print option is supplied or the number of registers or groups if the -number option is supplied.

Errors
If not connected to a target:

If address is an undefined memory location: sysregister error-address does not exist If name already exists as a register name: sysregister error-register already exists If name already exists as a group name: sysregister error-register already exists as a group

EX TE

RN

If groupName already exists as a register name:

sysregister error-group already exists as a register

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

sysregister error-not connected

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

-f display as single-precision floating-point number.

EX

TE

RN AL

format is one of the following options which override the default output format (see setomode on page 133):

EX

TE
143

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 149/168

144

Alphabetical list of commands

If readSize is an invalid read access size: sysregister error-invalid read access size If writeSize is an invalid write access size: sysregister error-invalid write access size

sysregister error-address not aligned to read access size If the address is not aligned to the write access size writeSize: sysregister error-address not aligned to write access size If a register name is supplied and the register does not exist: sysregister error-register does not exist

If a group name is supplied and the group does not exist: sysregister error-group does not exist

sysregister error-read only access

Description

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

Register values can be displayed with the sysregister command by single register or group name and can be displayed in various formats (or the default format as specified by the setomode command). The register address and read access size are also displayed. With the -all option, all register values are displayed. The following form of the sysregister command is used to display register values: sysregister [name] [-q] [-all] [-p] [format]

AL

EX

sysregister name address [readSize [writeSize]] [-g groupName] [-r|-w|-v]

TE

With the sysregister command, memory mapped registers can be defined by associating a name with an address. Optionally the access size, access type and associated group may also be supplied when defining a register. The following form of the sysregister command is used to define registers:

RN

AL

EX

If setting a register and the register is read only:

TE

RN AL

EX

TE

If the address is not aligned to the read access size readSize:

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 150/168

Alphabetical list of commands

sysregister [name] [-all] [-l]

sysregister [name] [-all] [-n]

sysregister name -set value

sysregister [name] [-all] [-delete]

To define a register TEST at address 0xac000000 with a read access size of 4: > sysregister TEST 0xac000000 4 To display the definition of a register: > sysregister -l TEST TEST (0xac000000) 4 byte read 4 byte write readwrite To display the value of a register:

EX TE

RN

To set the value of a register: > sysregister TEST -set 0x12345678 > sysregister -p TEST TEST 4 0xac000000 0x12345678

AL

> sysregister -p TEST TEST 4 0xac000000 0x00000000

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

Example

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

A single register or a group can be deleted. With the -all option all registers are deleted. The following form of the sysregister command is used to delete registers or groups:

RN AL

The value of a single register can be set. The following form of the sysregister command is used to set the value of a register:

EX

The number of registers in a group can be displayed with the sysregister command. With the -all option the total number of registers are displayed. The following form of the sysregister command is used to display the number of registers:

TE

RN AL

Register definitions can be displayed with the sysregister command by single register or group name. With the -all option all register definitions are displayed. The following form of the sysregister command is used to display register definitions:

EX

TE
145

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 151/168

146

Alphabetical list of commands

To define a set of registers in a group: > sysregister TEST1 0xac000010 4 -group TESTGRP > sysregister TEST2 0xac000020 2 -w -group TESTGRP > sysregister TEST3 0xac000030 1 -group TESTGRP To display the values of registers in a group: > sysregister -p TESTGRP TEST1 4 0xac000010 0x00000000 TEST2 2 0xac000020 writeonly TEST3 1 0xac000030 0x00 To display the value of a register in binary format:

> sysregister -p -b TEST TEST 4 0xac000000 0b00010010001101000101011001111000 To delete a register: > sysregister -delete TEST2 > sysregister -p TESTGRP TEST1 4 0xac000010 0x00000000 TEST3 1 0xac000030 0x00

peek on page 113 and poke on page 116.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

See also

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 152/168

Alphabetical list of commands

Manage the targets

targetName specifies the name of the target.

dllName specifies the name of the associated DLL.

procName specifies the command language procedure to execute on connection.

Options

-q[uiet] quiet mode, do not display targets.

-dll display only the DLL of targetName.

-connected display only connected targets. -name display only name of defined targets.

EX TE

RN

Returns the full target list, the active targets or the configuration of a target.

AL

Results

EX

TE

-proc display only the connection procedure of targetName.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

-args display only the arguments of targetName.

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

arguments specifies the arguments specific to the type of connection.

RN AL

Arguments

EX

target targetName dllName arguments [procName] target targetName [-q] [-args|-dll|-proc] target [-q] [-connected|-name]

TE

Syntax

RN AL

target

EX

TE
147

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 153/168

148

Alphabetical list of commands

Errors
If an invalid targetName is supplied: target error-no such target If dllName does not exist when connecting to a target: #target error: DLL not found connect error-DLL not found

If dllName is not a valid version when connecting to a target: # target error: dllName: DLL version [X], expected version[Y] target error-DLL major version incompatible If dllName allows fewer active instances than requested when starting a plugin tool: # plugin error: backend[dllName] only supports up to X simultaneous instances connect error-unable to open connection

Description

Under st40load the dllName argument is ignored.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

dllpath on page 68.

TE

See also

RN

AL

The target command is used to define new targets that can be connected to under st40load. If no arguments are supplied then the target command displays all available targets.

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 154/168

Alphabetical list of commands

Select a token from a string

token string position [-l]

Arguments

position specifies the location of the token in the string.

Options

-l[ine] set the token separator to new line (\n). The default token separators are space, tab (\t) and new line.

Results

Returns a string which is the selected token.

Errors

token error-invalid command incorrect number of arguments

Description

EX TE

RN

AL

The token command is used to return a token from the string whose location is specified by position.

EX

TE

If an incorrect number of arguments is supplied:

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

string specifies the string from which to select a token.

EX

TE

Syntax

RN AL

token

EX

TE
149

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 155/168

150

Alphabetical list of commands

Example
To return the third token from the string a b c d > x = (token a b c d 3) > write (x) c

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 156/168

Alphabetical list of commands

Setup commands to be executed on event occurrence

when ( [eventId] ) [variableList] { commands }

Arguments

variableList specifies a list of local command language variable declarations, used by the command language program that follows it. The variables in the list are separated by semicolons (;). Each declaration consists of an assignment, that is, the variable name followed by = followed by an initial value. commands specifies the command language program to be executed when the event eventId is raised.

Results

Returns an integer identifier which can be used to remove the when program.

Description

When an event is deleted, each when set on that event is removed.

EX TE

RN

Example
To create a when program for all events:

> when () count = 0 { write Number of events = (count++) }

AL

A when program for an eventId that does not exist is not an error, the when program takes effect when the event is created and is fired.

EX

TE

The when command allows the user to specify commands to be executed on the arrival of all events or on a supplied eventId. If no eventId is supplied then the when command applies to all events.

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

eventId specifies the integer identifier of an event.

EX

TE

Syntax

RN AL

when

EX

TE
151

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 157/168

152

Alphabetical list of commands

See also
event on page 74, forcewhen on page 84 and remove on page 121.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 158/168

Alphabetical list of commands

Display a list of strings

write [-n] [format] string [[format] string] ... [-- stringList]

Arguments

stringList specifies a list of strings to be written without formatting.

-n suppress the output of a new line character. format is one of the following options: -b or -b* binary number. -c ASCII character.

-d signed decimal number. -o or -o* octal number.

-u unsigned decimal number.

-- do not interpret any format options after this option.

Results

EX TE

RN

Returns no value.

Errors
None.

AL

EX

-x or -x* hexadecimal number.

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

Options

RN AL

string specifies a string to be written in the preceding format, if any, or in decimal if no format is supplied.

EX

TE

Syntax

RN AL

write

EX

TE
153

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 159/168

154

Alphabetical list of commands

Description

See also

fwrite on page 90 and mkstr on page 108.

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

> write hello world hello world > x = 42 > write x is (x) x is 42 > write x is -x (x) in hex x is 0x000000000000002a in hex > array = [1, 2, foo => bar, [3, 4]] > write (array) foo=bar 0=1 1=2 3=<array> > write the ascii character of 42 is -c 42 the ascii character of 42 is *

EX

TE

RN AL

EX

Example

TE

The write command writes a message to the standard output. The message may include expressions to be evaluated. Each expression is enclosed in round brackets (). If an expression evaluates to an array, the names and values of the elements are listed. Note that arguments to the format options are formatted to the minimum width except for the -b, -o and -x options whose arguments are formatted to the maximum width.

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 160/168

Version B

Date Nov 02

Made minor changes to grammar throughout. Updated Results section for the loadimage command in Appendix B: Command language.

Oct 02

First complete version, submitted to ADCS

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

Comments

EX

TE

Revision history

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 161/168

156

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 162/168

Symbols
## 32, 34 #line 50

addhelp 51 address 14-15 append strings to file 76 arguments 49

B
backend command send to site 136 backends supplied 15

EX TE

cd 52 character 33-34, 36, 44 chip 53 chip type 53 clerror 55 clinfo 57 close file 78 clsymbol 58 command file 44

AL

EX

TE

RN

AL

EX

RN

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

STMicroelectronics ST40 Loader and Command Language Reference Manual

TE

RN AL

command help 92 command line 1-2, 4-6, 17-21, 23 command line options 4 command name 49 commands 3, 58 execute 141 execute on event 151 invoke 73 related 49 connect 60 connect to target 60 connection type 147 convert number to string 108 string to number 106 core CPU type 65, 118 cpumemory 62 cputype 65 current working directory 119

D
data 34 debugging level of information 57 default output format 133 default output mode 133

EX

TE

Index

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 163/168

158

E
ELF32 95 symbol table 71 elfsymbols 71 EMI 10, 31 endian big endian 15 little endian 15 end-of-file 79 environment variable get value 91 errors 49 define behavior 55 ethernet 1 eval 73 event execute when clause 74, 84 event 74 example 49 execute host command 141 execute program 111 exit st40load 120

AL

EX

RN

TE

EX

AL

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

TE

RN AL

description 49 directory add to search space 66 change 52 display current 119 make 105 remove 127 directory 66 disconnect 67 DLL search path 68 dllpath 68 dump 69 dump memory to file 69

F
fappend 76 fclose 78 feof 79 fgets 80 file close 78 open 82 read line 80 read value into variable 88 remove list 126 rename 110 write strings to file 86, 90 file pointer 125 filename 36, 50 fopen 82 forcewhen 84 fputs 86 fread 88 function 35-36 fwrite 90

G
getenv 91

H
help display 92 help 92

I
include 93 interactive mode 3 invoke command 73 invoke procedure 73

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 164/168

L
line number 50 literal integers 35 load 95 load target with executable 95 load target with image 97 loadimage 97 log 99 log command output to file 99

M
make directories 105 memcpy 100 memory display block 64 display contents 62 dump to file 69 organization 10 write string 100 write value 116 memory 11, 101 memory configuration 31 memory locations read value 113 write repeating value 103 memory mapped registers 10, 142 memory segments 11 defining 10, 14 managing 101 memory system 14 memset 103 mkdir 105 mknum 106 mkstr 108

EX

AL

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

STMicroelectronics ST40 Loader and Command Language Reference Manual

TE

RN AL

object command language 35 remove 121 open file 82 operands 33 options 49 st40load command line options 2 output commands to file 99

P
parse 111 parse program 111 path mappings 112 pathmap 112 peek 113 physical memory contents 62 PLL 10, 31 plugin 115 plugin tools 115 poke 116 precision double 62, 133, 143 single 62, 133, 143

EX

notation v, 34 number convert to string 108

TE

RN AL

modes batch mode 2-4 interactive mode 3-4 move pointer to start of file 125 mv 110

EX

TE
159

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 165/168

160

Q
quit 120

R
read from file into variable 88 from memory location 113 line from file 80 registers defining 145 initialize contents 14 memory mapped 142 remove directories 127 files 126 named object 121 remove 121 rename file 110 reset 123 reset target 10, 123 results 49 rewind 125 rm 126 rmdir 127 run 128 run program 128 run time system 130 runtime 130

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

procedures 58 add help 51 display user defined names 135 invoke 73 processor 118 program parse and execute 111 run 128 pwd 119

S
script file include 93 scripts #line 50 .st40loadrc 5-6 command language 44, 66 st40load.cfg 5 st40load.rc 5-6 startup 5, 11, 23 vmlinuxprocs.cfg 17 search path 66, 68 search space add directory 66 select token from string 149 send backend command 136 set 131 setomode 133 showprocs 135 site 136 sleep 137 special characters 34 specify run time system 130 specifying the target 14 SRECORD19 95 ST Micro Connect 1, 15 st40load command line options 2 exit 120 standard backends 15 start state specify 138 startstate 138 startup scripts 5 status 140 strings append list to a file 76 convert to number 106

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 166/168

EX TE

RN

AL

EX

TE

Copyright STMicroelectronics

ADCS 7465468B

EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited

RN

target connect 60 core CPU type 118 defining hardware 10 disconnect 67 display definition 140 managing 147 managing memory segments 101 reset 123 specifying 14 target 147 token 149 type conversion 40

AL

STMicroelectronics ST40 Loader and Command Language Reference Manual

EX

TE

RN AL

when 151 write continuous memory locations 103 repeating value 103 strings to file 86, 90 to memory location 100, 116 write 153

EX

display list 153 select token 149 write to file 86, 90 symbol table ELF32 file 71 syntax 49 command language 35-36, 44 defining a procedure 42 sys 141 sysregister 142 system options 131

V
variables 58

TE

RN AL

UDI 9 user defined procedure names 135

EX

TE
161

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 167/168

162

EX TE

Copyright STMicroelectronics

STMicroelectronics EXTERNAL EXTERNAL EXTERNAL EXTERNAL EXTERNAL Unauthorized reproduction and communication strictly prohibited ST40 Loader and Command Language Reference Manual ADCS 7465468B

RN

AL

EX

TE

RN

AL

EX

TE

RN AL

EX

TE

RN AL

EX

TE

DOCUMENT 7465468

REVISION B

CONTROLLED DOCUMENT

(Check latest revision)

DATE 14-NOV-2002

page: 168/168

Anda mungkin juga menyukai