From 8359caff3b6abb69bbdc6c4c5ad93c3066ed450a Mon Sep 17 00:00:00 2001 From: chrysn Date: Sun, 22 Apr 2012 22:07:01 +0200 Subject: moved core_cm3.h to more general location --- .../efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h | 100 --------------------- .../miniblink-efm32lib/core_cm3.h | 1 - .../test-efm32lib/core_cm3.c | 8 -- .../test-efm32lib/core_cm3.h | 1 - include/libopencmsis/core_cm3.h | 100 +++++++++++++++++++++ 5 files changed, 100 insertions(+), 110 deletions(-) delete mode 100644 examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h delete mode 120000 examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/core_cm3.h delete mode 100644 examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.c delete mode 120000 examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.h create mode 100644 include/libopencmsis/core_cm3.h diff --git a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h b/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h deleted file mode 100644 index 2ce1662..0000000 --- a/examples/efm32/tinygecko/efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef OPENCMSIS_CORECM3_H -#define OPENCMSIS_CORECM3_H - -/* the original core_cm3.h is nonfree by arm; this provides libopencm3 variant of the symbols efm32lib needs of CMSIS. */ -#include - -/* needed by system_efm32.h:196, guessing */ -#define __INLINE inline - -/* needed around efm32tg840f32.h:229. comparing the efm32lib definitions to the - * libopencm3 ones, "volatile" is all that's missing. */ -#define __IO volatile -#define __O volatile -#define __I volatile - -/* -> style access for what is defined in libopencm3/stm32/f1/scb.h / - * cm3/memorymap.h, as it's needed by efm32lib/inc/efm32_emu.h */ - -/* from stm32/f1/scb.h */ -#define SCB_SCR_SLEEPDEEP_Msk (1 << 2) -/* structure as in, for example, - * DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h, data from - * libopencm3/stm32/f1/scb.h. incomplete. */ -typedef struct -{ - __IO uint32_t CPUID; - __IO uint32_t ICSR; - __IO uint32_t VTOR; - __IO uint32_t AIRCR; - __IO uint32_t SCR; - __IO uint32_t CCR; - __IO uint8_t SHPR[12]; /* FIXME: how is this properly indexed? */ - __IO uint32_t SHCSR; -} SCB_TypeDef; -#define SCB ((SCB_TypeDef *) SCB_BASE) -/* from libopencm3/cm3/memorymap.h */ -#define PPBI_BASE 0xE0000000 -#define SCS_BASE (PPBI_BASE + 0xE000) -#define SCB_BASE (SCS_BASE + 0x0D00) - -/* needed by efm32_emu.h, guessing and taking the implementation used in - * lightswitch-interrupt.c */ -#define __WFI() __asm__("wfi") - -/* needed by efm32_cmu.h, probably it's just what gcc provides anyway */ -#define __CLZ(div) __builtin_clz(div) - -/* needed by efm32_aes.c. __builtin_bswap32 does the same thing as the rev instruction according to https://bugzilla.mozilla.org/show_bug.cgi?id=600106 */ -#define __REV(x) __builtin_bswap32(x) - -/* stubs for efm32_cmu.c */ -uint32_t SystemCoreClockGet(void); -uint32_t SystemHFClockGet(void); - -uint32_t SystemLFRCOClockGet(void); -uint32_t SystemLFXOClockGet(void); - -/* stubs for efm32_dbg.h */ -typedef struct -{ - uint32_t DHCSR; -} CoreDebug_TypeDef; -#define CoreDebug ((CoreDebug_TypeDef *) 0) -#define CoreDebug_DHCSR_C_DEBUGEN_Msk 0 - -/* stubs for efm32_dma */ - -#define NVIC_ClearPendingIRQ(irq) 1 -#define NVIC_EnableIRQ(irq) 1 -#define NVIC_DisableIRQ(irq) 1 - -/* stubs for efm32_int */ - -#define __enable_irq() 1 -#define __disable_irq() 1 - -/* stubs for efm32_mpu */ - -#define SCB_SHCSR_MEMFAULTENA_Msk 0 - -typedef struct -{ - uint32_t CTRL; - uint32_t RNR; - uint32_t RBAR; - uint32_t RASR; -} MPU_TypeDef; -#define MPU ((MPU_TypeDef *) 0) -#define MPU_CTRL_ENABLE_Msk 0 -#define MPU_RASR_XN_Pos 0 -#define MPU_RASR_AP_Pos 0 -#define MPU_RASR_TEX_Pos 0 -#define MPU_RASR_S_Pos 0 -#define MPU_RASR_C_Pos 0 -#define MPU_RASR_B_Pos 0 -#define MPU_RASR_SRD_Pos 0 -#define MPU_RASR_SIZE_Pos 0 -#define MPU_RASR_ENA_Pos 0 - -#endif diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/core_cm3.h b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/core_cm3.h deleted file mode 120000 index b7a19ea..0000000 --- a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/miniblink-efm32lib/core_cm3.h +++ /dev/null @@ -1 +0,0 @@ -../../efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h \ No newline at end of file diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.c b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.c deleted file mode 100644 index 8b412ad..0000000 --- a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "core_cm3.h" - -/* stubs for efm32_cmu.c */ -uint32_t SystemCoreClockGet(void) {return 1;} -uint32_t SystemHFClockGet(void) {return 1;} - -uint32_t SystemLFRCOClockGet(void) {return 1;} -uint32_t SystemLFXOClockGet(void) {return 1;} diff --git a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.h b/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.h deleted file mode 120000 index b7a19ea..0000000 --- a/examples/efm32/tinygecko/olimex-em32-32g880f128-h/test-efm32lib/core_cm3.h +++ /dev/null @@ -1 +0,0 @@ -../../efm32-tg-stk3300/miniblink-efm32lib/core_cm3.h \ No newline at end of file diff --git a/include/libopencmsis/core_cm3.h b/include/libopencmsis/core_cm3.h new file mode 100644 index 0000000..999fc48 --- /dev/null +++ b/include/libopencmsis/core_cm3.h @@ -0,0 +1,100 @@ +#ifndef OPENCMSIS_CORECM3_H +#define OPENCMSIS_CORECM3_H + +/* the original core_cm3.h is nonfree by arm; this provides libopencm3 variant of the symbols efm32lib needs of CMSIS. */ +#include + +/* needed by system_efm32.h:196, guessing */ +#define __INLINE inline + +/* needed around efm32tg840f32.h:229. comparing the efm32lib definitions to the + * libopencm3 ones, "volatile" is all that's missing. */ +#define __IO volatile +#define __O volatile +#define __I volatile + +/* -> style access for what is defined in libopencm3/stm32/f1/scb.h / + * cm3/memorymap.h, as it's needed by efm32lib/inc/efm32_emu.h */ + +/* from stm32/f1/scb.h */ +#define SCB_SCR_SLEEPDEEP_Msk (1 << 2) +/* structure as in, for example, + * DeviceSupport/EnergyMicro/EFM32/efm32tg840f32.h, data from + * libopencm3/stm32/f1/scb.h. incomplete. */ +typedef struct +{ + __IO uint32_t CPUID; + __IO uint32_t ICSR; + __IO uint32_t VTOR; + __IO uint32_t AIRCR; + __IO uint32_t SCR; + __IO uint32_t CCR; + __IO uint8_t SHPR[12]; /* FIXME: how is this properly indexed? */ + __IO uint32_t SHCSR; +} SCB_TypeDef; +#define SCB ((SCB_TypeDef *) SCB_BASE) +/* from libopencm3/cm3/memorymap.h */ +#define PPBI_BASE 0xE0000000 +#define SCS_BASE (PPBI_BASE + 0xE000) +#define SCB_BASE (SCS_BASE + 0x0D00) + +/* needed by efm32_emu.h, guessing and taking the implementation used in + * lightswitch-interrupt.c */ +#define __WFI() __asm__("wfi") + +/* needed by efm32_cmu.h, probably it's just what gcc provides anyway */ +#define __CLZ(div) __builtin_clz(div) + +/* needed by efm32_aes.c. __builtin_bswap32 does the same thing as the rev instruction according to https://bugzilla.mozilla.org/show_bug.cgi?id=600106 */ +#define __REV(x) __builtin_bswap32(x) + +/* stubs for efm32_cmu.c */ +#define SystemCoreClockGet() 1 +#define SystemHFClockGet() 1 + +uint32_t SystemLFRCOClockGet(void); +uint32_t SystemLFXOClockGet(void); + +/* stubs for efm32_dbg.h */ +typedef struct +{ + uint32_t DHCSR; +} CoreDebug_TypeDef; +#define CoreDebug ((CoreDebug_TypeDef *) 0) +#define CoreDebug_DHCSR_C_DEBUGEN_Msk 0 + +/* stubs for efm32_dma */ + +#define NVIC_ClearPendingIRQ(irq) 1 +#define NVIC_EnableIRQ(irq) 1 +#define NVIC_DisableIRQ(irq) 1 + +/* stubs for efm32_int */ + +#define __enable_irq() 1 +#define __disable_irq() 1 + +/* stubs for efm32_mpu */ + +#define SCB_SHCSR_MEMFAULTENA_Msk 0 + +typedef struct +{ + uint32_t CTRL; + uint32_t RNR; + uint32_t RBAR; + uint32_t RASR; +} MPU_TypeDef; +#define MPU ((MPU_TypeDef *) 0) +#define MPU_CTRL_ENABLE_Msk 0 +#define MPU_RASR_XN_Pos 0 +#define MPU_RASR_AP_Pos 0 +#define MPU_RASR_TEX_Pos 0 +#define MPU_RASR_S_Pos 0 +#define MPU_RASR_C_Pos 0 +#define MPU_RASR_B_Pos 0 +#define MPU_RASR_SRD_Pos 0 +#define MPU_RASR_SIZE_Pos 0 +#define MPU_RASR_ENA_Pos 0 + +#endif -- cgit v1.2.3