Application Note 171
Using M8051EW Memory Extension

Revision 2 - 28 Oct. 2004

This Application Note tells you how to configure the Keil 8051 development tools for Mentor M8051EW based devices with integrated Memory Extension. With this Memory Extension it is possible to access up to 1MByte code and data space.

Information in this file, the accompany manuals, and software is
Copyright © Keil Software, Inc and Keil Elektronik GmbH.
All rights reserved.


Contents

  1. Overview
  2. IBANKING Linker/Locater Control
  3. L51IBANK.A51 Memory Extension Configuration File
  4. Simulation of Mentor M8051EW Features
  5. Compiler Support of Multiple DPTR
  6. Example Programs
  7. Restrictions with RTX51
  8. Technical Support
  9. Contact Details

Overview

Some 8051 devices that are based on the M8051EW core offer a set of Memory Extension registers (MEX1, MEX2 and MEX3) that support an extended code and data memory space of up to 1 Mbyte.

NOTE: M8051EW Memory Extension registers are fully supported by PK51 Version 7.50 or higher. This version provides also full device simulation for the Memory Extension registers.

Program Code Extension

Program Code is always fetched from the 64K block pointed to by a Current Bank value (CB). CB is updated from the Next Bank value (NB) upon execution of long jump (LJMP) and call (LCALL, ACALL) instructions. The MEX1 register contains NB (MEX1.3 - MEX1.0) and CB (MEX1.7 - MEX.4). An extra Memory Extension Stack space is used to save and restore the MEX1 register on call (LCALL, ACALL) and return (RET, RETI) instructions. Interrupt service routines are always executed from code in the 64K block pointed to by the Interrupt Bank value (IB) (MEX2.3 - MEX2.0).

The program code extension of the M8051EW core is supported with the IBANKING linker control that is available in the BL51 Linker/Locater and the LX51 Linker/Locater.

Constant and Data Memory Extension

Constant and Data Memory can be extended with additional fields in the Memory Extensions registers. The Memory Constant Bank pointer (MCB) (MEX3.7, MEX2.6 - MEX2.4) is enabled with the MCM bit (MEX2.7) and defines a 64KB memory bank that is used for constants that are defined with the C51 memory type code. The Memory XRAM Bank pointer (MX) (ME3.4, MEX3.2 - MEX3.0) is enabled with the MXM bit (MEX3.3) and defines a 64KB memory bank that is used for variables that are defined with the C51 memory type far.

Constant and Data Memory Extension is only supported with the LX51 Linker/Locater and is therefore only available in the Keil PK51 Professional Developers Kit. The bank used for constant and the number of xdata banks is configured in the L51IBANK.A51 file that is part of this Application Note.

IBANKING Linker/Locater Control

With the linker/locater control IBANKING the linker uses the on-chip code banking hardware of the M8051EW devices. The linker/locater places automatically all code segments in the bank area, which do not have the ?CO? prefix or ?CO postfix. Segments with a ?CO prefix or postfix are placed into the common area.

Interrupt Functions and the startup code must be located to the code bank 0 which is the IB reset value.

The standard bank configuration module L51_BANK.A51 is not required when the control IBAKING is used. Instead the linker/locater generates in this operation mode a jump table with the following format:

     MOV MEX1,#BANK_NUMBER
     LJMP target

The IBANKING control is entered in uVision2 under Options - Lx51 Misc - Misc Controls.

NOTE:

L51IBANK.A51 Memory Extension Configuration File

The L51IBANK.A51 file allows configuration of both program code and variable banking. You can specify a separate code memory bank used for program constants and the memory bank used for interrupt functions.

When using this configuration file it is possible to use up to:

The L51IBANK.A51 configuration file is only supported with the LX51 Linker/Locater and is therefore only available in the Keil PK51 Professional Developers Kit. The constant variable bank, interrupt code bank, and the far variable banks are configured in the L51IBANK.A51 file. The Linker/Locater control IBANKING is not required when you are using the L51IBANK.A51 configuration file.

NOTE:

Optimum Bank Layout with L51IBANK.A51 Configuration File

The following design rules help you to get optimum results when you are using the L51IBANK.A51 configuration file.

Simulation of Mentor M8051EW Features

The CPU Core Simulation DLL S8051.DLL provides additional parameters for the extended features of the M8051EW core. These parameters can be stored in the DeviceDatabase™ or may be entered under Options - Debug - Simulator CPU DLL Parameter:

Compiler Support of Multiple DPTR

The Mentor M8051EW Core can be configured to support 2, 4, or 8 DPTR registers. The multiple DPTR registers are identical to Infineon Devices, however the DPSEL register is located at address 0xA2. The DPSEL SFR location is configured in the L51IBANK.A51 configuration file with lines:

PUBLIC ?C?DPSEL
?C?DPSEL DATA 0A2H

For using the Multiple DPTR support without this L51IBANK.A51 file you may copy the definition of this PUBLIC symbol to a chip-specific Startup.A51 file.

Example Programs

Example programs in the folder ..\C51\EXAMPLES\M8051EW demonstrate to usage of the Memory Extension on M8051EW based devices. The examples show the configuration of the uVision2 IDE. The programs can be fully simulated with the uVision2 Debugger.

Restrictions with RTX51

Program code banking with the Mentor M8051EW Memory Extension registers is not supported by RTX51 Full or RTX51 Tiny, since it is not possible to access the Memory Extension Stack space.

Technical Support

At Keil Software, we are dedicated to providing you with the best development tools and technical support. That's why we offer numerous ways you can get the technical support you need to complete your embedded projects.

Many of the features of our Technical Support Knowledgebase and Web Site are the results of your suggestions. If you have any ideas that will improve them, please give us your feedback!

Contact Details

If you experience any problems or have any questions about this Application Note, contact one of our distributors or offices for assistance.

In the USA...

Keil Software, Inc.
1501 10th Street, Suite 110
Plano, TX  75074
USA

800-348-8051 - Sales
972-312-1107 - Support
972-312-1159 - Fax

sales.us@keil.com
- Sales E-Mail
support.us@keil.com
- Support E-mail 
  

In Europe...

Keil Elektronik GmbH
Bretonischer Ring 15
D-85630 Grasbrunn
Germany

+49 89 456040-0 - Sales
+49 89 456040-24 - Support
+49 89 468162 - Fax

sales.intl@keil.com
- Sales E-Mail
support.intl@keil.com
- Support E-Mail
  


Copyright © Keil Software, Inc. and Keil Elektronik GmbH.
All rights reserved.
Visit our web site at www.keil.com.