Skip to content

Commit 14150bb

Browse files
JonatanAntonid-kato
authored andcommitted
Core(A): Fixed __FPU_Enable function not to mess registers. (#589)
- Enhanced function to use only two temporary registers. - Added used registers to clobber list. Change-Id: If7c9462ed4424781e40379fbe12a5e4e3257920f
1 parent 874c087 commit 14150bb

File tree

4 files changed

+30
-25
lines changed

4 files changed

+30
-25
lines changed

cmsis/TARGET_CORTEX_A/cmsis_armcc.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**************************************************************************//**
22
* @file cmsis_armcc.h
33
* @brief CMSIS compiler specific macros, functions, instructions
4-
* @version V1.0.2
5-
* @date 10. January 2018
4+
* @version V1.0.3
5+
* @date 15. May 2019
66
******************************************************************************/
77
/*
8-
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
8+
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
99
*
1010
* SPDX-License-Identifier: Apache-2.0
1111
*
@@ -533,10 +533,10 @@ __STATIC_INLINE __ASM void __FPU_Enable(void)
533533
ENDIF
534534

535535
//Initialise FPSCR to a known state
536-
VMRS R2,FPSCR
537-
LDR R3,=0x00086060 //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
538-
AND R2,R2,R3
539-
VMSR FPSCR,R2
536+
VMRS R1,FPSCR
537+
LDR R2,=0x00086060 //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
538+
AND R1,R1,R2
539+
VMSR FPSCR,R1
540540

541541
BX LR
542542
}

cmsis/TARGET_CORTEX_A/cmsis_armclang.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**************************************************************************//**
22
* @file cmsis_armclang.h
33
* @brief CMSIS compiler specific macros, functions, instructions
4-
* @version V1.1.0
5-
* @date 18. March 2019
4+
* @version V1.1.1
5+
* @date 15. May 2019
66
******************************************************************************/
77
/*
88
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
@@ -509,10 +509,11 @@ __STATIC_INLINE void __FPU_Enable(void)
509509
#endif
510510

511511
//Initialise FPSCR to a known state
512-
" VMRS R2,FPSCR \n"
513-
" LDR R3,=0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
514-
" AND R2,R2,R3 \n"
515-
" VMSR FPSCR,R2 "
512+
" VMRS R1,FPSCR \n"
513+
" LDR R2,=0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
514+
" AND R1,R1,R2 \n"
515+
" VMSR FPSCR,R1 "
516+
: : : "cc", "r1", "r2"
516517
);
517518
}
518519

cmsis/TARGET_CORTEX_A/cmsis_gcc.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**************************************************************************//**
22
* @file cmsis_gcc.h
33
* @brief CMSIS compiler specific macros, functions, instructions
4-
* @version V1.1.0
5-
* @date 20. December 2018
4+
* @version V1.1.1
5+
* @date 15. May 2019
66
******************************************************************************/
77
/*
8-
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
8+
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
99
*
1010
* SPDX-License-Identifier: Apache-2.0
1111
*
@@ -683,10 +683,11 @@ __STATIC_INLINE void __FPU_Enable(void)
683683
#endif
684684

685685
//Initialise FPSCR to a known state
686-
" VMRS R2,FPSCR \n"
687-
" LDR R3,=0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
688-
" AND R2,R2,R3 \n"
689-
" VMSR FPSCR,R2 "
686+
" VMRS R1,FPSCR \n"
687+
" LDR R2,=0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
688+
" AND R1,R1,R2 \n"
689+
" VMSR FPSCR,R1 "
690+
: : : "cc", "r1", "r2"
690691
);
691692
}
692693

cmsis/TARGET_CORTEX_A/cmsis_iccarm.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
* @file cmsis_iccarm.h
33
* @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file
44
* @version V5.0.7
5-
* @date 04. Semptember 2018
5+
* @date 15. May 2019
66
******************************************************************************/
77

88
//------------------------------------------------------------------------------
99
//
1010
// Copyright (c) 2017-2018 IAR Systems
11+
// Copyright (c) 2018-2019 Arm Limited
1112
//
1213
// Licensed under the Apache License, Version 2.0 (the "License")
1314
// you may not use this file except in compliance with the License.
@@ -547,10 +548,12 @@ void __FPU_Enable(void)
547548
#endif
548549

549550
//Initialise FPSCR to a known state
550-
" VMRS R2,FPSCR \n"
551-
" MOV32 R3,#0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
552-
" AND R2,R2,R3 \n"
553-
" VMSR FPSCR,R2 \n");
551+
" VMRS R1,FPSCR \n"
552+
" MOV32 R2,#0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
553+
" AND R1,R1,R2 \n"
554+
" VMSR FPSCR,R1 \n"
555+
: : : "cc", "r1", "r2"
556+
);
554557
}
555558

556559

0 commit comments

Comments
 (0)