In the previous article "STM3210E platform construction", we have built a STM3210 basic platform, and has been compiled, so our next step is to consider using MDK for download debugging.
Because we used the chip out of the SRAM, so we have to write a MDK script to achieve three functions, one is SRAM initialization, the second is to download the image file, the third is to set up the PC pointer.
em-stm3210e Random Disc has some Development Board test engineering, so we do not need to look at the manual, we first in the code to see if there is no harvest in the test project startup code Stm32f10x_ In the VECTOR.S, we can find the outer-chip SRAM initialization code, the details are as follows:
; FSMC Bank1 nor/sram3 is used for the stm3210e-eval, if another Bank is
; Required, then adjust the Register Addresses
; Enable FSMC Clock
LDR r0,= 0x00000114
LDR r1,= 0x40021014
STR R0,[R1]
; Enable Gpiod, Gpioe, gpiof and Gpiog clocks
LDR r0,= 0x000001e0
LDR r1,= 0x40021018
STR R0,[R1]
; SRAM Data lines, NOE and nwe configuration
; SRAM Address lines Configuration
; NOE and NWE configuration
; NE3 Configuration
; NBL0, NBL1 configuration
LDR r0,= 0x44bb44bb
LDR r1,= 0x40011400
STR R0,[R1]
LDR r0,= 0xBBBBBBBB
LDR r1,= 0x40011404
STR R0,[R1]
LDR r0,= 0xb44444bb
LDR r1,= 0x40011800
STR R0,[R1]
LDR r0,= 0xBBBBBBBB
LDR r1,= 0x40011804
STR R0,[R1]
LDR r0,= 0x44bbbbbb
LDR r1,= 0x40011c00
STR R0,[R1]
LDR r0,= 0xbbbb4444
LDR r1,= 0X40011C04
STR R0,[R1]
LDR r0,= 0x44bbbbbb
LDR r1,= 0x40012000
STR R0,[R1]
LDR r0,= 0x44444b44
LDR r1,= 0x40012004
STR R0,[R1]
; FSMC Configuration
; Enable FSMC Bank1_sram Bank
; LDR r0,= 0x00001011
; LDR r1,= 0xa0000010
; STR R0,[R1]
; LDR r0,= 0x00000200
; LDR r1,= 0xa0000014
; STR R0,[R1]
LDR r0,= 0x00001000
LDR r1,= 0xa0000010
STR R0,[R1]
LDR r0,= 0x00000200
LDR r1,= 0xa0000014
STR R0,[R1]
LDR r0,= 0x0fffffff
LDR r1,= 0xa0000114
STR R0,[R1]
LDR r0,= 0x00001001
LDR r1,= 0xa0000010
STR R0,[R1]