annotate OtherSources/system_stm32f4xx.c @ 810:e6827fcd7604

Only jump to Sensor view during charging if sensors are connected: In the past it could happen that the charger view was replaced by the sensor view which was not displaying values because no sensors were connected => no added value in performing the switch. In the new version the automatic jump to the sensor view will only be performed if sennsors are connected.
author Ideenmodellierer
date Sun, 27 Aug 2023 20:55:57 +0200
parents 2de06b1abed3
children 4e10a3e087a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
1 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
2 ******************************************************************************
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
3 * @file system_stm32f4xx.c
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
4 * @author MCD Application Team
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
5 * @version V2.1.0
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
6 * @date 19-June-2014
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
7 * @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
8 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
9 * This file provides two functions and one global variable to be called from
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
10 * user application:
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
11 * - SystemInit(): This function is called at startup just after reset and
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
12 * before branch to main program. This call is made inside
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
13 * the "startup_stm32f4xx.s" file.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
14 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
15 * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
16 * by the user application to setup the SysTick
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
17 * timer or configure other parameters.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
18 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
19 * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
20 * be called whenever the core clock is changed
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
21 * during program execution.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
22 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
23 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
24 ******************************************************************************
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
25 * @attention
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
26 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
27 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
28 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
29 * Redistribution and use in source and binary forms, with or without modification,
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
30 * are permitted provided that the following conditions are met:
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
31 * 1. Redistributions of source code must retain the above copyright notice,
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
32 * this list of conditions and the following disclaimer.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
33 * 2. Redistributions in binary form must reproduce the above copyright notice,
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
34 * this list of conditions and the following disclaimer in the documentation
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
35 * and/or other materials provided with the distribution.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
36 * 3. Neither the name of STMicroelectronics nor the names of its contributors
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
37 * may be used to endorse or promote products derived from this software
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
38 * without specific prior written permission.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
39 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
41 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
43 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
46 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
47 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
48 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
49 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
50 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
51 ******************************************************************************
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
52 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
53
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
54 /** @addtogroup CMSIS
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
55 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
56 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
57
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
58 /** @addtogroup stm32f4xx_system
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
59 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
60 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
61
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
62 /** @addtogroup STM32F4xx_System_Private_Includes
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
63 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
64 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
65
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
66
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
67 #include "stm32f4xx.h"
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
68
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
69 #if !defined (HSE_VALUE)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
70 #define HSE_VALUE ((uint32_t)8000000) /*!< Default value of the External oscillator in Hz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
71 #endif /* HSE_VALUE */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
72
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
73 #if !defined (HSI_VALUE)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
74 #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
75 #endif /* HSI_VALUE */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
76
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
77 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
78 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
79 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
80
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
81 /** @addtogroup STM32F4xx_System_Private_TypesDefinitions
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
82 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
83 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
84
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
85 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
86 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
87 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
88
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
89 /** @addtogroup STM32F4xx_System_Private_Defines
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
90 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
91 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
92
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
93 /************************* Miscellaneous Configuration ************************/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
94 /*!< Uncomment the following line if you need to use external SRAM or SDRAM mounted
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
95 on STM324xG_EVAL/STM324x9I_EVAL boards as data memory */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
96 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
97 /* #define DATA_IN_ExtSRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
98 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
99
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
100 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
101 /* #define DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
102 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
103
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
104 #if defined(DATA_IN_ExtSRAM) && defined(DATA_IN_ExtSDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
105 #error "Please select DATA_IN_ExtSRAM or DATA_IN_ExtSDRAM "
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
106 #endif /* DATA_IN_ExtSRAM && DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
107
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
108 /*!< Uncomment the following line if you need to relocate your vector Table in
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
109 Internal SRAM. */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
110 /* #define VECT_TAB_SRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
111 #define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
112 This value must be a multiple of 0x200. */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
113 /******************************************************************************/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
114
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
115 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
116 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
117 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
118
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
119 /** @addtogroup STM32F4xx_System_Private_Macros
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
120 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
121 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
122
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
123 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
124 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
125 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
126
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
127 /** @addtogroup STM32F4xx_System_Private_Variables
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
128 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
129 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
130 /* This variable is updated in three ways:
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
131 1) by calling CMSIS function SystemCoreClockUpdate()
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
132 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
133 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
134 Note: If you use this function to configure the system clock; then there
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
135 is no need to call the 2 first functions listed above, since SystemCoreClock
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
136 variable is updated automatically.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
137 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
138 uint32_t SystemCoreClock = 16000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
139 __IO const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
140
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
141 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
142 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
143 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
144
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
145 /** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
146 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
147 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
148
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
149 #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
150 static void SystemInit_ExtMemCtl(void);
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
151 #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
152
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
153 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
154 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
155 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
156
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
157 /** @addtogroup STM32F4xx_System_Private_Functions
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
158 * @{
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
159 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
160
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
161 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
162 * @brief Setup the microcontroller system
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
163 * Initialize the FPU setting, vector table location and External memory
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
164 * configuration.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
165 * @param None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
166 * @retval None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
167 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
168 void SystemInit(void)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
169 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
170 /* FPU settings ------------------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
171 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
172 SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
173 #endif
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
174 /* Reset the RCC clock configuration to the default reset state ------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
175 /* Set HSION bit */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
176 RCC->CR |= (uint32_t)0x00000001;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
177
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
178 /* Reset CFGR register */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
179 RCC->CFGR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
180
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
181 /* Reset HSEON, CSSON and PLLON bits */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
182 RCC->CR &= (uint32_t)0xFEF6FFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
183
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
184 /* Reset PLLCFGR register */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
185 RCC->PLLCFGR = 0x24003010;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
186
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
187 /* Reset HSEBYP bit */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
188 RCC->CR &= (uint32_t)0xFFFBFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
189
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
190 /* Disable all interrupts */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
191 RCC->CIR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
192
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
193 #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
194 SystemInit_ExtMemCtl();
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
195 #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
196
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
197 /* Configure the Vector Table location add offset address ------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
198 #ifdef VECT_TAB_SRAM
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
199 SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
200 #else
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
201 SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
202 #endif
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
203 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
204
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
205 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
206 * @brief Update SystemCoreClock variable according to Clock Register Values.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
207 * The SystemCoreClock variable contains the core clock (HCLK), it can
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
208 * be used by the user application to setup the SysTick timer or configure
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
209 * other parameters.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
210 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
211 * @note Each time the core clock (HCLK) changes, this function must be called
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
212 * to update SystemCoreClock variable value. Otherwise, any configuration
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
213 * based on this variable will be incorrect.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
214 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
215 * @note - The system frequency computed by this function is not the real
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
216 * frequency in the chip. It is calculated based on the predefined
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
217 * constant and the selected clock source:
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
218 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
219 * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
220 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
221 * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
222 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
223 * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
224 * or HSI_VALUE(*) multiplied/divided by the PLL factors.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
225 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
226 * (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
227 * 16 MHz) but the real value may vary depending on the variations
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
228 * in voltage and temperature.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
229 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
230 * (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (its value
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
231 * depends on the application requirements), user has to ensure that HSE_VALUE
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
232 * is same as the real frequency of the crystal used. Otherwise, this function
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
233 * may have wrong result.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
234 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
235 * - The result of this function could be not correct when using fractional
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
236 * value for HSE crystal.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
237 *
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
238 * @param None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
239 * @retval None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
240 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
241 void SystemCoreClockUpdate(void)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
242 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
243 uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
244
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
245 /* Get SYSCLK source -------------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
246 tmp = RCC->CFGR & RCC_CFGR_SWS;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
247
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
248 switch (tmp)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
249 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
250 case 0x00: /* HSI used as system clock source */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
251 SystemCoreClock = HSI_VALUE;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
252 break;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
253 case 0x04: /* HSE used as system clock source */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
254 SystemCoreClock = HSE_VALUE;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
255 break;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
256 case 0x08: /* PLL used as system clock source */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
257
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
258 /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
259 SYSCLK = PLL_VCO / PLL_P
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
260 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
261 pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
262 pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
263
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
264 if (pllsource != 0)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
265 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
266 /* HSE used as PLL clock source */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
267 pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
268 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
269 else
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
270 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
271 /* HSI used as PLL clock source */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
272 pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
273 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
274
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
275 pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
276 SystemCoreClock = pllvco/pllp;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
277 break;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
278 default:
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
279 SystemCoreClock = HSI_VALUE;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
280 break;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
281 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
282 /* Compute HCLK frequency --------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
283 /* Get HCLK prescaler */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
284 tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
285 /* HCLK frequency */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
286 SystemCoreClock >>= tmp;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
287 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
288
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
289 #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
290 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
291 * @brief Setup the external memory controller.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
292 * Called in startup_stm32f4xx.s before jump to main.
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
293 * This function configures the external memories (SRAM/SDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
294 * This SRAM/SDRAM will be used as program data memory (including heap and stack).
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
295 * @param None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
296 * @retval None
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
297 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
298 void SystemInit_ExtMemCtl(void)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
299 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
300 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
301 #if defined (DATA_IN_ExtSDRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
302 register uint32_t tmpreg = 0, timeout = 0xFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
303 register uint32_t index;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
304
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
305 /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
306 clock */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
307 RCC->AHB1ENR |= 0x000001F8;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
308
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
309 /* Connect PDx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
310 GPIOD->AFR[0] = 0x000000CC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
311 GPIOD->AFR[1] = 0xCC000CCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
312 /* Configure PDx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
313 GPIOD->MODER = 0xA02A000A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
314 /* Configure PDx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
315 GPIOD->OSPEEDR = 0xA02A000A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
316 /* Configure PDx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
317 GPIOD->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
318 /* No pull-up, pull-down for PDx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
319 GPIOD->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
320
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
321 /* Connect PEx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
322 GPIOE->AFR[0] = 0xC00000CC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
323 GPIOE->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
324 /* Configure PEx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
325 GPIOE->MODER = 0xAAAA800A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
326 /* Configure PEx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
327 GPIOE->OSPEEDR = 0xAAAA800A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
328 /* Configure PEx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
329 GPIOE->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
330 /* No pull-up, pull-down for PEx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
331 GPIOE->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
332
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
333 /* Connect PFx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
334 GPIOF->AFR[0] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
335 GPIOF->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
336 /* Configure PFx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
337 GPIOF->MODER = 0xAA800AAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
338 /* Configure PFx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
339 GPIOF->OSPEEDR = 0xAA800AAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
340 /* Configure PFx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
341 GPIOF->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
342 /* No pull-up, pull-down for PFx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
343 GPIOF->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
344
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
345 /* Connect PGx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
346 GPIOG->AFR[0] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
347 GPIOG->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
348 /* Configure PGx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
349 GPIOG->MODER = 0xAAAAAAAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
350 /* Configure PGx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
351 GPIOG->OSPEEDR = 0xAAAAAAAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
352 /* Configure PGx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
353 GPIOG->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
354 /* No pull-up, pull-down for PGx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
355 GPIOG->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
356
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
357 /* Connect PHx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
358 GPIOH->AFR[0] = 0x00C0CC00;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
359 GPIOH->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
360 /* Configure PHx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
361 GPIOH->MODER = 0xAAAA08A0;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
362 /* Configure PHx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
363 GPIOH->OSPEEDR = 0xAAAA08A0;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
364 /* Configure PHx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
365 GPIOH->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
366 /* No pull-up, pull-down for PHx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
367 GPIOH->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
368
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
369 /* Connect PIx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
370 GPIOI->AFR[0] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
371 GPIOI->AFR[1] = 0x00000CC0;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
372 /* Configure PIx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
373 GPIOI->MODER = 0x0028AAAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
374 /* Configure PIx pins speed to 50 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
375 GPIOI->OSPEEDR = 0x0028AAAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
376 /* Configure PIx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
377 GPIOI->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
378 /* No pull-up, pull-down for PIx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
379 GPIOI->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
380
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
381 /*-- FMC Configuration ------------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
382 /* Enable the FMC interface clock */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
383 RCC->AHB3ENR |= 0x00000001;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
384
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
385 /* Configure and enable SDRAM bank1 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
386 FMC_Bank5_6->SDCR[0] = 0x000019E0;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
387 FMC_Bank5_6->SDTR[0] = 0x01115351;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
388
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
389 /* SDRAM initialization sequence */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
390 /* Clock enable command */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
391 FMC_Bank5_6->SDCMR = 0x00000011;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
392 tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
393 while((tmpreg != 0) && (timeout-- > 0))
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
394 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
395 tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
396 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
397
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
398 /* Delay */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
399 for (index = 0; index<1000; index++);
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
400
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
401 /* PALL command */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
402 FMC_Bank5_6->SDCMR = 0x00000012;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
403 timeout = 0xFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
404 while((tmpreg != 0) && (timeout-- > 0))
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
405 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
406 tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
407 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
408
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
409 /* Auto refresh command */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
410 FMC_Bank5_6->SDCMR = 0x00000073;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
411 timeout = 0xFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
412 while((tmpreg != 0) && (timeout-- > 0))
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
413 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
414 tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
415 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
416
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
417 /* MRD register program */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
418 FMC_Bank5_6->SDCMR = 0x00046014;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
419 timeout = 0xFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
420 while((tmpreg != 0) && (timeout-- > 0))
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
421 {
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
422 tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
423 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
424
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
425 /* Set refresh count */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
426 tmpreg = FMC_Bank5_6->SDRTR;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
427 FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1));
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
428
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
429 /* Disable write protection */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
430 tmpreg = FMC_Bank5_6->SDCR[0];
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
431 FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
432 #endif /* DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
433 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
434
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
435 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
436 #if defined(DATA_IN_ExtSRAM)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
437 /*-- GPIOs Configuration -----------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
438 /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
439 RCC->AHB1ENR |= 0x00000078;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
440
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
441 /* Connect PDx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
442 GPIOD->AFR[0] = 0x00CCC0CC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
443 GPIOD->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
444 /* Configure PDx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
445 GPIOD->MODER = 0xAAAA0A8A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
446 /* Configure PDx pins speed to 100 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
447 GPIOD->OSPEEDR = 0xFFFF0FCF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
448 /* Configure PDx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
449 GPIOD->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
450 /* No pull-up, pull-down for PDx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
451 GPIOD->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
452
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
453 /* Connect PEx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
454 GPIOE->AFR[0] = 0xC00CC0CC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
455 GPIOE->AFR[1] = 0xCCCCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
456 /* Configure PEx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
457 GPIOE->MODER = 0xAAAA828A;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
458 /* Configure PEx pins speed to 100 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
459 GPIOE->OSPEEDR = 0xFFFFC3CF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
460 /* Configure PEx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
461 GPIOE->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
462 /* No pull-up, pull-down for PEx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
463 GPIOE->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
464
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
465 /* Connect PFx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
466 GPIOF->AFR[0] = 0x00CCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
467 GPIOF->AFR[1] = 0xCCCC0000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
468 /* Configure PFx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
469 GPIOF->MODER = 0xAA000AAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
470 /* Configure PFx pins speed to 100 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
471 GPIOF->OSPEEDR = 0xFF000FFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
472 /* Configure PFx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
473 GPIOF->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
474 /* No pull-up, pull-down for PFx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
475 GPIOF->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
476
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
477 /* Connect PGx pins to FMC Alternate function */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
478 GPIOG->AFR[0] = 0x00CCCCCC;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
479 GPIOG->AFR[1] = 0x000000C0;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
480 /* Configure PGx pins in Alternate function mode */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
481 GPIOG->MODER = 0x00085AAA;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
482 /* Configure PGx pins speed to 100 MHz */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
483 GPIOG->OSPEEDR = 0x000CAFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
484 /* Configure PGx pins Output type to push-pull */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
485 GPIOG->OTYPER = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
486 /* No pull-up, pull-down for PGx pins */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
487 GPIOG->PUPDR = 0x00000000;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
488
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
489 /*-- FMC/FSMC Configuration --------------------------------------------------*/
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
490 /* Enable the FMC/FSMC interface clock */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
491 RCC->AHB3ENR |= 0x00000001;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
492
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
493 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
494 /* Configure and enable Bank1_SRAM2 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
495 FMC_Bank1->BTCR[2] = 0x00001011;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
496 FMC_Bank1->BTCR[3] = 0x00000201;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
497 FMC_Bank1E->BWTR[2] = 0x0fffffff;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
498 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
499
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
500 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
501 /* Configure and enable Bank1_SRAM2 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
502 FSMC_Bank1->BTCR[2] = 0x00001011;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
503 FSMC_Bank1->BTCR[3] = 0x00000201;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
504 FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF;
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
505 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
506
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
507 #endif /* DATA_IN_ExtSRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
508 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
509 }
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
510 #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
511 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
512 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
513 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
514
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
515 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
516 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
517 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
518
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
519 /**
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
520 * @}
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
521 */
2de06b1abed3 CLEAN retrieve original startup code. reset linker script.
jDG
parents:
diff changeset
522 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/