Skip to content

Commit

Permalink
use a single core folder for all ARM architectures.
Browse files Browse the repository at this point in the history
This should reduce code duplication.
  • Loading branch information
Masmiseim36 authored and JonatanAntoni committed Jul 10, 2023
1 parent 1e8d111 commit f9507ab
Show file tree
Hide file tree
Showing 70 changed files with 222 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ typedef struct
#endif

#if (__GIC_PRESENT == 1U) || defined(DOXYGEN)
#include "../../Core/gic_v20.h"
#include "gic_v20.h"
#endif /* (__GIC_PRESENT == 1U) || defined(DOXYGEN) */

#if (__TIM_PRESENT == 1U) || defined(DOXYGEN)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**************************************************************************//**
* @file cmsis_cp15.h
* @file armv7a_cp15.h
* @brief CMSIS compiler specific macros, functions, instructions
* @version V1.0.2
* @date 19. December 2022
Expand Down
15 changes: 10 additions & 5 deletions CMSIS/Core_R/Include/armv7r.h → CMSIS/Core/Include/armv7r.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@
#warning "__VIC_PRESENT not defined in device header file; using default!"
#endif

#ifndef __GIC_PRESENT
#define __GIC_PRESENT 1U
#warning "__GIC_PRESENT not defined in device header file; using default!"
#endif

#if (__GIC_PRESENT == 1U) && (__VIC_PRESENT == 1U)
#error "Only one Interrupt Controller can be used"
#endif

#ifndef __MPU_PRESENT
#define __MPU_PRESENT 0U
#warning "__MPU_PRESENT not defined in device header file; using default!"
Expand Down Expand Up @@ -450,13 +459,9 @@ typedef union
#endif /* (__VIC_PRESENT == 1U) || defined(DOXYGEN) */

#if (__GIC_PRESENT == 1U) || defined(DOXYGEN)
#include "../../Core/gic_v20.h"
#include "gic_v20.h"
#endif /* (__GIC_PRESENT == 1U) || defined(DOXYGEN) */

#if (__GIC_PRESENT == 1U) && (__VIC_PRESENT == 1U)
#error "Only one Interrupt Controller can be used"
#endif

#ifdef __cplusplus
}
#endif
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,86 @@
* Arm Compiler 4/5
*/
#if defined ( __CC_ARM )
#include "cmsis_armcc.h"
#if defined __CORTEX_A
#include "cmsis_cortexa_armcc.h"
#elif defined __CORTEX_R
#include "cmsis_cortexr_armcc.h"
#elif defined __CORTEX_M
#include "cmsis_cortexm_armcc.h"
#else
#error "Unknown architecture"
#endif


/*
* Arm Compiler 6.6 LTM (armclang)
*/
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100)
#include "cmsis_armclang_ltm.h"
#if defined __CORTEX_A
#error "Core-R is not supported for this compiler"
#elif defined __CORTEX_R
#error "Core-R is not supported for this compiler"
#elif defined __CORTEX_M
#include "cmsis_corem_armclang_ltm.h"
#else
#error "Unknown architecture"
#endif

/*
* Arm Compiler above 6.10.1 (armclang)
*/
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
#include "cmsis_armclang.h"
#if defined __CORTEX_A
#include "cmsis_corema_armclang.h"
#elif defined __CORTEX_R
#include "cmsis_corer_armclang.h"
#elif defined __CORTEX_M
#include "cmsis_corem_armclang.h"
#else
#error "Unknown architecture"
#endif

/*
* TI Arm Clang Compiler (tiarmclang)
*/
#elif defined (__ti__)
#include "cmsis_tiarmclang.h"
#if defined __CORTEX_A
#error "Core-R is not supported for this compiler"
#elif defined __CORTEX_R
#error "Core-R is not supported for this compiler"
#elif defined __CORTEX_M
#include "cmsis_corem_tiarmclang.h"
#else
#error "Unknown architecture"
#endif

/*
* GNU Compiler
*/
#elif defined ( __GNUC__ )
#include "cmsis_gcc.h"
#if defined __CORTEX_A
#include "cmsis_corea_gcc.h"
#elif defined __CORTEX_R
#include "cmsis_corer_gcc.h"
#elif defined __CORTEX_M
#include "cmsis_corem_gcc.h"
#else
#error "Unknown architecture"
#endif

/*
* IAR Compiler
*/
#elif defined ( __ICCARM__ )
#include <cmsis_iccarm.h>
#if defined __CORTEX_A
#include "cmsis_corea_iccarm.h"
#elif defined __CORTEX_R
#include "cmsis_corer_iccarm.h"
#elif defined __CORTEX_M
#include "cmsis_corem_iccarm.h"
#else
#error "Unknown architecture"
#endif


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define __CMSIS_ARMCC_H

// Include the generic settigs:
#include "../../Core/cmsis_generic_armcc.h"
#include "cmsis_generic_armcc.h"


