diff --git a/stm-firmware/boot/startup_stm32f407vx.c b/stm-firmware/boot/startup_stm32f407vx.c index 71a3d80..c6fb891 100644 --- a/stm-firmware/boot/startup_stm32f407vx.c +++ b/stm-firmware/boot/startup_stm32f407vx.c @@ -18,6 +18,8 @@ * ------------------------------------------------------------------------ */ +#include + /* C++ library init */ # if defined(__cplusplus) extern "C" { @@ -280,9 +282,22 @@ extern unsigned int __ld_ebss; extern unsigned int __ld_sheap; extern unsigned int __ld_eheap; +#ifdef CPACR +#undef CPACR +#endif + +#define CPACR (*((volatile uint32_t *)0xE000ED88)) + void Reset_Handler(void) { /* Stack is already initialized by hardware */ + /* The first thing we do here, is to initialize the FPU + * When this code is compiled optimized with hardfpu abi, + * GCC tends to generate FPU instructions for data copying + */ + CPACR |= (0xF << 20); + + /* Copy .data section */ __init_section(&__ld_load_data, &__ld_sdata, &__ld_edata); /* Fill bss with zero */