• Aucun résultat trouvé

Command Reference

Dans le document Getting Started with µVision2 (Page 3-200)

Document Conventions

This document uses the following conventions:

Examples Description

README.TXT Bold capital text is used for the names of executable programs, data files, source files, environment variables, and commands you enter at the command prompt. This text usually represents commands that you must type in literally. For example:

CLS DIR BL51.EXE

Note that you are not required to enter these commands using all capital letters.

Courier Text in this typeface is used to represent information that displays on screen or prints at the printer.

This typeface is also used within the text when discussing or describing command line items.

Variables Text in italics represents information that you must provide. For example, projectfile in a syntax string means that you must supply the actual project file name.

Occasionally, italics are also used to emphasize words in the text.

Elements that

repeat… Ellipses (…) are used to indicate an item that may be repeated.

Omitted code : :

Vertical ellipses are used in source code listings to indicate that a fragment of the program is omitted. For example:

Void main (void) { :

:

while (1);

Optional Items Double brackets indicate optional items in command lines and input fields.

For example:

C51 TEST.C PRINT (filename)

{ opt1 | opt2 } Text contained within braces, separated by a vertical bar represents a group of items from which one must be chosen. The braces enclose all of the choices and the vertical bars separate the choices. One item in the list must be selected.

Keys Text in this sans serif typeface represents actual keys on the keyboard.

For example, “Press Enter to continue.”

Point Move the mouse until the mouse pointer rests on the item desired.

Click Quickly press and release a mouse button while pointing at the item to be selected.

Drag Press the left mouse button while on a selected item. Then, hold the button down while moving the mouse. When the item to be selected is at the desired position, release the button.

Double-Click Click the mouse button twice in rapid succession.

Contents

Chapter 1. Introduction...9

Manual Topics ... 10

Changes to the Documentation ... 10

Evaluation Kits and Production Kits... 11

Types of Users ... 11

Requesting Assistance... 12

Software Development Cycle ... 13

Product Overview ... 16

Chapter 2. Installation...19

System Requirements... 19

Installation Details ... 19

Folder Structure ... 20

Chapter 3. Development Tools...21

µVision2 Integrated Development Environment ... 21

C51 Optimizing C Cross Compiler ... 32

A51 Macro Assembler ... 49

BL51 Code Banking Linker/Locator ... 51

LIB51 Library Manager... 54

OC51 Banked Object File Converter... 55

OH51 Object-Hex Converter ... 55

Chapter 4. Creating Applications...57

Creating Projects... 57

Project Targets and File Groups ... 64

Overview of Configuration Dialogs... 66

Code Banking ... 67

µVision2 Utilities... 69

Writing Optimum Code ... 78

Tips and Tricks ... 82

Chapter 5. Testing Programs...93

µVision2 Debugger... 93

Debug Commands... 107

Expressions... 110

Tips and Tricks ... 126

Chapter 6. µVision2 Debug Functions ...131

Creating Functions... 131

Invoking Functions ... 133

Function Classes ... 133

Differences Between Debug Functions and C... 147

Differences Between dScope and the µVision2 Debugger ... 148

Chapter 7. Sample Programs...149

HELLO: Your First 8051 C Program...150

MEASURE: A Remote Measurement System ...155

Chapter 8. RTX-51 Real-Time Operating System...169

Introduction...169

RTX51 Technical Data ...173

Overview of RTX51 Routines...174

TRAFFIC: RTX-51 Tiny Example Program...176

RTX Kernel Aware Debugging...180

Chapter 9. Using On-chip Peripherals...183

Special Function Registers ...183

Chapter 10. CPU and C Startup Code ...197

Chapter 11. Using Monitor-51 ...199

Caveats...199

Hardware and Software Requirements ...200

Serial Transmission Line...201

µVision2 Monitor Driver ...201

µVision2 Restrictions when using Monitor-51 ...202

Tool Configuration when Using Monitor-51...204

Monitor-51 Configuration...206

Troubleshooting ...208

Debugging with Monitor-51...209

Chapter 12. Command Reference ...211

µVision 2 Command Line Invocation ...211

A51 / A251 Macro Assembler Directives ...212

C51/C251 Compiler ...213

L51/BL51 Linker/Locator...215

L251 Linker/Locator ...216

LIB51 / L251 Library Manager Commands...218

OC51 Banked Object File Converter ...219

OH51 Object-Hex Converter ...219

OH251 Object-Hex Converter ...219

Index...222

1

Chapter 1. Introduction

Thank you for allowing Keil Software to provide you with software development tools for the 8051 family of microprocessors. With the Keil tools, you can generate embedded applications for virtually every 8051 derivative.

NOTE

Throughout this manual we refer to these tools as the 8051 development tools.

However, they support all derivatives and variants of the 8051 microcontroller family.

The Keil Software 8051 development tools listed below are programs you use to compile your C code, assemble your assembly source files, link and locate object modules and libraries, create HEX files, and debug your target program. Each of these programs is described in more detail in “Chapter 3. Development Tools”

which begins on page 21.

µVision2 for Windows™ is an Integrated Development Environment that combines project management, source code editing, and program debugging in one single, powerful environment.

The C51 ANSI Optimizing C Cross Compiler creates relocatable object modules from your C source code.

The A51 Macro Assembler creates relocatable object modules from your 8051 assembly source code.

The BL51 Linker/Locator combines relocatable object modules created by the C51 Compiler and the A51 Assembler into absolute object modules.

The LIB51 Library Manager combines object modules into libraries that may be used by the linker.

The OH51 Object-HEX Converter creates Intel HEX files from absolute object modules.

The RTX-51 Real-time Operating System simplifies the design of complex, time-critical software projects.

The tools are combined into the kits described in “Product Overview” on page 16. They are designed for the professional software developer, but any level of programmer can use them to get the most out of the 8051 microcontroller architecture.

1

Manual Topics

This manual discusses a number of topics including:

How to select the best tool kit for your application (see “Product Overview”

on page 16),

How to install the software on your system (see “Chapter 2. Installation” on page 19),

The features of the 8051 development tools (see “Chapter 3. Development Tools” on page 21),

How to create complete applications using the µVision2 IDE (see “Chapter 4.

Creating Applications” on page 57),

How to debug programs and simulate target hardware with the µVision2 debugger (see “Chapter 5. Testing Programs” on page 93),

How to access the on-chip peripherals and special features of the 8051 variants using the C51 Compiler (see “On-chip Peripheral Symbols” on page 114),

How to run the sample programs (see “Chapter 7. Sample Programs” on page 149).

NOTE

To get started immediately, install the software (refer to “Chapter 2.

Installation” on page 19) and run the sample programs (refer to “Chapter 7.

Sample Programs” on page 149).

Changes to the Documentation

Last minute changes and corrections to the software and manuals are listed in the RELEASE.TXT files. These files are located in the \KEIL\UV2 and

\KEIL\C51\HLP folders. Take the time to read these files to determine if there are changes that may impact your installation.

1

Evaluation Kits and Production Kits

Keil Software delivers software in two types of kits: evaluation kits and production kits.

Evaluation Kits include evaluation versions of our 8051 tools along with this user’s guide. The tools in the evaluation kit let you generate applications up to 2 Kbytes in size. This kit allows you to evaluate the effectiveness of our 8051 tools and generate small target applications.

Production Kits (discussed in “Product Overview” on page 16) include the unlimited versions of our 8051 tools along with a full manual set (including this user’s guide). The production kits include 1 year of free technical support and product updates. Updates are available at www.keil.com.

Types of Users

This manual addresses three types of users: evaluation users, new users, and experienced users.

Evaluation Users are those users who have not yet purchased the software but have requested the evaluation package to get a better feel for what the tools do and how they perform. The evaluation package includes tools that are limited to 2 Kbytes along with several sample programs that provide applications created for the 8051 microcontroller family. Even if you are only an evaluation user, take the time to read this manual. It explains how to install the software, provides you with an overview of the development tools, and introduces the sample programs.

New Users are those users who are purchasing 8051 development tools for the first time. The included software provides you with the latest development tool technology, manuals, and sample programs. If you are new to the 8051 or the tools, take the time to review the sample programs described in this manual.

They provide a quick tutorial and help new or inexperienced users get started quickly.

Experienced Users are those users who have previously used the Keil 8051 development tools and are now upgrading to the latest version. The software included with a product upgrade contains the latest development tools and

1

Requesting Assistance

At Keil Software, we are dedicated to providing you with the best embedded development tools and documentation available. If you have suggestions or comments regarding any of the printed manuals accompanying this product, please contact us. If you think you have discovered a problem with the software, do the following before calling technical support.

1. Read the sections in this manual that pertains to the job or task you are trying to accomplish.

2. Make sure you are using the most current version of the software and utilities.

Check the update section at www.keil.com to make sure that you have the latest software version.

3. Isolate the problem to determine if it is a problem with the assembler, compiler, linker, library manager, or another development tool.

4. Further isolate software problems by reducing your code to a few lines.

If you are still experiencing problems after following these steps, report them to our technical support group. Please include your product serial number and version number. We prefer that you send the problem via email. If you contact us by fax, be sure to include your name and telephone numbers (voice and fax) where we can reach you.

Try to be as detailed as possible when describing the problem you are having.

The more descriptive your example, the faster we can find a solution. If you have a single-page code example demonstrating the problem, please email it to us. If possible, make sure that your problem can be duplicated with the µVision2 simulator. Please try to avoid sending complete applications or long listings as this slows down our response to you.

NOTE

You can always get technical support, product updates, application notes, and sample programs from www.keil.com/support.

1

Software Development Cycle

When you use the Keil Software tools, the project development cycle is roughly the same as it is for any other software

development project.

1. Create a project, select the target chip from the device database, and configure the tool settings.

2. Create source files in C or assembly.

3. Build your application with the project manager.

4. Correct errors in source files.

5. Test the linked application.

A block diagram of the complete 8051 tool set may best illustrate the

development cycle. Each component is described below.

µVision2 IDE

The µVision2 IDE combines project management, a rich-featured editor with interactive error correction, option setup, make facility, and on-line help.

Use µVision2 to create your source files and organize them into a project that defines your target application. µVision2 automatically compiles, assembles, and links your embedded application and provides a single focal point for your development efforts.

µVision2 IDE with Editor & Make

ANSI C

1

C51 Compiler & A51 Assembler

Source files are created by the µVision2 IDE and are passed to the C51 Compiler or A51 assembler. The compiler and assembler process source files and create relocatable object files.

The Keil C51 Compiler is a full ANSI implementation of the C programming language that supports all standard features of the C language. In addition, numerous features for direct support of the 8051 architecture have been added.

The Keil A51 macro assembler supports the complete instruction set of the 8051 and all derivatives.

LIB51 Library Manager

The LIB51 library manager allows you to create object library from the object files created by the compiler and assembler. Libraries are specially formatted, ordered program collections of object modules that may be used by the linker at a later time. When the linker processes a library, only those object modules in the library that are necessary to create the program are used.

BL51 Linker/Locator

The BL51 linker creates an absolute object module using the object modules extracted from libraries and those created by the compiler and assembler. An absolute object file or module contains no relocatable code or data. All code and data reside at fixed memory locations. The absolute object file may be used:

To program an EPROM or other memory devices,

With the µVision2 Debugger for simulation and target debugging, With an in-circuit emulator for the program testing.

1

µVision2 Debugger

The µVision2 symbolic, source-level debugger is ideally suited for fast, reliable program debugging. The debugger includes a high-speed simulator that let you simulate an entire 8051 system including on-chip peripherals and external hardware. The attributes of the chip you use are automatically configured when you select the device from the Device Database.

The µVision2 Debugger provides several ways for you to test your programs on real target hardware.

Install the MON51 Target Monitor on your target system and download your program using the Monitor-51 interface built-in to the µVision2 Debugger.

Use the Advanced GDI interface to attach use the µVision2 Debugger front end with your target system.

Monitor-51

The µVision2 Debugger supports target debugging using Monitor-51. The monitor program resides in the memory of your target hardware and

communicates with the µVision2 Debugger using the serial port of the 8051 and a COM port of your PC. With Monitor-51, µVision2 lets you perform

source-level, symbolic debugging on your target hardware.

RTX51 Real-Time Operating System

The RTX51 real-time operating system is a multitasking kernel for the 8051 microcontroller family. The RTX51 real-time kernel simplifies the system design, programming, and debugging of complex applications where fast

reaction to time critical events is essential. The kernel is fully integrated into the C51 Compiler and is easy to use. Task description tables and operating system consistency are automatically controlled by the BL51 linker/locator.

1

Product Overview

Keil Software provides the premier development tools for the 8051 family of microcontrollers. We bundle our software development tools into different packages or tool kits. The “Comparison Chart” on page 17 shows the full extent of the Keil Software 8051 development tools. Each kit and its contents are described below.

PK51 Professional Developer’s Kit

The PK51 Professional Developer’s Kit includes everything the professional developer needs to create and debug sophisticated embedded applications for the 8051 family of microcontrollers. The professional developer’s kit can be

configured for all 8051 derivatives.

DK51 Developer’s Kit

The DK51 Developer’s Kit is a reduced version of PK51 and does not include the RTX51 Tiny real-time operating system. The developer’s kit can be configured for all 8051 derivatives.

CA51 Compiler Kit

The CA51 Compiler Kit is the best choice for developers who need a C compiler but not a debugging system. The CA51 package contains only the µVision2 IDE. The µVision2 Debugger features are not available in CA51. The kit includes everything you need to create embedded applications and can be configured for all 8051 derivatives.

1

A51 Assembler Kit

The A51 Assembler Kit includes an assembler and all the utilities you need to create embedded applications. It can be configured for all 8051 derivatives.

RTX51 Real-Time Operating System (FR51)

The RTX51 Real-Time Operating Systems is a real-time kernel for the 8051 family of microcontrollers. RTX51 Full provides a superset of the features found in RTX51 Tiny and includes CAN communication protocol interface routines.

Comparison Chart

The following table provides a checklist of the features found in each package.

Tools are listed along the top and part numbers for specific kits are listed along the side. Use this cross-reference to select the kit that best suits your needs.

Components PK51 DK51 CA51 A51 FR51

µVision2 Project Management & Editor

A51 Assembler

C51 Compiler

BL51 Linker/Locator

LIB51 Library Manager

µVision2 Debugger/Simulator

RTX51 Tiny

RTX51 Full

1

2

Chapter 2. Installation

This chapter explains how to setup an operating environment and how to install the software on your hard disk. Before starting the installation program:

Verify that your computer system meets the minimum requirements, Make a copy of the installation diskette for backup purposes.

System Requirements

There are minimum hardware and software requirements that must be satisfied to ensure that the compiler and utilities function properly. You must have:

PC with Pentium, Pentium-II or compatible processor, Windows 95, Windows-98, Windows NT 4.0, or higher, 16 MB RAM minimum,

20 MB free disk space.

Installation Details

All Keil products come with an installation program that allows easy installation.

To install the 8051 development tools:

Insert the Keil Development Tools CD-ROM, Select Install Software from the CD Viewer menu, Follow the instructions displayed by the setup program.

NOTE

Your PC should automatically launch the CD Viewer when you insert the CD. If not, run \KEIL\SETUP\SETUP.EXE from the CD to install the software.

2

Folder Structure

The setup program copies the development tools into sub-folders of the base folder. The default base folder is: C:\KEIL. The following table lists the structure of a complete installation that includes the entire line of 8051 development tools. Your installation may vary depending on the products you purchased.

Folder Description

C:\KEIL\C51\ASM Assembler SFR definition files and template source file.

C:\KEIL\C51\BIN Executable files of the 8051 tool chain.

C:\KEIL\C51\EXAMPLES Sample applications.

C:\KEIL\C51\RTX51 RTX51 Full files.

C:\KEIL\C51\RTX_TINY RTX51 Tiny files.

C:\KEIL\C51\INC C compiler include files.

C:\KEIL\C51\LIB C compiler library files, startup code, and source of I/O routines.

C:\KEIL\C51\MONITOR Target Monitor files and Monitor configuration for user hardware.

C:\KEIL\UV2 Generic µVision2 files.

In this users guide, we refer to the default folder structure. If you install your software in a different folder, you must adjust the pathnames to match your installation.

3

Chapter 3. Development Tools

The Keil development tools for the 8051 offer numerous features and advantages that help you quickly and successfully develop embedded applications. They are easy to use and are guaranteed to help you achieve your design goals.

µVision2 Integrated Development Environment

The µVision2 IDE is a Windows-based software development platform that combines a robust editor, project manager, and make facility. µVision2 supports all of the Keil tools for the 8051 including the C compiler, macro assembler, linker/locator, and object-HEX converter. µVision2 helps expedite the

development process of your embedded applications by providing the following:

Full-featured source code editor,

Device database for configuring the development tool setting, Project manager for creating and maintaining your projects,

Integrated make facility for assembling, compiling, and linking your embedded applications,

Dialogs for all development tool settings,

True integrated source-level Debugger with high-speed CPU and peripheral simulator,

Advanced GDI interface for software debugging in the target hardware and for connection to Monitor-51,

Links to development tools manuals, device datasheets & user’s guides.

NOTE

The µVision2 debugging features are only available in the PK51 and DK51 kits.

3

About the Environment

The µVision2 screen provides you with a menu bar for command entry, a tool bar where you can rapidly select command buttons, and windows for source files, dialog boxes, and information displays. µVision2 lets you simultaneously open and view multiple source files.

3

Menu Commands, Toolbars, and Shortcuts

The menu bar provides you with menus for editor operations, project maintenance, development tool option settings, program debugging, window selection and manipulation, and on-line help. The toolbar buttons allow you to rapidly execute µVision2 commands. Keyboard shortcuts (that you may configure) allow you to execute µVision2 commands. The following tables list the µVision2 menu items and commands, the toolbar icons, default shortcuts,

The menu bar provides you with menus for editor operations, project maintenance, development tool option settings, program debugging, window selection and manipulation, and on-line help. The toolbar buttons allow you to rapidly execute µVision2 commands. Keyboard shortcuts (that you may configure) allow you to execute µVision2 commands. The following tables list the µVision2 menu items and commands, the toolbar icons, default shortcuts,

Dans le document Getting Started with µVision2 (Page 3-200)

Documents relatifs