Browse Source

Use RAM-based interrupt vector table

teensy4-core
PaulStoffregen 10 years ago
parent
commit
e8a02961b0
2 changed files with 10 additions and 4 deletions
  1. +8
    -3
      teensy3/mk20dx128.c
  2. +2
    -1
      teensy3/mk20dx128.h

+ 8
- 3
teensy3/mk20dx128.c View File

@@ -164,11 +164,15 @@ void portd_isr(void) __attribute__ ((weak, alias("unused_isr")));
void porte_isr(void) __attribute__ ((weak, alias("unused_isr")));
void software_isr(void) __attribute__ ((weak, alias("unused_isr")));

#if defined(__MK20DX128__)
__attribute__ ((section(".dmabuffers"), used, aligned(256)))
#else
__attribute__ ((section(".dmabuffers"), used, aligned(512)))
#endif
void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void);

// TODO: create AVR-stype ISR() macro, with default linkage to undefined handler
//
__attribute__ ((section(".vectors"), used))
void (* const gVectors[])(void) =
void (* const _VectorsFlash[NVIC_NUM_INTERRUPTS+16])(void) =
{
(void (*)(void))((unsigned long)&_estack), // 0 ARM: Initial Stack Pointer
ResetHandler, // 1 ARM: Initial Program Counter
@@ -404,6 +408,7 @@ void ResetHandler(void)
SCB_VTOR = 0; // use vector table in flash

// default all interrupts to medium priority level
for (i=0; i < NVIC_NUM_INTERRUPTS + 16; i++) _VectorsRam[i] = _VectorsFlash[i];
for (i=0; i < NVIC_NUM_INTERRUPTS; i++) NVIC_SET_PRIORITY(i, 128);

// hardware always starts in FEI mode

+ 2
- 1
teensy3/mk20dx128.h View File

@@ -2264,7 +2264,6 @@ typedef struct {




#define __disable_irq() __asm__ volatile("CPSID i");
#define __enable_irq() __asm__ volatile("CPSIE i");

@@ -2395,6 +2394,8 @@ extern void porte_isr(void);
extern void software_isr(void);


extern void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void);
extern void (* const _VectorsFlash[NVIC_NUM_INTERRUPTS+16])(void);

#ifdef __cplusplus
}

Loading…
Cancel
Save