• Aucun résultat trouvé

LO - Load S-Records from Host

Dans le document User’s ManualPart 1 and 2 (Page 186-191)

Command Input

LO [PORT] [ADDR] [;[X] [C] [T]] [=text]

Arguments

Options

More than one option may be used.

PORT Port to be used for the downloading.

The default is port 1.

ADDR Offset address which is to be added to the address contained in the address field of each record. This causes the records to be stored to memory at different locations than would normally occur. The contents of the automatic offset register are not added to the S-record addresses.

X Echo the S-records to your terminal as they are read in at the host port.

C Ignore checksum. A checksum for the data contained within an S-record is calculated as the S-S-record is read in at the port. Normally, this calculated checksum is compared to the checksum contained within the S-record and if the compare fails, an error message is sent to the screen on completion of the download. If this option is selected, then the comparison is not made.

T System Call code. This option causes LO to set the target register R04 to ‘LO$01’ ($4C4F2001).

The ASCII string LO indicates the LO command. The code $01 indicates system call support with stack parameter/result passing and system call disk support.

This code can be used by the downloaded program to select the appropriate calling convention when invoking debugger functions (necessary because some Motorola debuggers use conventions different from PPCBug, and they set a different code in R05).

Debugger Commands

3

Description

The LO command downloads Motorola S-record files from a host system to the debugger host. The LO command accepts serial data from the host and loads it into memory.

Note You can download S-records at any baud rate supported by both the debugger and the host system. If the X option is specified, make sure that the baud rate of the host system is less than or equal to the baud rate of the console. If there are any problems loading the records, reduce the baud rate of the host.

In order to accommodate host systems that echo all received characters, the above-mentioned text string is sent to the host one character at a time and characters received from the host are read one-at-a-time. After the entire command has been sent to the host, LO keeps looking for a line feed (LF) character from the host, signifying the end of the echoed command. No data records are processed until this <LF> is received. If the host system does not echo characters, LO still keeps looking for a <LF> character before data records are processed. For this reason, it is required in situations where the host system does not echo characters, that the first record transferred by the host system be a header record. The header record is not used but the <LF> after the header record serves to break LO out of the loop so that data records are processed.

=text The command that is sent to the host before the debugger begins to look for S-records at the host port. The command is sent to the host device to initiate the download. Do not enclose text in quote marks.

Do not separate the = and text with a space. If the host is operating full duplex, the string is also echoed back to the host port by the host and appears on your terminal screen.

3

If a non-hexadecimal character is encountered within the data field of a data record, then the part of the record which had been received up to that time is printed to the screen and the PPCBug error handler is invoked to point to the faulty character.

If the embedded checksum of a record does not agree with the checksum calculated by PPCBug and if the checksum comparison has not been disabled via the C option, then an error condition exists. A message is output stating the address of the record (as obtained from the address field of the record), the calculated checksum, and the checksum read with the record. A copy of the record is also output. This is a fatal error and causes the command to abort.

When a load is in progress, each data byte is written to memory and then the contents of this memory location are compared to the data to determine if the data stored properly. If for some reason the compare fails, then a message is output stating the address where the data was to be stored, the data written, and the data read back during the compare. This is also a fatal error and causes the command to abort.

Because processing of the S-records is done character-by-character, any data that was deemed good will have already been stored to memory if the command aborts due to an error.

Example

For this example, assume that a host system was used to create the following program:

.file “test.s”

#

# retrieve contents of the RTC registers

#

.toc

T.FD: .tc FD.4330000080000000[tc] ,1127219200,-2147483648 .toc

Debugger Commands

Also assume program has been compiled and linked to start at address 65040000, and the program was converted into an S-record file named test.mx as follows:

S325650400007C8402A6908300007C8502A6908300044E80002000000000650400006504002412 S30D65040020000000000000000069

S7056504000091

Load this file into memory for execution at address $40000 as follows:

PPC1-Bug>TM <Return>

Escape character: $01=^A.

Go into transparent mode to establish host link, input the necessary character sequences to gain access to the S-Record file test.mx.

.

3

PPC1-Bug>LO ,,-65000000 ;X=cat test.mx <Return>

cat test.mx

The S-records are echoed to the terminal because of the X option.

The offset address of -65000000 was added to the addresses of the records in TEST.MX and caused the program to be loaded to memory starting at

$40000. The text cat test.mx is an operating system command line that caused the file to be copied by the operating system to the port which is connected with the debugger host’s host port.

PPC1-Bug>DS 40000,40014 <Return>

The target IP now contains the entry point of the code in memory ($40000). SPR0 =00000000 SPR1 =00000000 SPR8 =00020014 SPR9 =00000000 00040000 7C8402A6 MFSPR R4,4

PPC1-Bug>

Debugger Commands

3

Dans le document User’s ManualPart 1 and 2 (Page 186-191)