Skip to content

Commit 8da3caa

Browse files
committed
- Add initial support for ARMv8A, ARMV7R and ARMV8R
- Added core_cxx.h files for ARMv8A, ARMV7R and ARMV8R based profiles - Moved gic peripheral to separate file - Moved __FPU_Enable function to the architecture specific file
1 parent f090171 commit 8da3caa

26 files changed

Lines changed: 3062 additions & 965 deletions
Lines changed: 90 additions & 751 deletions
Large diffs are not rendered by default.

CMSIS/Core/Include/a-profile/cmsis_cp15.h renamed to CMSIS/Core/Include/a-profile/armv7a_cp15.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**************************************************************************//**
2-
* @file cmsis_cp15.h
2+
* @file armv7a_cp15.h
33
* @brief CMSIS compiler specific macros, functions, instructions
44
* @version V1.0.2
55
* @date 19. December 2022
66
******************************************************************************/
77
/*
8-
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
8+
* Copyright (c) 2009-2023 ARM Limited. All rights reserved.
99
*
1010
* SPDX-License-Identifier: Apache-2.0
1111
*

CMSIS/Core/Include/a-profile/armv8a.h

Lines changed: 647 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/**************************************************************************//**
2+
* @file armv8a_system_control.h
3+
* @brief CMSIS compiler specific macros, functions, instructions
4+
* @version V6.0.0
5+
* @date 4. August 2023
6+
******************************************************************************/
7+
/*
8+
* Copyright (c) 2009-2023 ARM Limited. All rights reserved.
9+
*
10+
* SPDX-License-Identifier: Apache-2.0
11+
*
12+
* Licensed under the Apache License, Version 2.0 (the License); you may
13+
* not use this file except in compliance with the License.
14+
* You may obtain a copy of the License at
15+
*
16+
* www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
20+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
#include <stdint.h>
25+
26+
#if defined ( __ICCARM__ )
27+
#pragma system_include /* treat file as system include file for MISRA check */
28+
#elif defined (__clang__)
29+
#pragma clang system_header /* treat file as system include file */
30+
#endif
31+
32+
#ifndef __CMSIS_SYSTEM_CONTROL_H
33+
#define __CMSIS_SYSTEM_CONTROL_H
34+
35+
36+
/** \brief Get MPIDR EL1
37+
\return Multiprocessor Affinity Register value
38+
*/
39+
__STATIC_FORCEINLINE uint64_t __get_MPIDR_EL1(void)
40+
{
41+
uint64_t result;
42+
__ASM volatile("MRS %0, MPIDR_EL1" : "=r" (result) : : "memory");
43+
return result;
44+
}
45+
46+
/** \brief Get MAIR EL3
47+
\return MAIR value
48+
*/
49+
__STATIC_FORCEINLINE uint64_t __get_MAIR_EL3(void)
50+
{
51+
uint64_t result;
52+
__ASM volatile("MRS %0, mair_el3" : "=r" (result) : : "memory");
53+
return result;
54+
}
55+
56+
/** \brief Set MAIR EL3
57+
\param [in] mair MAIR value to set
58+
*/
59+
__STATIC_FORCEINLINE void __set_MAIR_EL3(uint64_t mair)
60+
{
61+
__ASM volatile("MSR mair_el3, %0" : : "r" (mair) : "memory");
62+
}
63+
64+
/** \brief Get TCR EL3
65+
\return TCR value
66+
*/
67+
__STATIC_FORCEINLINE uint64_t __get_TCR_EL3(void)
68+
{
69+
uint64_t result;
70+
__ASM volatile("MRS %0, tcr_el3" : "=r" (result) : : "memory");
71+
return result;
72+
}
73+
74+
/** \brief Set TCR EL3
75+
\param [in] tcr TCR value to set
76+
*/
77+
__STATIC_FORCEINLINE void __set_TCR_EL3(uint64_t tcr)
78+
{
79+
__ASM volatile("MSR tcr_el3, %0" : : "r" (tcr) : "memory");
80+
}
81+
82+
/** \brief Get TTBR0 EL3
83+
\return Translation Table Base Register 0 value
84+
*/
85+
__STATIC_FORCEINLINE uint64_t __get_TTBR0_EL3(void)
86+
{
87+
uint64_t result;
88+
__ASM volatile("MRS %0, ttbr0_el3" : "=r" (result) : : "memory");
89+
return result;
90+
}
91+
92+
/** \brief Set TTBR0 EL3
93+
\param [in] ttbr0 Translation Table Base Register 0 value to set
94+
*/
95+
__STATIC_FORCEINLINE void __set_TTBR0_EL3(uint64_t ttbr0)
96+
{
97+
__ASM volatile("MSR ttbr0_el3, %0" : : "r" (ttbr0) : "memory");
98+
}
99+
100+
/** \brief Get SCTLR EL3
101+
\return STRLR EL3 value
102+
*/
103+
__STATIC_FORCEINLINE uint64_t __get_SCTLR_EL3(void)
104+
{
105+
uint64_t result;
106+
__ASM volatile("MRS %0, sctlr_el3" : "=r" (result) : : "memory");
107+
return result;
108+
}
109+
110+
/** \brief Set SCTLR EL3
111+
\param [in] vbar SCTLR value to set
112+
*/
113+
__STATIC_FORCEINLINE void __set_SCTLR_EL3(uint64_t sctlr)
114+
{
115+
__ASM volatile("MSR sctlr_el3, %0" : : "r" (sctlr) : "memory");
116+
}
117+
118+
/** \brief Set VBAR EL3
119+
\param [in] vbar VBAR value to set
120+
*/
121+
__STATIC_FORCEINLINE void __set_VBAR_EL3(uint64_t vbar)
122+
{
123+
__ASM volatile("MSR vbar_el3, %0" : : "r" (vbar) : "memory");
124+
}
125+
126+
/** \brief Set VBAR EL2
127+
\param [in] vbar VBAR value to set
128+
*/
129+
__STATIC_FORCEINLINE void __set_VBAR_EL2(uint64_t vbar)
130+
{
131+
__ASM volatile("MSR vbar_el2, %0" : : "r" (vbar) : "memory");
132+
}
133+
134+
/** \brief Set VBAR EL1
135+
\param [in] vbar VBAR value to set
136+
*/
137+
__STATIC_FORCEINLINE void __set_VBAR_EL1(uint64_t vbar)
138+
{
139+
__ASM volatile("MSR vbar_el1, %0" : : "r" (vbar) : "memory");
140+
}
141+
142+
143+
#endif /* __CMSIS_SYSTEM_CONTROL_H */

