From 51daa249946adbbbe9c9b6393196028999b4439f Mon Sep 17 00:00:00 2001 From: ReservedField Date: Tue, 9 Aug 2016 18:43:41 +0200 Subject: [PATCH] Consolidate FPU setup into startup.s --- Makefile | 1 - src/startup/fpsetup.s | 48 ------------------------------------------- src/startup/startup.s | 29 ++++++++++++++++++++++---- 3 files changed, 25 insertions(+), 53 deletions(-) delete mode 100644 src/startup/fpsetup.s diff --git a/Makefile b/Makefile index 6df74b3..fe7985d 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,6 @@ OBJS_NOFPU := src/thread/Thread.o \ TAGNAME := src/startup/evicsdk_tag OBJS_CRT0 := src/startup/startup.o \ - src/startup/fpsetup.o \ src/thread/ContextSwitch.o \ $(TAGNAME).o diff --git a/src/startup/fpsetup.s b/src/startup/fpsetup.s deleted file mode 100644 index 077954d..0000000 --- a/src/startup/fpsetup.s +++ /dev/null @@ -1,48 +0,0 @@ -@ This file is part of eVic SDK. -@ -@ eVic SDK is free software: you can redistribute it and/or modify -@ it under the terms of the GNU General Public License as published by -@ the Free Software Foundation, either version 3 of the License, or -@ (at your option) any later version. -@ -@ eVic SDK is distributed in the hope that it will be useful, -@ but WITHOUT ANY WARRANTY; without even the implied warranty of -@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -@ GNU General Public License for more details. -@ -@ You should have received a copy of the GNU General Public License -@ along with eVic SDK. If not, see . -@ -@ Copyright (C) 2016 ReservedField - -.syntax unified - -.global Startup_FpSetup -.thumb_func -Startup_FpSetup: - LDR R0, =0xE000EF34 - LDR R1, [R0] -#ifdef EVICSDK_FPU_SUPPORT - @ Enable lazy stacking - @ (ASPEN = 1, LSPEN = 1, i.e. FPCCR[31:30] = 11) - ORR R1, #(0x3 << 30) -#else - @ Disable lazy stacking, disable FPU state saving - @ (ASPEN = 0, LSPEN = 0, i.e. FPCCR[31:30] = 00) - BIC R1, #(0x3 << 30) -#endif - STR R1, [R0] - -#ifdef EVICSDK_FPU_SUPPORT - @ Enable FPU (enable CP10/CP11, i.e. CPACR[23:20] = 1111) - LDR R0, =0xE000ED88 - LDR R1, [R0] - ORR R1, R1, #(0xF << 20) - STR R1, [R0] - - @ FPU enabled: sync barrier, flush pipeline - DSB - ISB -#endif - - BX LR diff --git a/src/startup/startup.s b/src/startup/startup.s index 1b41af9..eb43edd 100755 --- a/src/startup/startup.s +++ b/src/startup/startup.s @@ -160,12 +160,33 @@ Reset_Handler: @ Select INV type for HXT (CLK_PWRCTL[12] = 0) LDR R0, =0x40000200 LDR R1, [R0] - BIC R1, R1, #0x1000 + BIC R1, #0x1000 STR R1, [R0] - @ Setup FPU and floating-point stacking - LDR R0, =Startup_FpSetup - BLX R0 + LDR R0, =0xE000EF34 + LDR R1, [R0] +#ifdef EVICSDK_FPU_SUPPORT + @ Enable lazy stacking + @ (ASPEN = 1, LSPEN = 1, i.e. FPCCR[31:30] = 11) + ORR R1, #(0x3 << 30) +#else + @ Disable lazy stacking, disable FPU state saving + @ (ASPEN = 0, LSPEN = 0, i.e. FPCCR[31:30] = 00) + BIC R1, #(0x3 << 30) +#endif + STR R1, [R0] + +#ifdef EVICSDK_FPU_SUPPORT + @ Enable FPU (enable CP10/CP11, i.e. CPACR[23:20] = 1111) + LDR R0, =0xE000ED88 + LDR R1, [R0] + ORR R1, R1, #(0xF << 20) + STR R1, [R0] + + @ FPU enabled: sync barrier, flush pipeline + DSB + ISB +#endif @ Copy .data to RAM. Symbols defined by linker script: @ Data_Start_ROM: start of .data section in ROM