/** \brief Get CPSR (Current Program Status Register)
Expand Down Expand Up @@ -162,7 +162,7 @@ __STATIC_INLINE void __set_FPEXC(uint32_t fpexc)
__ASM volatile("MCRR p" # cp ", " # op1 ", ltmp, htmp, c" # CRm); \
} while(0)

#include "cmsis_cp15.h"
#include "armv7a_cp15.h"

/** \brief Enable Floating Point Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#pragma clang system_header /* treat file as system include file */

// Include the generic settigs:
#include "../../Core/cmsis_generic_armclang.h"
#include "cmsis_generic_armclang.h"


/* ########################### Core Function Access ########################### */
Expand Down Expand Up @@ -157,7 +157,7 @@ __STATIC_FORCEINLINE void __set_FPEXC(uint32_t fpexc)
#define __get_CP64(cp, op1, Rt, CRm) __ASM volatile("MRRC p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : "=r" (Rt) : : "memory" )
#define __set_CP64(cp, op1, Rt, CRm) __ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )

#include "cmsis_cp15.h"
#include "armv7a_cp15.h"

/** \brief Enable Floating Point Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define __CMSIS_GCC_H

// Include the generic settigs:
#include "../../Core/cmsis_generic_gcc.h"
#include "cmsis_generic_gcc.h"

/* ignore some GCC warnings */
#pragma GCC diagnostic push
Expand Down Expand Up @@ -266,7 +266,7 @@ __STATIC_FORCEINLINE void __set_FPEXC(uint32_t fpexc)
#define __get_CP64(cp, op1, Rt, CRm) __ASM volatile("MRRC p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : "=r" (Rt) : : "memory" )
#define __set_CP64(cp, op1, Rt, CRm) __ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )

#include "cmsis_cp15.h"
#include "armv7a_cp15.h"

/** \brief Enable Floating Point Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define __CMSIS_ICCARM_H__

// Include the generic settigs:
#include "../../Core/cmsis_generic_iccarm.h"
#include "cmsis_generic_iccarm.h"

#ifndef __ICCARM__
#error This file should only be compiled by ICCARM
Expand Down Expand Up @@ -75,7 +75,7 @@
#define __set_CP64(cp, op1, Rt, CRm) \
__ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )

#include "cmsis_cp15.h"
#include "armv7a_cp15.h"


#if !((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)))
Expand Down Expand Up @@ -160,7 +160,7 @@
#define __set_CP64(cp, op1, Rt, CRm) \
__ASM volatile("MCRR p" # cp ", " # op1 ", %Q0, %R0, c" # CRm : : "r" (Rt) : "memory" )

#include "cmsis_cp15.h"
#include "armv7a_cp15.h"

#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define __CMSIS_ARMCC_H

// Include the generic settigs:
#include "../../Core/cmsis_generic_armcc.h"
#include "cmsis_generic_armcc.h"

/* ######################### Startup and Lowlevel Init ######################## */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#pragma clang system_header /* treat file as system include file */

// Include the generic settigs:
#include "../../Core/cmsis_generic_armclang.h"
#include "cmsis_generic_armclang.h"

/* ######################### Startup and Lowlevel Init ######################## */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#pragma clang system_header /* treat file as system include file */

// Include the generic settigs:
#include "../../Core/cmsis_generic_armclang_ltm.h"
#include "cmsis_generic_armclang_ltm.h"

/* ######################### Startup and Lowlevel Init ######################## */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define __CMSIS_GCC_H

// Include the generic settigs:
#include "../../Core/cmsis_generic_gcc.h"
#include "cmsis_generic_gcc.h"

/* ignore some GCC warnings */
#pragma GCC diagnostic push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define __CMSIS_ICCARM_H__

// Include the generic settigs:
#include "../../Core/cmsis_generic_iccarm.h"
#include "cmsis_generic_iccarm.h"

#ifndef __ICCARM__
#error This file should only be compiled by ICCARM
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,26 @@
#define __CMSIS_ARMCC_H

// Include the generic settigs:
#include "../../Core/cmsis_generic_armcc.h"
#include "cmsis_generic_armcc.h"


/** \brief Get Stack Pointer
\return Stack Pointer
*/
__STATIC_INLINE __ASM uint32_t __get_SP(void)
{
MOV r0, sp
BX lr
}

/** \brief Set Stack Pointer
\param [in] stack Stack Pointer value to set
*/
__STATIC_INLINE __ASM void __set_SP(uint32_t stack)
{
MOV sp, r0
BX lr
}


#endif /* __CMSIS_ARMCC_H */
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@
#pragma clang system_header /* treat file as system include file */

// Include the generic settigs:
#include "../../Core/cmsis_generic_armclang.h"
#include "cmsis_generic_armclang.h"


/** \brief Get Stack Pointer
\return Stack Pointer value
*/
__STATIC_FORCEINLINE uint32_t __get_SP(void)
{
uint32_t result;
__ASM volatile("MOV %0, sp" : "=r" (result) : : "memory");
return result;
}

/** \brief Set Stack Pointer
\param [in] stack Stack Pointer value to set
*/
__STATIC_FORCEINLINE void __set_SP(uint32_t stack)
{
__ASM volatile("MOV sp, %0" : : "r" (stack) : "memory");
}


#endif /* __CMSIS_ARMCLANG_H */
Loading

0 comments on commit f9507ab

Please sign in to comment.