79
79
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
80
80
STM32F479xx */
81
81
82
- /*!< Uncomment the following line if you need to relocate your vector Table in
83
- Internal SRAM. */
84
- /* #define VECT_TAB_SRAM */
85
82
#ifndef VECT_TAB_OFFSET
86
- #define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
87
- This value must be a multiple of 0x200. */
83
+ #define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
84
+ This value must be a multiple of 0x200. */
85
+ #else
86
+ #define USER_VECT_TAB_ADDRESS
88
87
#endif
88
+
89
+ /* Note: Following vector table addresses must be defined in line with linker
90
+ configuration. */
91
+ /*!< Uncomment the following line if you need to relocate the vector table
92
+ anywhere in Flash or Sram, else the vector table is kept at the automatic
93
+ remap of boot address selected */
94
+ /* #define USER_VECT_TAB_ADDRESS */
95
+
96
+ #if defined(USER_VECT_TAB_ADDRESS )
97
+ /*!< Uncomment the following line if you need to relocate your vector Table
98
+ in Sram else user remap will be done in Flash. */
99
+ /* #define VECT_TAB_SRAM */
100
+ #if defined(VECT_TAB_SRAM )
101
+ #define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
102
+ This value must be a multiple of 0x200. */
103
+ #else
104
+ #define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
105
+ This value must be a multiple of 0x200. */
106
+ #endif /* VECT_TAB_SRAM */
107
+ #endif /* USER_VECT_TAB_ADDRESS */
89
108
/******************************************************************************/
90
109
91
110
/**
@@ -170,12 +189,10 @@ void SystemInit(void)
170
189
SystemInit_ExtMemCtl ();
171
190
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
172
191
173
- /* Configure the Vector Table location add offset address ------------------*/
174
- #ifdef VECT_TAB_SRAM
175
- SCB -> VTOR = SRAM_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal SRAM */
176
- #else
177
- SCB -> VTOR = FLASH_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal FLASH */
178
- #endif
192
+ /* Configure the Vector Table location -------------------------------------*/
193
+ #if defined(USER_VECT_TAB_ADDRESS )
194
+ SCB -> VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal SRAM */
195
+ #endif /* USER_VECT_TAB_ADDRESS */
179
196
}
180
197
181
198
/**
@@ -381,6 +398,7 @@ void SystemInit_ExtMemCtl(void)
381
398
382
399
/* PALL command */
383
400
FMC_Bank5_6 -> SDCMR = 0x00000012 ;
401
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
384
402
timeout = 0xFFFF ;
385
403
while ((tmpreg != 0 ) && (timeout -- > 0 ))
386
404
{
@@ -389,6 +407,7 @@ void SystemInit_ExtMemCtl(void)
389
407
390
408
/* Auto refresh command */
391
409
FMC_Bank5_6 -> SDCMR = 0x00000073 ;
410
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
392
411
timeout = 0xFFFF ;
393
412
while ((tmpreg != 0 ) && (timeout -- > 0 ))
394
413
{
@@ -397,6 +416,7 @@ void SystemInit_ExtMemCtl(void)
397
416
398
417
/* MRD register program */
399
418
FMC_Bank5_6 -> SDCMR = 0x00046014 ;
419
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
400
420
timeout = 0xFFFF ;
401
421
while ((tmpreg != 0 ) && (timeout -- > 0 ))
402
422
{
@@ -586,6 +606,7 @@ void SystemInit_ExtMemCtl(void)
586
606
587
607
/* PALL command */
588
608
FMC_Bank5_6 -> SDCMR = 0x00000012 ;
609
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
589
610
timeout = 0xFFFF ;
590
611
while ((tmpreg != 0 ) && (timeout -- > 0 ))
591
612
{
@@ -598,6 +619,7 @@ void SystemInit_ExtMemCtl(void)
598
619
#else
599
620
FMC_Bank5_6 -> SDCMR = 0x00000073 ;
600
621
#endif /* STM32F446xx */
622
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
601
623
timeout = 0xFFFF ;
602
624
while ((tmpreg != 0 ) && (timeout -- > 0 ))
603
625
{
@@ -610,6 +632,7 @@ void SystemInit_ExtMemCtl(void)
610
632
#else
611
633
FMC_Bank5_6 -> SDCMR = 0x00046014 ;
612
634
#endif /* STM32F446xx */
635
+ tmpreg = FMC_Bank5_6 -> SDSR & 0x00000020 ;
613
636
timeout = 0xFFFF ;
614
637
while ((tmpreg != 0 ) && (timeout -- > 0 ))
615
638
{
0 commit comments