Keil™, An ARM® Company

Technical Support

ARM: DEBUG PROGRAMS IN OFF-CHIP RAM


Information in this article applies to:

  • Development Suite for ARM Version 1.5 or higher

QUESTION

I am using ULINK together with Philips LPC2192 device and off-chip RAM. During debugging, I want to run the program on off-chip SRAM (since the number of breakpoints is unlimited in RAM). Finally, I need to download the application to off-chip Flash ROM. However when I start debugging I get the following error message:

Memory Mismatch!
Address: 0x00000000
Value = 0x38
Expected = 0x18

What is my problem? Is there a sample project setup?

ANSWER

A similar project setup for such a configuration is provided in the folder: ..\ARM\Boards\Phytec\LPC229x\Hello.

Debugging in RAM requires that chip select line CS0 is connected to a RAM device. Also you need to modify the MEMMAP setting in the STARTUP.S file as shown below:

$SET (RAM_INTVEC)                       ; enable code below
$IF (RAM_INTVEC)
                LDR     R0, =MEMMAP
                MOV     R1, #3   ; redirect interrupt vectors to off-chip memory
                STR     R1, [R0]
$ENDIF

You may define two different targets as explained in the µVision IDE User's Guide, Creating Applications, Project Targets and File Groups:

  • one target for Flash Programming
  • one target for Debugging in RAM

The target Debugging in RAM needs the following configuration settings under Project - Options for Target:

  • Target: make sure that the option Use on-chip ROM is disabled. Instead define the address space of your External Memory devices. Select under External Memory the type ROM for the RAM device that should hold the program code.
  • ASM - Set: EXTERNAL_MODE: this assembler SET directive translates the Philips LPC2000 STARTUP.S file for off-chip startup addresses.
  • Debug - Use ULINK ARM Debugger - disable Load Application at Startup: the application code needs to be loaded after the BUS is configured by the XRAM.INI initialization file.
  • Debug - Use ULINK ARM Debugger - Initialization File: create a file XRAM.INI for BUS configuration (you may use ..\ARM\Boards\Phytec\LPC229x\Hello\Flash.ini as a template). Add the LOAD command for your application code and use the option INCREMENTAL to supress the RESET on the target. This INI file may also set the program counter to the desired address.

    Example:

    //*** <<< Use Configuration Wizard in Context Menu >>> ***
    
    
    FUNC void Setup (void) {
    
    // <h> External Memory Controller (EMC)
    
    //   <h> Bank Configuration 0 (BCFG0)
    //     <o1.0..3>   IDCY: Idle Cycles <0-15>
    //     <o1.5..9>   WST1: Wait States 1 <0-31>
    //     <o1.11..15> WST2: Wait States 2 <0-31>
    //     <o1.10>     RBLE: Read Byte Lane Enable
    //     <o1.26>     WP: Write Protect
    //     <o1.27>     BM: Burst ROM
    //     <o1.28..29> MW: Memory Width  <0=>  8-bit  <1=> 16-bit
    //                                   <2=> 32-bit  <3=> Reserved
    //   </h>
      _WDWORD(0xFFE00000, 0x20003CE3);   // BCFG0: Flash Bus Configuration
    
      _WDWORD(0xE002C014, 0x0E6001E4);   // PINSEL2: CS0, OE, WE, BLS0..3
                                         //          D0..31, A2..23, JTAG
    
    // </h>
    
    }
    
    Setup();                             // Setup for Flash
    Load MyApp INCREMENTAL
    PC = 0x80000000
    

With these settings the generated application program code will be at address 0x80000000 and above. You may verify the linker MAP file which lists the memory requirements under MEMORY MAP OF MODULE. All segments with the MEMORY CLASS CODE and CONST should be in the range of your off-chip RAM device as shown below:

START      STOP       LENGTH    ALIGN  RELOC  MEMORY CLASS   SEGMENT NAME
=========================================================================
80000000H  80000143H  00000144H     4  AT..   CODE           STARTUPCODE
80000144H  80000150H  0000000DH     4  UNIT   CONST          ?CON?Hello
80000151H  80000153H  00000003H   ---  ---    **GAP**
80000154H  8000015AH  00000007H     4  UNIT   CONST          ?CON?prnfmt
8000015BH  8000015BH  00000001H   ---  ---    **GAP**
8000015CH  80000163H  00000008H     4  UNIT   CONST          ?C_CLRSEG
80000164H  8000016BH  00000008H     4  UNIT   CONST          ?C_INITSEG
  :          :          :

With Debug - Start/Stop Debug Session, the application code will be loaded to off-chip RAM and you may set as many breakpoints as required. It is only required that you have RAM in the memory region 0x80000000 and above.

MORE INFORMATION

  • Getting Started User's Guide for ARM Powered Microcontrollers

SEE ALSO

Last Reviewed: Monday, February 14, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure