Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
59
Добавлен:
14.04.2015
Размер:
2.03 Mб
Скачать

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

351

 

 

High-Level Language Controls

The Lx51 linker/locator provides controls that have to do with the high-level

9

languages Cx51 and PL/M-51 and the real-time operating systems RTXx51.

For example, you can control whether or not the Lx51 linker/locator includes

 

 

automatically the run-time library and whether or overlays the local variable

 

 

areas of C and PL/M-51 functions.

 

 

 

 

The following table provides an overview of these controls. For a detailed

 

 

description of each control refer to the page specified in the table.

 

 

 

 

 

 

 

 

BL51

LX51, L251

Page

Description

 

 

NODEFAULT

NODEFAULT

352

Excludes modules from the run-time

 

 

LIBRARY

LIBRARY

 

libraries.

 

 

NOOVERLAY

NOOVERLAY

353

Prevents overlaying or overlapping local bit

 

 

 

 

 

and data segments.

 

 

OVERLAY

OVERLAY

354

Lets you change call references between

 

 

 

 

 

functions and segments for data overlaying

 

 

 

 

 

program flow analysis.

 

 

RECURSIONS

RECURSIONS

356

Allows you to analyze the call tree of

 

 

 

 

 

complex recursive applications.

 

 

REGFILE

REGFILE

356

Specifies the name of the generated file to

 

 

 

 

 

contain register usage information.

 

 

RTX251

358

Includes support for the RTX-251 full

 

 

 

 

 

real-time kernel.

 

 

RTX51

RTX51

358

Includes support for the RTX-51 full

 

 

 

 

 

real-time kernel.

 

 

RTX51TINY

RTX51TINY

358

Includes support for the RTX-51 tiny

 

 

 

 

 

real-time kernel.

 

 

SPEEDOVL

359

Ignore during the overlay analysis

 

 

 

 

 

references from constant segments to

 

 

 

 

 

program code.

 

 

 

 

 

 

 

 

 

352

Chapter 9. Linker/Locator

 

 

 

NODEFAULTLIBRARY

9

Abbreviation:

NLIB

 

Arguments:

None

 

Default:

The run-time libraries of Cx51, RTXx51, and PL/M-51 are

 

 

searched to resolve external references in your C or PL/M

 

 

programs.

The path of the run-time libraries can be set for BL51 and LX51 with the C51LIB environment variable and for L251 with the C251LIB environment variable. This variable is the defined with the SET command that is typically entered in the AUTOEXEC.BAT batch file as shown below:

SET C51LIB=C:\KEIL\C51\LIB

In µVision2 the path for run-time libraries can be specified in the dialog Project – File Extensions, Books and Environment under environment setup – LIB folder.

If no environment variable is set, the linker tries to locate the libraries in: path_of_the_EXE_file\..\LIB\. In a typical installation of the tool chain this sets the correct path for the run-time libraries to \C51\LIB\ or \C251\LIB. These folders contain the run-time libraries for the Cx51 compiler and the RTXx51 real-time operating system.

The libraries that are automatically searched depend on the memory model and floating-point requirements of your application. For more information refer to the Cx51 Compiler User’s Guide.

µVision2 Control: Options – Lx51 Misc – Misc Controls: enter the control.

Description: Use the NODEFAULTLIBRARY control to prevent the

Lx51 linker/locator from automatically including run-time libraries.

Example:

BL51 MYPROG.OBJ NODEFAULTLIBRARY

 

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

353

 

 

NOOVERLAY

Abbreviation:

NOOL

9

 

Arguments:

None

 

Default:

The Lx51 linker/locater is analyzing your program and

 

 

overlays the segments of local variables and function

 

 

arguments.

 

µVision2 Control: Options – Lx51 Misc – Misc Controls: enter the control.

Description: The NOOVERLAY control disables the overlay analysis and the data overlaying. When this control is specified, the Lx51 linker/locator does not overlay the data space of local variables and function arguments.

Examples:

LX51 MYPROG.OBJ NOOVERLAY

 

 

