e9ba48d9f48a3f4d732393e319240869a501cba6
[fw/openocd] / tcl / board / stm3210e_eval.cfg
1 # This is an STM32 eval board with a single STM32F103ZE chip on it.
2 # http://www.st.com/mcu/contentid-100-110-STM3210E_EVAL.html
3
4 # increase working area for faster flash programming
5
6 set WORKAREASIZE 32768
7
8 source [find target/stm32.cfg]
9
10 #
11 # configure FSMC Bank 1 (NOR/PSRAM Bank 2) NOR flash
12 # M29W128GL70ZA6E
13 #
14
15 set _FLASHNAME $_CHIPNAME.norflash
16 flash bank $_FLASHNAME cfi 0x64000000 0x01000000 2 2 $_TARGETNAME
17
18 proc stm32_enable_fsmc {} {
19
20         echo "Enabling FSMC Bank 1 (NOR/PSRAM Bank 2)"
21         
22         # enable gpio (defg) clocks for fsmc
23         # RCC_APB2ENR
24         mww 0x40021018 0x000001E0
25         
26         # enable fsmc clock
27         # RCC_AHBENR
28         mww 0x40021014 0x00000114
29
30         # configure gpio to alternate function
31         # GPIOD_CRL
32         mww 0x40011400 0x44BB44BB
33         # GPIOD_CRH
34         mww 0x40011404 0xBBBBBBBB
35         
36         # GPIOE_CRL
37         mww 0x40011800 0xBBBBB444
38         # GPIOE_CRH
39         mww 0x40011804 0xBBBBBBBB
40         
41         # GPIOF_CRL
42         mww 0x40011C00 0x44BBBBBB
43         # GPIOF_CRH
44         mww 0x40011C04 0xBBBB4444
45         
46         # GPIOG_CRL
47         mww 0x40012000 0x44BBBBBB
48         # GPIOG_CRH
49         mww 0x40012004 0x444444B4
50         
51         # setup fsmc timings
52         # FSMC_BCR1
53         mww 0xA0000008 0x00001058
54         
55         # FSMC_BTR1
56         mww 0xA000000C 0x10000502
57         
58         # FSMC_BCR1 - enable fsmc
59         mww 0xA0000008 0x00001059
60 }
61
62 $_TARGETNAME configure -event reset-init {
63         stm32_enable_fsmc
64 }