Keil Logo

L251: OPTIONS FOR CREATING HUGE PROGRAMS


Information in this article applies to:

  • C251 Version 2.14

QUESTION

How do I create HUGE programs that use the whole address space on the 251?

ANSWER

Huge programs locate program code in the ECODE memory class. Calls to ECODE require 24-bit addresses and are, therefore, encoded as EJMP instead of LJMP. For this reason ECODE is not as efficient as CODE.

Creating a program that uses the full address space requires that you do several things.

  1. In the START251.A51 file, be sure to define ROMHUGE and assemble for source or binary mode as required. It may be easiest to copy this file from the \c251\lib directory into your project directory and edit it as follows:
    $SET (ROMHUGE = 1)
    ;------------------------------------------------------------------------------
    ;  This file is part of the C251 Compiler package
    ;  Copyright KEIL ELEKTRONIK GmbH 1995 - 1998
    ;------------------------------------------------------------------------------
    
  2. Set the C compiler option ROM(HUGE). You may do this on the command line or from the µVision IDE. For example:
    c251 mycode.c rom(huge)
    
  3. Specify the range of the ECODE class. Do this using the CLASS directive on the linker command line or from within the IDE. For example:
    l251 mycode.obj class(ecode(0xFE0000-0xFFFFFF))
    

    Check the linker map file to verify the location of the classes and segments in your program. For example, the following excerpt from the MAP file shows that the ECODE class is set from FE0000h to FFFFFFh. It also shows that the main C function is located at FE0000h.

    ACTIVE MEMORY CLASSES OF MODULE:  Y:\ROMHUGE\ROMHUGE (MAIN)
    
    BASE      START     END       MEMORY CLASS
    ==========================================
    000000H   FE0000H   FFFFFFH   ECODE
    FF0000H   FF0000H   FFFFFFH   CODE
    000000H   000000H   00FFFFH   EDATA
    000000H   000000H   00007FH   DATA
    
    
    MEMORY MAP OF MODULE:  Y:\ROMHUGE\ROMHUGE (MAIN)
    
    
    START     STOP      LENGTH    ALIGN  RELOC    MEMORY CLASS   SEGMENT NAME
    =========================================================================
    000000H   000007H   000008H   ---    AT..     DATA           "REG BANK 0"
    000008H   000107H   000100H   BYTE   UNIT     EDATA          ?STACK
    FE0000H   FE0000H   000001H   BYTE   INSEG    ECODE          ?PR?MAIN
    FE0001H   FE0013H   000013H   BYTE   UNIT     ECODE          ?C_C51STARTUPE
    FF0000H   FF0002H   000003H   ---    OFFS..   CODE           ?CO?START251?5
    FF0003H   FF0006H   000004H   BYTE   UNIT     CODE           ?C_C51STARTUP
    FF0007H   FF000AH   000004H   BYTE   UNIT     ECODE          ?C_C51STARTUP?3
    

SEE ALSO

Last Reviewed: Saturday, July 9, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.