first attempt at porting libopencm3 to energymicro

unless sources are explicitly given, the linker scripts and make files
were copied over from the stm32/f1 port.
This commit is contained in:
chrysn
2012-02-25 18:57:11 +01:00
parent 2b3f07ee08
commit 2180a02e2f
14 changed files with 559 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/* this implements d0034_efm32tg_reference_manual.pdf's 7.3.4 "Device Revision"
* section */
#ifndef LIBOPENCM3_EFM32_TINYGECKO_DEVICEREVISION_H
#define LIBOPENCM3_EFM32_TINYGECKO_DEVICEREVISION_H
#include <libopencm3/cm3/common.h>
#define DEVICEREVISION_PID2 MMIO32(0xE00FFFE8)
#define DEVICEREVISION_PID3 MMIO32(0xE00FFFEC)
/* devicerevision_revision_get has a comment that would make these definitions
* obsolete; i'm not sure how far it is reasonable to parameterize everythin
* g*/
#define DEVICEREVISION_REVISION_LENGTH 4
#define DEVICEREVISION_REVISION_SHIFT 4
#define DEVICEREVISION_REVISION_MASK (~(~0<<DEVICEREVISION_REVISION_LENGTH)<<DEVICEREVISION_REVISION_SHIFT) /* 0x000000f0, bits 7:4 */
#define DEVICEREVISION_REVISION_A 0x00
/* Read the device's hardcoded Revision. Return values can be compared against
* the DEVICEREVISION_REVISION_A constant, the only value given in the current
* specification. */
extern u8 devicerevision_revision_get(void);
#endif

View File

@@ -0,0 +1,11 @@
/* this implements d0002_efm32_cortex-m3_reference_manual.pdf's table 1.1's "number of interrupts" line. */
#ifndef LIBOPENCM3_EFM32_TINYGECKO_VECTOR_H
#define LIBOPENCM3_EFM32_TINYGECKO_VECTOR_H
#define EFM32_VECTOR_NIRQ 23
#include "../vector.h"
#endif

View File

@@ -0,0 +1,34 @@
/* this implements d0002_efm32_cortex-m3_reference_manual.pdf's figure 2.2.
*
* the structure of the vector table is implemented independently of the vector
* table, as it can be relocated to other memory locations too.
*
* don't include this file directly; rather, include the family's vector.h
* file, which defines the number of interrupts (EFM_VECTOR_NIRQ) from table
* 1.1 */
#ifndef LIBOPENCM3_EFM32_VECTOR_H
#define LIBOPENCM3_EFM32_VECTOR_H
#include <libopencm3/cm3/common.h>
typedef void (*efm32_vector_table_entry_t)(void);
typedef struct {
unsigned int *initial_sp_value;
efm32_vector_table_entry_t reset;
efm32_vector_table_entry_t nmi;
efm32_vector_table_entry_t hard_fault;
efm32_vector_table_entry_t memory_manage_fault;
efm32_vector_table_entry_t bus_fault;
efm32_vector_table_entry_t usage_fault;
efm32_vector_table_entry_t reserved_x001c[4];
efm32_vector_table_entry_t sv_call;
efm32_vector_table_entry_t reserved_debug;
efm32_vector_table_entry_t reserved_x0034;
efm32_vector_table_entry_t pend_sv;
efm32_vector_table_entry_t systick;
efm32_vector_table_entry_t irq[EFM32_VECTOR_NIRQ];
} efm32_vector_table_t;
#endif