Immediately after the previous article, if the program changed to change or too big to not enter STM32 memory how to do? Can i download it to flash and debug it? In fact, it can also be downloaded into the external SRAM, so that almost all the normal program can be done. The only disadvantage is that in this case, the program will run slower, whatever, can debug is the right path.
The board or Red Bull default configuration, this goods with 256x16bit SRAM, connected to the FSMC, the following describes how to configure the use of this extended SRAM process program debugging.
The first thing to know, Red Bull this SRAM base address is 0x68000000, so we will set the base of the ROM to this. Ram will remain 0x20000000 on the line, in fact, can also use SRAM, but this article does not involve this.
To do this, use the Init script to aid the download of the program as follows (Save as Exram.ini):
FUNC void Setup (void) {
SP = _rdword (0x68000000); Setup Stack Pointer
PC = _rdword (0x68000004); Setup program Counter
_wdword (0xe000ed08, 0x68000000); Setup Vector Table Offset Register
}
FUNC void Initsram (void) {
Initrccc
_wdword (0x40021000, 0x00005083);
_wdword (0x40021004, 0x00000000);
_wdword (0x40021004, 0x00000000);
_wdword (0x40021000, 0x00005083);
_wdword (0x40021004, 0x00000000);
_wdword (0x40021008, 0x009f0000);
_wdword (0x40021000, 0x00015083);
_SLEEP_ (100); Wait for PLL Lock
_wdword (0x40022000, 0x00000030);
_wdword (0x40022000, 0x00000030);
_wdword (0x40022000, 0x00000032);
_wdword (0x40021004, 0x00000000);
_wdword (0x40021004, 0x00000000);
_wdword (0x40021004, 0x00000400);
_wdword (0x40021004, 0x00000400);
_wdword (0x40021004, 0x001d0400);
_wdword (0x40021000, 0x01035083);
_SLEEP_ (100);
_wdword (0x40021004, 0x001d0400);
_wdword (0x40021004, 0x001d0402);
_SLEEP_ (100);
_wdword (0x40021014, 0x00000114); /* Enable Ahbperiphclock */
_wdword (0x40021018, 0x000001e0); /* Enable Apb2periphclock */
/* GPIO Configuration for FSMC */
_wdword (0x40011400, 0X44BB44BB);
_wdword (0x40011404, 0xBBBBBBBB);
_wdword (0x40011800, 0XB44448BB); /* NBL0, NBL1 & adress configuration */
_wdword (0x40011804, 0xBBBBBBBB);
_wdword (0X40011C00, 0X43BBBBBB);
_wdword (0X40011C04, 0xbbbb4344);
_wdword (0x40012000, 0X44BBBBBB);
_wdword (0x40012004, 0x44444b44); /* NE3 Configuration */
_wdword (0xa0000010, 0x00001010); /* FSMC Configuration */
_wdword (0xa0000014, 0x10000200); /* Fsmc_datasetuptime = 2; */
_wdword (0xa0000010, 0x00001011); /* Enable FSMC bank1_sram Bank */
_SLEEP_ (200);
}
Initsram (); Setup FSMC for SRAM
LOAD: /OUTPUT/STM32-DEMO.AXF INCREMENTAL//Download
Setup (); Setup for Running
G, Main
The Jlink settings are the same as in the previous article.
After such a simple setup, you can happily debug the program, no longer worry about flash suddenly killed.
STM32 using out-of-chip external expansion memory debugging