Skip to content

Commit f168f62

Browse files
authored
Merge pull request #3716 from adustm/disco_f429zi_debug
fix for issue #3715: correction in startup files for ARM and IAR, alignment of system_stm32f429xx.c files
2 parents b0a1fd9 + d69c5ed commit f168f62

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/TARGET_DISCO_F429ZI/system_stm32f4xx.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
******************************************************************************
3939
* @attention
4040
*
41-
* <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
41+
* <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
4242
*
4343
* Redistribution and use in source and binary forms, with or without modification,
4444
* are permitted provided that the following conditions are met:
@@ -735,11 +735,13 @@ void SystemInit_ExtMemCtl(void)
735735
/* No pull-up, pull-down for PGx pins */
736736
GPIOG->PUPDR = 0x00000000;
737737

738-
/*-- FMC/FSMC Configuration --------------------------------------------------*/
738+
/*-- FMC/FSMC Configuration --------------------------------------------------*/
739739
/* Enable the FMC/FSMC interface clock */
740740
RCC->AHB3ENR |= 0x00000001;
741-
742-
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
741+
742+
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
743+
/* Delay after an RCC peripheral clock enabling */
744+
tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
743745
/* Configure and enable Bank1_SRAM2 */
744746
FMC_Bank1->BTCR[2] = 0x00001011;
745747
FMC_Bank1->BTCR[3] = 0x00000201;

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/TARGET_NUCLEO_F429ZI/system_stm32f4xx.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
******************************************************************************
3939
* @attention
4040
*
41-
* <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
41+
* <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
4242
*
4343
* Redistribution and use in source and binary forms, with or without modification,
4444
* are permitted provided that the following conditions are met:
@@ -188,10 +188,6 @@ void SetSysClock(void);
188188
*/
189189
void SystemInit(void)
190190
{
191-
/* FPU settings ------------------------------------------------------------*/
192-
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
193-
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
194-
#endif
195191
/* Reset the RCC clock configuration to the default reset state ------------*/
196192
/* Set HSION bit */
197193
RCC->CR |= (uint32_t)0x00000001;
@@ -215,13 +211,6 @@ void SystemInit(void)
215211
SystemInit_ExtMemCtl();
216212
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
217213

218-
/* Configure the Vector Table location add offset address ------------------*/
219-
#ifdef VECT_TAB_SRAM
220-
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
221-
#else
222-
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; /* Vector Table Relocation in Internal FLASH */
223-
#endif
224-
225214
/* Configure the Cube driver */
226215
SystemCoreClock = 16000000; // At this stage the HSI is used as system clock
227216
HAL_Init();

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/TOOLCHAIN_ARM_MICRO/startup_stm32f429xx.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,15 @@ __Vectors_Size EQU __Vectors_End - __Vectors
197197
; Reset handler
198198
Reset_Handler PROC
199199
EXPORT Reset_Handler [WEAK]
200+
IMPORT SystemInitPre
201+
IMPORT HAL_InitPre
200202
IMPORT SystemInit
201203
IMPORT __main
202204

205+
LDR R0, =SystemInitPre
206+
BLX R0
207+
LDR R0, =HAL_InitPre
208+
BLX R0
203209
LDR R0, =SystemInit
204210
BLX R0
205211
LDR R0, =__main

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/TOOLCHAIN_ARM_STD/startup_stm32f429xx.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,15 @@ __Vectors_Size EQU __Vectors_End - __Vectors
170170
; Reset handler
171171
Reset_Handler PROC
172172
EXPORT Reset_Handler [WEAK]
173+
IMPORT SystemInitPre
174+
IMPORT HAL_InitPre
173175
IMPORT SystemInit
174176
IMPORT __main
175177

178+
LDR R0, =SystemInitPre
179+
BLX R0
180+
LDR R0, =HAL_InitPre
181+
BLX R0
176182
LDR R0, =SystemInit
177183
BLX R0
178184
LDR R0, =__main

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/TOOLCHAIN_IAR/startup_stm32f429xx.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
SECTION .intvec:CODE:NOROOT(2)
6464

6565
EXTERN __iar_program_start
66+
EXTERN SystemInitPre
67+
EXTERN HAL_InitPre
6668
EXTERN SystemInit
6769
PUBLIC __vector_table
6870

@@ -188,6 +190,10 @@ __vector_table
188190
SECTION .text:CODE:REORDER:NOROOT(2)
189191
Reset_Handler
190192

193+
LDR R0, =SystemInitPre
194+
BLX R0
195+
LDR R0, =HAL_InitPre
196+
BLX R0
191197
LDR R0, =SystemInit
192198
BLX R0
193199
LDR R0, =__iar_program_start

0 commit comments

Comments
 (0)