CMSIS/Core/Include/a-profile/cmsis_armclang_a.h

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -571,74 +571,4 @@ __STATIC_FORCEINLINE void __set_FPEXC(uint32_t fpexc)
571571

572572
#include "cmsis_cp15.h"
573573

574-
/** \brief Enable Floating Point Unit
575-
576-
Critical section, called from undef handler, so systick is disabled
577-
*/
578-
__STATIC_INLINE void __FPU_Enable(void)
579-
{
580-
__ASM volatile(
581-
//Permit access to VFP/NEON, registers by modifying CPACR
582-
" MRC p15,0,R1,c1,c0,2 \n"
583-
" ORR R1,R1,#0x00F00000 \n"
584-
" MCR p15,0,R1,c1,c0,2 \n"
585-
586-
//Ensure that subsequent instructions occur in the context of VFP/NEON access permitted
587-
" ISB \n"
588-
589-
//Enable VFP/NEON
590-
" VMRS R1,FPEXC \n"
591-
" ORR R1,R1,#0x40000000 \n"
592-
" VMSR FPEXC,R1 \n"
593-
594-
//Initialise VFP/NEON registers to 0
595-
" MOV R2,#0 \n"
596-
597-
//Initialise D16 registers to 0
598-
" VMOV D0, R2,R2 \n"
599-
" VMOV D1, R2,R2 \n"
600-
" VMOV D2, R2,R2 \n"
601-
" VMOV D3, R2,R2 \n"
602-
" VMOV D4, R2,R2 \n"
603-
" VMOV D5, R2,R2 \n"
604-
" VMOV D6, R2,R2 \n"
605-
" VMOV D7, R2,R2 \n"
606-
" VMOV D8, R2,R2 \n"
607-
" VMOV D9, R2,R2 \n"
608-
" VMOV D10,R2,R2 \n"
609-
" VMOV D11,R2,R2 \n"
610-
" VMOV D12,R2,R2 \n"
611-
" VMOV D13,R2,R2 \n"
612-
" VMOV D14,R2,R2 \n"
613-
" VMOV D15,R2,R2 \n"
614-
615-
#if (defined(__ARM_NEON) && (__ARM_NEON == 1))
616-
//Initialise D32 registers to 0
617-
" VMOV D16,R2,R2 \n"
618-
" VMOV D17,R2,R2 \n"
619-
" VMOV D18,R2,R2 \n"
620-
" VMOV D19,R2,R2 \n"
621-
" VMOV D20,R2,R2 \n"
622-
" VMOV D21,R2,R2 \n"
623-
" VMOV D22,R2,R2 \n"
624-
" VMOV D23,R2,R2 \n"
625-
" VMOV D24,R2,R2 \n"
626-
" VMOV D25,R2,R2 \n"
627-
" VMOV D26,R2,R2 \n"
628-
" VMOV D27,R2,R2 \n"
629-
" VMOV D28,R2,R2 \n"
630-
" VMOV D29,R2,R2 \n"
631-
" VMOV D30,R2,R2 \n"
632-
" VMOV D31,R2,R2 \n"
633-
#endif
634-
635-
//Initialise FPSCR to a known state
636-
" VMRS R1,FPSCR \n"
637-
" LDR R2,=0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
638-
" AND R1,R1,R2 \n"
639-
" VMSR FPSCR,R1 "
640-
: : : "cc", "r1", "r2"
641-
);
642-
}
643-
644574
#endif /* __CMSIS_ARMCLANG_A_H */

