This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can i debug program in external ram?

hi, i want to debug program in external ram, it is my set, but it doesn't work. keil platform.
the external ram using bank1 ne3.

1. Optioin target
ROM1 checked, start 0x68000000, size 0x80000, select startup
RAM1 checked, start 0x68080000, size 0x20000

2. flash download
RAM for algorithm
start 0x68080000, size 0x2000

programming algorithm
start 0x68000000, size 0x00080000

debug initialize file

FUNC void Setup (void) {
        SP = _RDWORD(0x68000000);          // Setup Stack Pointer
  PC = _RDWORD(0x68000004);          // Setup Program Counter
  _WDWORD(0xE000ED08, 0x68000000);   // Setup Vector Table Offset Register
        _WDWORD(0x40021014, 0x00000100); // RCC->AHBENR FSMC Enable
        _WDWORD(0x40021018, 0x000001E0); // RCC->APB2ENR GPIOD GPIOE GPIOF GPIOG
        _WDWORD(0x40011400, 0xFFBBFFBB); // GPIOD CRL
        _WDWORD(0x40011404, 0xBBBBBBBB); // GPIOD CRH
        _WDWORD(0x40011800, 0xBFFFFFBB); // GPIOE CRL
        _WDWORD(0x40011804, 0xBBBBBBBB); // GPIOE CRH
        _WDWORD(0x40011C00, 0xFFBBBBBB); // GPIOF CRL
        _WDWORD(0x40011C04, 0xBBBBFFFF); // GPIOF CRH
        _WDWORD(0x40012000, 0xFFBBBBBB); // GPIOG CRL
        _WDWORD(0x40012004, 0xFFFFFBFF); // GPIOG CRH
        _WDWORD(0xA0000010, 0x00001011); // FSMC BCR3
        _WDWORD(0xA0000014, 0x00000300); // FSMC BTR3
        _WDWORD(0xA0000114, 0x0FFFFFFF); // FSMC BWTR3
}

SCB->VTOR = ((uint32_t)0x68000000);

Parents
  • Yes, I guess it take some effort to correctly configure the CPU and clocks, set up the GPIO and FSMC, but I'd hardly say the ordering or requirements are "unknown". You've basically got to do the same things as your current startup code is going to have to do.

    It's clearly easier to use internal RAM for such things.

Reply
  • Yes, I guess it take some effort to correctly configure the CPU and clocks, set up the GPIO and FSMC, but I'd hardly say the ordering or requirements are "unknown". You've basically got to do the same things as your current startup code is going to have to do.

    It's clearly easier to use internal RAM for such things.

Children
  • There may be needs to configure some clocking too - if the external memory is DRAM and there isn't a refresh clock then the downloaded program can be garbled even before the debugger sets the PC and starts to run the program.

    As noted - same requirements as there is for normal startup sequence to put the machine in a state where this external RAM is fully usable.