comparison startup_stm32f10x_md_mthomas.c @ 3:74e9b3baac1e

Jumbo commit to make things work. Note I have t
author Daniel O'Connor <darius@dons.net.au>
date Sun, 01 Jan 2012 11:01:13 +1030
parents c59513fd84fb
children 6ad0603ea909
comparison
equal deleted inserted replaced
2:274e01fa5a4c 3:74e9b3baac1e
159 #ifdef VECT_TAB_RAM 159 #ifdef VECT_TAB_RAM
160 __attribute__ ((section(".isr_vectorsflash"))) 160 __attribute__ ((section(".isr_vectorsflash")))
161 void (* const g_pfnVectorsStartup[])(void) = 161 void (* const g_pfnVectorsStartup[])(void) =
162 { 162 {
163 (intfunc)((unsigned long)&_estack), /* The initial stack pointer during startup */ 163 (intfunc)((unsigned long)&_estack), /* The initial stack pointer during startup */
164 Reset_Handler, /* The reset handler during startup */ 164 Reset_Handler, /* The reset handler during startup */
165 HardFault_Handler, /* Hard Fault Handler */ 165 HardFault_Handler, /* Hard Fault Handler */
166 MemManage_Handler, /* MPU Fault Handler */ 166 MemManage_Handler, /* MPU Fault Handler */
167 BusFault_Handler, /* Bus Fault Handler */ 167 BusFault_Handler, /* Bus Fault Handler */
168 UsageFault_Handler, /* Usage Fault Handler */ 168 UsageFault_Handler, /* Usage Fault Handler */
169 }; 169 };
260 /* Initialize data and bss */ 260 /* Initialize data and bss */
261 __Init_Data_and_BSS(); 261 __Init_Data_and_BSS();
262 262
263 /* Call CTORS of static objects, not needed for "pure C": */ 263 /* Call CTORS of static objects, not needed for "pure C": */
264 /* __libc_init_array(); */ 264 /* __libc_init_array(); */
265 /* if ( __libc_init_array ) 265
266 __libc_init_array()
267 } */
268
269 /* Setup the microcontroller system. Initialize the Embedded Flash Interface, 266 /* Setup the microcontroller system. Initialize the Embedded Flash Interface,
270 initialize the PLL and update the SystemFrequency variable. */ 267 initialize the PLL and update the SystemFrequency variable. */
271 SystemInit(); 268 SystemInit();
272 269
273 /* Call the application's entry point.*/ 270 /* Call the application's entry point.*/
274 main(); 271 main();
275 272
276 while(1) { ; } 273 while(1) {
274 }
277 } 275 }
278 276
279 /** 277 /**
280 * @brief initializes data and bss sections 278 * @brief initializes data and bss sections
281 * @param None 279 * @param None
282 * @retval : None 280 * @retval : None
283 */ 281 */
284 282
285 void __Init_Data_and_BSS(void) 283 void
286 { 284 __Init_Data_and_BSS(void) {
287 unsigned long *pulSrc, *pulDest; 285 unsigned long *pulSrc, *pulDest;
288 286
289 /* Copy the data segment initializers from flash to SRAM */ 287 /* Copy the data segment initializers from flash to SRAM */
290 pulSrc = &_sidata; 288 pulSrc = &_sidata;
291 pulDest = &_sdata; 289 pulDest = &_sdata;
292 if ( pulSrc != pulDest ) 290 if (pulSrc != pulDest) {
293 { 291 for(; pulDest < &_edata; ) {
294 for(; pulDest < &_edata; ) 292 *(pulDest++) = *(pulSrc++);
295 { 293 }
296 *(pulDest++) = *(pulSrc++);
297 } 294 }
298 } 295 /* Zero fill the bss segment. */
299 /* Zero fill the bss segment. */ 296 for(pulDest = &_sbss; pulDest < &_ebss; ) {
300 for(pulDest = &_sbss; pulDest < &_ebss; ) 297 *(pulDest++) = 0;
301 { 298 }
302 *(pulDest++) = 0;
303 }
304 } 299 }
305 300
306 /******************************************************************************* 301 /*******************************************************************************
307 * 302 *
308 * Provide weak aliases for each Exception handler to the Default_Handler. 303 * Provide weak aliases for each Exception handler to the Default_Handler.
369 * 364 *
370 * @param None 365 * @param None
371 * @retval : None 366 * @retval : None
372 */ 367 */
373 368
374 void Default_Handler(void) 369 void
375 { 370 Default_Handler(void) {
376 /* Go into an infinite loop. */ 371 /* Go into an infinite loop. */
377 while (1) 372 while (1) {
378 {
379 } 373 }
380 } 374 }
381 375
382 /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 376 /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/