CMSIS/Core/Include/a-profile/cmsis_gcc_a.h

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -889,70 +889,6 @@ __STATIC_FORCEINLINE void __set_FPEXC(uint32_t fpexc)
889889

890890
#include "cmsis_cp15.h"
891891

892-
/** \brief Enable Floating Point Unit
893-
894-
Critical section, called from undef handler, so systick is disabled
895-
*/
896-
__STATIC_INLINE void __FPU_Enable(void)
897-
{
898-
// Permit access to VFP/NEON, registers by modifying CPACR
899-
const uint32_t cpacr = __get_CPACR();
900-
__set_CPACR(cpacr | 0x00F00000ul);
901-
__ISB();
902-
903-
// Enable VFP/NEON
904-
const uint32_t fpexc = __get_FPEXC();
905-
__set_FPEXC(fpexc | 0x40000000ul);
906-
907-
__ASM volatile(
908-
// Initialise VFP/NEON registers to 0
909-
" MOV R2,#0 \n"
910-
911-
// Initialise D16 registers to 0
912-
" VMOV D0, R2,R2 \n"
913-
" VMOV D1, R2,R2 \n"
914-
" VMOV D2, R2,R2 \n"
915-
" VMOV D3, R2,R2 \n"
916-
" VMOV D4, R2,R2 \n"
917-
" VMOV D5, R2,R2 \n"
918-
" VMOV D6, R2,R2 \n"
919-
" VMOV D7, R2,R2 \n"
920-
" VMOV D8, R2,R2 \n"
921-
" VMOV D9, R2,R2 \n"
922-
" VMOV D10,R2,R2 \n"
923-
" VMOV D11,R2,R2 \n"
924-
" VMOV D12,R2,R2 \n"
925-
" VMOV D13,R2,R2 \n"
926-
" VMOV D14,R2,R2 \n"
927-
" VMOV D15,R2,R2 \n"
928-
929-
#if (defined(__ARM_NEON) && (__ARM_NEON == 1))
930-
// Initialise D32 registers to 0
931-
" VMOV D16,R2,R2 \n"
932-
" VMOV D17,R2,R2 \n"
933-
" VMOV D18,R2,R2 \n"
934-
" VMOV D19,R2,R2 \n"
935-
" VMOV D20,R2,R2 \n"
936-
" VMOV D21,R2,R2 \n"
937-
" VMOV D22,R2,R2 \n"
938-
" VMOV D23,R2,R2 \n"
939-
" VMOV D24,R2,R2 \n"
940-
" VMOV D25,R2,R2 \n"
941-
" VMOV D26,R2,R2 \n"
942-
" VMOV D27,R2,R2 \n"
943-
" VMOV D28,R2,R2 \n"
944-
" VMOV D29,R2,R2 \n"
945-
" VMOV D30,R2,R2 \n"
946-
" VMOV D31,R2,R2 \n"
947-
#endif
948-
: : : "cc", "r2"
949-
);
950-
951-
// Initialise FPSCR to a known state
952-
const uint32_t fpscr = __get_FPSCR();
953-
__set_FPSCR(fpscr & 0x00086060ul);
954-
}
955-
956892
/*@} end of group CMSIS_Core_intrinsics */
957893

