• Keine Ergebnisse gefunden

Automatic Insertion/Removal/Correction of "pset" Instruction

CHAPTER 6 L INKER

6.11 Automatic Insertion/Removal/Correction of "pset" Instruction

To branch the program sequence to another page, the pset instruction is required immediately before a branch instruction (jp or call) is executed. Since the location of relocatable sections is not decided until the linking process is completed, the linker has a function that automatically inserts, removes or corrects the pset codes. This makes it possible to omit the pset instruction in the source. However, this function is valid only for the branch instructions that use a label to specify the destination address.

This function can be disabled by specifying the -d option. The -dr option can also be specified to disable only the pset deletion function (in the case of the -d option is not specified). To keep compatibility with the older assembler asm62XX (when the sources for the asm62XX are used), the -dr option must be specified.

For jp instruction

First the linker checks if the destination label and the jp instruction are within the same page.

If the label exists in the same page, the linker does not insert the pset code, or remove the existing one for the jp instruction.

When the label exists in another bank/page, the linker inserts the adequate pset instruction code in front of the jp instruction, or corrects the bank/page number in the pset code if the pset code has a wrong operand.

Examples:

Original (source) After corrected (disassembled code)

ld a,b ld a,b

jp OTHER_PAGE pset XX ... Necessary "pset XX" instruction is inserted.

jp OTHER_PAGE

pset YY jp SAME_PAGE

jp SAME_PAGE ... "pset YY" is removed if unnecessary.

Even when "pset YY" is necessary, YY is checked and corrected if wrong.

For call instruction

Subroutine calls between banks are not allowed because the return instructions cannot handle bank numbers. Therefore if a wrong call is made between banks, an error will result. This occurs only when the section that calls the subroutine and the section in which the subroutine exists are absolute sections and are in different banks. Relocatable sections are located so that a cross bank call does not occur. If the subroutine call is made within the same bank, the optimization process is the same as that for the jp instruction.

Examples:

Original (source) After corrected (disassembled code)

ld a,b ld a,b

call SUBROUTINE pset XX

call SUBROUTINE

... Necessary "pset XX" instruction is inserted.

If both the subroutine and current section are absolute and are in different banks, an error will result.

pset YY call SUBROUTINE

call SUBROUTINE ... "pset YY" is removed if unnecessary.

Even when "pset YY" is necessary, YY is checked and corrected if wrong.

If both the subroutine and current section are absolute and are in different banks, an error will result.

∗ If the -dr option is specified, existing pset instructions will not be removed.

6.12 Error/Warning Messages

6.12.1 Errors

When an error occurs, the linker will immediately terminate the processing after displaying an error message. No object file will be output. Other files will be delivered only in the part which was processed prior to the occurrence of the error.

The error messages are given below.

Error message Description

Calling different bank at <address> The call instruction calls a subroutine in another bank.

Cannot create <file kind> file <FILE NAME> The file cannot be created.

Cannot open <file kind> file <FILE NAME> The file cannot be opened.

Cannot read <file kind> file <FILE NAME> The file cannot be read.

Cannot write <file kind> file <FILE NAME> Data cannot be written to the file.

Illegal file name <FILE NAME> The file name is incorrect.

Illegal file name <FILE NAME> specified with The file name specified with the option is incorrect.

option <option>

Illegal ICE parameter at line <line number> of The ICE parameter file contains an illegal parameter setting.

<FILE NAME>

Illegal object format <FILE NAME> The input file is not an object file in IEEE-695 format.

Illegal option <option> An illegal option is specified.

Memory mapping conflict at <Section type> section The address range of the section is duplicated.

<address> - <address>

No address specified with option <option> Address is not specified with the option.

No code to locate There is no valid code for mapping.

No debug information in <FILE NAME> Debugging information is not included in the file.

No ICE parameter file specified ICE parameter file is not specified.

No name and address specified with option <option> Name and address are not specified with the option.

No object file specified Object files to be linked are not specified.

Out of memory Cannot secure memory space.

Page overflow at <Section type> section The section is across the page boundary.

<address> - <address>

Processor characteristics of object file <FILE NAME> The object file is not matched to the specification in the ICE

mismatch parameter file.

Second definition of Label <label> in <FILE NAME> The label has already been defined.

Unavailable instruction code <instruction code> The object contains an instruction invalid for the model.

detected in <FILE NAME>

Unavailable memory mapped at <Section type> There is no valid memory space for allocating the section.

<address> - <address>

Unresolved external <label> in <FILE NAME> Reference was made to an undefined symbol.

6.12.2 Warning

Even when a warning appears, the linker continues with the processing. It completes the processing after displaying a warning message, unless, in addition, an error takes place. The output files will all be delivered, but the operation of the program cannot be guaranteed.

The warning messages and their contents are given below.

Warning message Description

Cannot open <file kind> file <FILE NAME> The file cannot be opened.

No symbols found Symbols cannot be found.

6.13 Precautions

(1) Upper limits, such as a maximum section count and the number of objects to be linked, depend on the free memory space.

(2) The -dr option (disabling pset deletion) is provided to keep compatibility with the older assembler asm62XX. It must be specified to create the same object as one that is created with the asm62XX.

(3) To load the absolute object file created by the linker to the debugger, the same ICE parameter file must be specified when the debugger is invoked.

(4) The optimization for relocatable sections by the -or option depend on the free space in the page and absolute section mapping condition. Therefore, the result cannot be guaranteed to be optimal.