Keil Logo

ULINK: 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

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: Define the address space of your code will reside. Under Read/Only Memory Areas, enter the Start Address and Size of your RAM device that will hold your program code. Check the Default check box to the left of the Starting Address, and click the Startup radio button to the right of the Size parameter.
  • ASM - Set: REMAP and EXTMEM_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) {
    
    //  External Memory Controller (EMC)
    
    //    Bank Configuration 0 (BCFG0)
    //        IDCY: Idle Cycles <0-15>
    //        WST1: Wait States 1 <0-31>
    //      WST2: Wait States 2 <0-31>
    //          RBLE: Read Byte Lane Enable
    //          WP: Write Protect
    //          BM: Burst ROM
    //      MW: Memory Width  <0=>  8-bit  <1=> 16-bit
    //                                   <2=> 32-bit  <3=> Reserved
    //   
      _WDWORD(0xFFE00000, 0x20003CE3);   // BCFG0: Flash Bus Configuration
    
      _WDWORD(0xE002C014, 0x0E6001E4);   // PINSEL2: CS0, OE, WE, BLS0..3
                                         //          D0..31, A2..23, JTAG
    
    // 
    
    }
    
    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

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, March 24, 2010


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.