354

Chapter 9. Linker/Locator

 

 

 

 

OVERLAY

 

9

Abbreviation:

OL

 

Arguments:

OVERLAY (sfname { ! | ~ } sfname , … )

 

 

OVERLAY (sfname { ! | ~ } (sfname, sfname , … ) , … )

 

 

OVERLAY (sfname ! *)

 

 

OVERLAY (* ! sfname)

 

Default:

The Lx51 linker/locater is analyses the call tree of your

 

 

program and assumes normal program flow without indirect

 

 

calls via function pointers.

µVision2 Control: Options – Lx51 Misc – Overlay.

Description: The OVERLAY control allows you to modify the call tree as it is recognized by the Lx51 linker/locater in the overlay analysis. Adjustments to the program call tree are typically required when your application uses function pointers or contains virtual program jumps as it is the case in the scheduler of a real-time operating system. The different forms of the overlay control are shown below:

Control Specification

Description

OVERLAY (* ! sfname)

Add new root for sfname.

OVERLAY (sfname ! *)

Exclude sfname from the

 

overlay analysis and locate

 

data & bit segments in non-

 

overlaid memory. This

 

does not influence data

 

overlaying of other

 

functions.

OVERLAY (sfname ! sfname1)

Add virtual call references

OVERLAY (sfname ! (sfname1, sfname2))

to segments or functions.

OVERLAY (sfname ~ sfname1)

Ignore call references

OVERLAY (sfname ~ (sfname1, sfname2))

between segments or

 

functions.

sfname can be the name of a function or a segment.

Refer to “Using the Overlay Control” on page 282 for program examples that require the OVERLAY control.

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

355

 

 

Examples:

Identify tasks of a real-time OS

Exclude a function from overlaying

Add virtual function calls

Ignore references or function calls

If your application uses a real-time operating system, each task function might be an own program path or root and the

call tree of that task must be independently analyzed. This 9 is required since the task can be terminated (i.e. by a time-

out) and a previously terminated task becomes running again. In the following example Lx51 handles the functions TASK0 and TASK1 as independent programs or call trees:

LX51 SAMPLE.OBJ OVERLAY (* ! TASK0, TASK1)

NOTE

Task functions of the RTXx51 real-time operating system are automatically handled as in depended program roots. The OVERLAY control is not required for RTXx51 tasks.

In the next example, the local data and bit segments of FUNC1 are excluded from data overlaying. This does not influence data overlaying of other functions.

BL51 SAMPLE.OBJ OVERLAY (FUNC1 ! *)

You may add virtual references or functions calls for between segments or functions. In the following example, Lx51 thinks during the overlay analysis that function FUNC1 calls FUNC2 and FUNC3 even when no real calls exist.

BL51 CMODUL1.OBJ OVERLAY (FUNC1 ! (FUNC2, FUNC3))

You may delete or remove references between segments or functions. The next example Lx51 ignores during overlay analysis the references to the ?PR?MAINMOD segment from

FUNC1 and FUNC2:

BL51 MAINMOD.OBJ, TEXTOUT.OBJ &

OVERLAY (FUNC1 ~ ?PR?MAINMOD, FUNC2 ~ ?PR?MAINMOD)

 

356

Chapter 9. Linker/Locator

 

 

 

 

 

 

RECURSIONS

9

Abbreviation:

RC

 

Arguments:

RECURSIONS (number of recursions)

 

Default:

RECURSIONS (10)

 

µVision2 Control:

Options – Lx51 Misc – Misc Controls: enter the control.

 

Description:

The RECURSIONS control allows you to specify the

 

 

number of recursions that are allowed before the Lx51

 

 

linker/locator responds with:

 

 

 

 

 

 

FATAL ERROR 232: APPLICATION CONTAINS TOO MANY RECURSIONS.

 

 

 

Each time the linker encounters a recursive call during the

 

 

overlay analysis of the application, this recursive call is

 

 

automatically removed from the call tree and the overlay

 

 

analysis is restarted. You might increase the number of

 

 

