1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #3083 from haukepetersen/fix_saml21_startup

cpu/saml21: fixed and cleaned up startup.c
This commit is contained in:
Kaspar Schleiser 2015-05-29 13:06:07 +02:00
commit f9b00c4257
2 changed files with 65 additions and 76 deletions

View File

@ -50,13 +50,23 @@ extern "C" {
#endif #endif
/** @} */ /** @} */
#ifdef __cplusplus
}
#endif
/** /**
* @brief CPUID_ID_LEN length of cpuid in bytes * @brief CPUID_ID_LEN length of cpuid in bytes
*/ */
#define CPUID_ID_LEN (16) /* 128 bits long, 16 bytes long */ #define CPUID_ID_LEN (16) /* 128 bits long, 16 bytes long */
/**
* @brief Definition of different panic modes
*/
typedef enum {
NMI_HANDLER, /**< non maskable interrupt */
HARD_FAULT, /**< hard fault */
DUMMY_HANDLER /**< dummy interrupt handler */
} panic_t;
#ifdef __cplusplus
}
#endif
#endif /* __CPU_CONF_H */ #endif /* __CPU_CONF_H */
/** @} */ /** @} */

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de> * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
* 2015 FreshTemp, LLC. * 2015 FreshTemp, LLC.
* 2014 Freie Universität Berlin * 2014-2015 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level * General Public License v2.1. See the file LICENSE in the top level
@ -17,12 +17,14 @@
* *
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> * @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
* @} * @}
*/ */
#include <stdint.h> #include <stdint.h>
#include "panic.h"
/** /**
* memory markers as defined in the linker script * memory markers as defined in the linker script
@ -37,7 +39,6 @@ extern uint32_t _ezero;
extern uint32_t _sstack; extern uint32_t _sstack;
extern uint32_t _estack; extern uint32_t _estack;
/** /**
* @brief functions for initializing the board, std-lib and kernel * @brief functions for initializing the board, std-lib and kernel
*/ */
@ -79,50 +80,28 @@ void reset_handler(void)
kernel_init(); kernel_init();
} }
void isr_nmi(void)
{
core_panic(NMI_HANDLER, "NMI HANDLER");
}
void isr_hard_fault(void)
{
core_panic(HARD_FAULT, "HARD FAULT");
}
/** /**
* @brief Default handler is called in case no interrupt handler was defined * @brief Default handler is called in case no interrupt handler was defined
*/ */
void dummy_handler(void) void dummy_handler(void)
{ {
while (1) {asm ("nop");} core_panic(DUMMY_HANDLER, "DUMMY HANDLER");
}
void isr_nmi(void)
{
while (1) {asm ("nop");}
}
void isr_mem_manage(void)
{
while (1) {asm ("nop");}
}
void isr_debug_mon(void)
{
while (1) {asm ("nop");}
}
void isr_hard_fault(void)
{
while (1) {asm ("nop");}
}
void isr_bus_fault(void)
{
while (1) {asm ("nop");}
}
void isr_usage_fault(void)
{
while (1) {asm ("nop");}
} }
/* Cortex-M specific interrupt vectors */ /* Cortex-M specific interrupt vectors */
void isr_svc(void) __attribute__ ((weak, alias("dummy_handler"))); void isr_svc(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_pendsv(void) __attribute__ ((weak, alias("dummy_handler"))); void isr_pendsv(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_systick(void) __attribute__ ((weak, alias("dummy_handler"))); void isr_systick(void) __attribute__ ((weak, alias("dummy_handler")));
/* SAML21 specific interrupt vector */ /* SAML21 specific interrupt vector */
void isr_pm(void) __attribute__ ((weak, alias("dummy_handler"))); void isr_pm(void) __attribute__ ((weak, alias("dummy_handler")));
void isr_wdt(void) __attribute__ ((weak, alias("dummy_handler"))); void isr_wdt(void) __attribute__ ((weak, alias("dummy_handler")));
@ -158,23 +137,23 @@ __attribute__ ((section(".vectors")))
const void *interrupt_vector[] = { const void *interrupt_vector[] = {
/* Stack pointer */ /* Stack pointer */
(void*) (&_estack), /* pointer to the top of the empty stack */ (void*) (&_estack), /* pointer to the top of the empty stack */
/* Cortex-M handlers */ /* Cortex-M0+ handlers */
(void*) reset_handler, /* entry point of the program */ (void*) reset_handler, /* entry point of the program */
(void*) isr_nmi, /* non maskable interrupt handler */ (void*) isr_nmi, /* non maskable interrupt handler */
(void*) isr_hard_fault, /* if you end up here its not good */ (void*) isr_hard_fault, /* if you end up here its not good */
(void*) isr_mem_manage, /* memory controller interrupt */ (void*) (0UL), /* Reserved */
(void*) isr_bus_fault, /* also not good to end up here */ (void*) (0UL), /* Reserved */
(void*) isr_usage_fault, /* autsch */ (void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */ (void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */ (void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */ (void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */ (void*) (0UL), /* Reserved */
(void*) isr_svc, /* system call interrupt */ (void*) isr_svc, /* system call interrupt */
(void*) isr_debug_mon, /* debug interrupt */ (void*) (0UL), /* Reserved */
(void*) (0UL), /* Reserved */ (void*) (0UL), /* Reserved */
(void*) isr_pendsv, /* pendSV interrupt, used for task switching in RIOT */ (void*) isr_pendsv, /* pendSV interrupt, used for task switching in RIOT */
(void*) isr_systick, /* SysTick interrupt, not used in RIOT */ (void*) isr_systick, /* SysTick interrupt, not used in RIOT */
/* Atmel specific peripheral handlers */ /* Atmel SAML21 specific peripheral handlers */
(void*) isr_pm, /* 0 Power Manager */ (void*) isr_pm, /* 0 Power Manager */
(void*) isr_wdt, /* 1 Watchdog Timer */ (void*) isr_wdt, /* 1 Watchdog Timer */
(void*) isr_rtc, /* 2 Real-Time Counter */ (void*) isr_rtc, /* 2 Real-Time Counter */