958894
#pragma GCC diagnostic pop

CMSIS/Core/Include/a-profile/cmsis_iccarm_a.h

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -495,75 +495,6 @@ __IAR_FT void __set_SP_usr(uint32_t topOfProcStack)
495495

496496
#define __get_mode() (__get_CPSR() & 0x1FU)
497497

498-
__STATIC_INLINE
499-
void __FPU_Enable(void)
500-
{
501-
__ASM volatile(
502-
//Permit access to VFP/NEON, registers by modifying CPACR
503-
" MRC p15,0,R1,c1,c0,2 \n"
504-
" ORR R1,R1,#0x00F00000 \n"
505-
" MCR p15,0,R1,c1,c0,2 \n"
506-
507-
//Ensure that subsequent instructions occur in the context of VFP/NEON access permitted
508-
" ISB \n"
509-
510-
//Enable VFP/NEON
511-
" VMRS R1,FPEXC \n"
512-
" ORR R1,R1,#0x40000000 \n"
513-
" VMSR FPEXC,R1 \n"
514-
515-
//Initialise VFP/NEON registers to 0
516-
" MOV R2,#0 \n"
517-
518-
//Initialise D16 registers to 0
519-
" VMOV D0, R2,R2 \n"
520-
" VMOV D1, R2,R2 \n"
521-
" VMOV D2, R2,R2 \n"
522-
" VMOV D3, R2,R2 \n"
523-
" VMOV D4, R2,R2 \n"
524-
" VMOV D5, R2,R2 \n"
525-
" VMOV D6, R2,R2 \n"
526-
" VMOV D7, R2,R2 \n"
527-
" VMOV D8, R2,R2 \n"
528-
" VMOV D9, R2,R2 \n"
529-
" VMOV D10,R2,R2 \n"
530-
" VMOV D11,R2,R2 \n"
531-
" VMOV D12,R2,R2 \n"
532-
" VMOV D13,R2,R2 \n"
533-
" VMOV D14,R2,R2 \n"
534-
" VMOV D15,R2,R2 \n"
535-
536-
#ifdef __ARM_ADVANCED_SIMD__
537-
//Initialise D32 registers to 0
538-
" VMOV D16,R2,R2 \n"
539-
" VMOV D17,R2,R2 \n"
540-
" VMOV D18,R2,R2 \n"
541-
" VMOV D19,R2,R2 \n"
542-
" VMOV D20,R2,R2 \n"
543-
" VMOV D21,R2,R2 \n"
544-
" VMOV D22,R2,R2 \n"
545-
" VMOV D23,R2,R2 \n"
546-
" VMOV D24,R2,R2 \n"
547-
" VMOV D25,R2,R2 \n"
548-
" VMOV D26,R2,R2 \n"
549-
" VMOV D27,R2,R2 \n"
550-
" VMOV D28,R2,R2 \n"
551-
" VMOV D29,R2,R2 \n"
552-
" VMOV D30,R2,R2 \n"
553-
" VMOV D31,R2,R2 \n"
554-
#endif
555-
556-
//Initialise FPSCR to a known state
557-
" VMRS R1,FPSCR \n"
558-
" MOV32 R2,#0x00086060 \n" //Mask off all bits that do not have to be preserved. Non-preserved bits can/should be zero.
559-
" AND R1,R1,R2 \n"
560-
" VMSR FPSCR,R1 \n"
561-
: : : "cc", "r1", "r2"
562-
);
563-
}
564-
565-
566-
567498
#undef __IAR_FT
568499
#undef __ICCARM_V8
569500

0 commit comments

Comments
 (0)