accepted recursions on very complex recursive applications.

 

 

However this might increase significantly the execution time

 

 

of the Lx51 linker/locater.

 

 

If your application contains many pointer to function tables,

 

 

you might receive the FATAL ERROR 232 before you have

 

 

corrected the call tree with the OVERLAY control. The

 

 

RECURSIONS control allows you in such situations to

 

 

analysis the OVERLAY MAP of your application. Refer to

 

 

“Pointer to a Function in Arrays or Tables” on page 286 for

 

 

more information on correcting the call tree.

 

See Also:

OVERLAY, SPEEDOVL

 

Example:

 

 

 

 

LX51 MYPROG.OBJ,A.OBJ,B.OBJ RECURSIONS (100)

 

 

 

 

 

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

357

 

 

REGFILE

Abbreviation:

RF

9

 

Arguments:

REGFILE (filename)

 

Default:

No register usage file is generated.

 

µVision2 Control:

Options – Cx51 Compiler – Global Register Coloring.

 

Description:

The REGFILE control allows you to specify the name of

 

 

the register usage file generated by the Lx51 linker/locator.

 

 

The information in this file is used for global register

 

 

optimization by the Cx51 compiler. The register usage

 

 

information allows the Cx51 compiler to optimize the use of

 

 

registers when calling external functions.

 

Example:

In this example, the LX51 linker/locator generates the file

 

 

MYPROG.REG that contains register usage information.

 

LX51 MYPROG.OBJ,A.OBJ,B.OBJ REGFILE(MYPROG.REG)

 

358

 

Chapter 9. Linker/Locator

 

 

 

 

 

 

RTX251, RTX51, RTX51TINY

9

Abbreviation:

None

 

 

 

Arguments:

None

 

 

 

Default:

None

 

 

 

µVision2 Control:

Options – Target – Operating System.

 

Description:

These controls specify to the Lx51 linker/locator that the

 

 

application should be linked for use with the RTXx51 real-

 

 

time multitasking operating system. This involves resolving

 

 

references within your program to RTXx51 functions found

 

 

in the library of the real-time operating system.

 

 

The control that you should use, depends on the real-time

 

 

operating system that you are using in your application:

 

 

 

 

 

 

 

Control

Real-Time Operating System used

 

 

 

RTX251

RTX251 Full Multitasking RTOS.

 

 

 

RTX51

RTX51 Full Multitasking RTOS.

 

 

 

RTX51TINY

RTX51 Tiny Multitasking RTOS.

 

 

Examples:

Linker/Locater invocation for RTX51 Full:

 

 

 

 

 

BL51 RTX_EX1.OBJ RTX51

 

 

 

Linker/Locater invocation for RTX251 Full:

 

 

 

 

 

L251 RTX_EX1.OBJ RTX251

 

Keil Software — A51/AX51/A251 Macro Assembler and Utilities

359

 

 

SPEEDOVL

Restriction:

This control is available in BL51 only. LX51 and L251

9

 

always ignore references from constant segments to program

 

code during the overlay analysis.

 

Abbreviation:

SP

 

Arguments:

None

 

Default:

BL51 does not ignore the references from constant segments

 

 

to program code during the overlay analysis.

 

µVision2 Control: Options – BL51 Misc – Misc Controls: enter the control.

 

Description:

The RECURSIONS control instructs BL51 to ignore

 

 

references from constant segments to program code during

 

 

the overlay analysis. This improves the execution speed of

 

 

the BL51 linker/locater during overlay analysis and is useful

 

 

for applications that are using “Pointer to a Function in

 

 

Arrays or Tables” as described on page 286. However, the

 

 

usage of the SPEEDOVL control makes the linker

 

 

incompatible to existing applications that are using the

 

 

OVERLAY control to correct the call tree of the

 

 

application.

 

See Also:

OVERLAY, SPEEDOVL

 

Example:

 

 

 

BL51 MYPROG.OBJ SPEEDOVL

 

 

 

 

 

Соседние файлы в папке HLP