mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-10 18:24:11 +01:00
102 lines
2.9 KiB
ArmAsm
102 lines
2.9 KiB
ArmAsm
/**
|
|
******************************************************************************
|
|
* @file startup_stm32f100_MD_BL.s
|
|
* @author MCD Application Team / Angus Peart / Michael Smith
|
|
* @brief STM32F2xx Devices startup - bootloader, no OS stack.
|
|
*******************************************************************************
|
|
* @copy
|
|
*
|
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
|
*
|
|
* <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2>
|
|
*/
|
|
|
|
.syntax unified
|
|
.cpu cortex-m3
|
|
.fpu softvfp
|
|
.thumb
|
|
|
|
.global SystemInit_ExtMemCtl_Dummy
|
|
.global Default_Handler
|
|
|
|
/* start address for the initialization values of the .data section.
|
|
defined in linker script */
|
|
.word _sidata
|
|
/* start address for the .data section. defined in linker script */
|
|
.word _sdata
|
|
/* end address for the .data section. defined in linker script */
|
|
.word _edata
|
|
/* start address for the .bss section. defined in linker script */
|
|
.word _sbss
|
|
/* end address for the .bss section. defined in linker script */
|
|
.word _ebss
|
|
|
|
.equ BootRAM, 0xF108F85F
|
|
/**
|
|
* @brief This is the code that gets called when the processor first
|
|
* starts execution following a reset event. Only the absolutely
|
|
* necessary set is performed, after which the application
|
|
* supplied main() routine is called.
|
|
* @param None
|
|
* @retval : None
|
|
*/
|
|
|
|
.section .text.Reset_Handler
|
|
.weak Reset_Handler
|
|
.type Reset_Handler, %function
|
|
Reset_Handler:
|
|
|
|
/* Copy the data segment initializers from flash to SRAM */
|
|
movs r1, #0
|
|
b LoopCopyDataInit
|
|
|
|
CopyDataInit:
|
|
ldr r3, =_sidata
|
|
ldr r3, [r3, r1]
|
|
str r3, [r0, r1]
|
|
adds r1, r1, #4
|
|
|
|
LoopCopyDataInit:
|
|
ldr r0, =_sdata
|
|
ldr r3, =_edata
|
|
adds r2, r0, r1
|
|
cmp r2, r3
|
|
bcc CopyDataInit
|
|
ldr r2, =_sbss
|
|
b LoopFillZerobss
|
|
/* Zero fill the bss segment. */
|
|
FillZerobss:
|
|
movs r3, #0
|
|
str r3, [r2], #4
|
|
|
|
LoopFillZerobss:
|
|
ldr r3, = _ebss
|
|
cmp r2, r3
|
|
bcc FillZerobss
|
|
/* Call the application's entry point.*/
|
|
bl main
|
|
bx lr
|
|
.size Reset_Handler, .-Reset_Handler
|
|
|
|
/**
|
|
* @brief This is the code that gets called when the processor receives an
|
|
* unexpected interrupt. This simply enters an infinite loop, preserving
|
|
* the system state for examination by a debugger.
|
|
*
|
|
* @param None
|
|
* @retval : None
|
|
*/
|
|
.section .text.Default_Handler,"ax",%progbits
|
|
Default_Handler:
|
|
Infinite_Loop:
|
|
b Infinite_Loop
|
|
.size Default_Handler, .-Default_Handler
|
|
|
|
#define INITIAL_STACK_TOP _estack
|
|
#include "vectors_stm32f2xx.S"
|