1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Fixed weak-symbol issue with system interrupt handlers.

This commit is contained in:
Cristian Maglie
2012-11-19 23:37:19 +01:00
parent ddd35a2441
commit 65f00a69c7
6 changed files with 171 additions and 187 deletions

View File

@ -17,50 +17,109 @@
*/ */
#include "Arduino.h" #include "Arduino.h"
#include "Reset.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void NMI_Handler( void ) static void __halt() {
{ // Halts
for ( ;; ) ; while (1)
;
} }
void HardFault_Handler( void ) extern void svcHook(void);
extern void pendSVHook(void);
extern int sysTickHook(void);
/* Cortex-M3 core handlers */
void NMI_Handler (void) __attribute__ ((weak, alias("__halt")));
void HardFault_Handler (void) __attribute__ ((weak, alias("__halt")));
void MemManage_Handler (void) __attribute__ ((weak, alias("__halt")));
void BusFault_Handler (void) __attribute__ ((weak, alias("__halt")));
void UsageFault_Handler(void) __attribute__ ((weak, alias("__halt")));
void DebugMon_Handler (void) __attribute__ ((weak, alias("__halt")));
void SVC_Handler (void) { svcHook(); }
void PendSV_Handler (void) { pendSVHook(); }
void SysTick_Handler(void)
{ {
for ( ;; ) ; if (sysTickHook())
return;
tickReset();
// Increment tick count each ms
TimeTick_Increment();
} }
void MemManage_Handler( void ) /* Peripherals handlers */
{ void SUPC_Handler (void) __attribute__ ((weak, alias("__halt")));
for ( ;; ) ; void RSTC_Handler (void) __attribute__ ((weak, alias("__halt")));
} void RTC_Handler (void) __attribute__ ((weak, alias("__halt")));
void RTT_Handler (void) __attribute__ ((weak, alias("__halt")));
void BusFault_Handler( void ) void WDT_Handler (void) __attribute__ ((weak, alias("__halt")));
{ void PMC_Handler (void) __attribute__ ((weak, alias("__halt")));
for ( ;; ) ; void EFC0_Handler (void) __attribute__ ((weak, alias("__halt")));
} void EFC1_Handler (void) __attribute__ ((weak, alias("__halt")));
void UART_Handler (void) __attribute__ ((weak, alias("__halt")));
void UsageFault_Handler( void ) #ifdef _SAM3XA_SMC_INSTANCE_
{ void SMC_Handler (void) __attribute__ ((weak, alias("__halt")));
for ( ;; ) ; #endif
} #ifdef _SAM3XA_SDRAMC_INSTANCE_
void SDRAMC_Handler (void) __attribute__ ((weak, alias("__halt")));
void SVC_Handler( void ) #endif
{ void PIOA_Handler (void) __attribute__ ((weak, alias("__halt")));
for ( ;; ) ; void PIOB_Handler (void) __attribute__ ((weak, alias("__halt")));
} #ifdef _SAM3XA_PIOC_INSTANCE_
void PIOC_Handler (void) __attribute__ ((weak, alias("__halt")));
void DebugMon_Handler( void ) #endif
{ #ifdef _SAM3XA_PIOD_INSTANCE_
for ( ;; ) ; void PIOD_Handler (void) __attribute__ ((weak, alias("__halt")));
} #endif
#ifdef _SAM3XA_PIOE_INSTANCE_
void PendSV_Handler( void ) void PIOE_Handler (void) __attribute__ ((weak, alias("__halt")));
{ #endif
for ( ;; ) ; #ifdef _SAM3XA_PIOF_INSTANCE_
} void PIOF_Handler (void) __attribute__ ((weak, alias("__halt")));
#endif
void USART0_Handler (void) __attribute__ ((weak, alias("__halt")));
void USART1_Handler (void) __attribute__ ((weak, alias("__halt")));
void USART2_Handler (void) __attribute__ ((weak, alias("__halt")));
#ifdef _SAM3XA_USART3_INSTANCE_
void USART3_Handler (void) __attribute__ ((weak, alias("__halt")));
#endif
void HSMCI_Handler (void) __attribute__ ((weak, alias("__halt")));
void TWI0_Handler (void) __attribute__ ((weak, alias("__halt")));
void TWI1_Handler (void) __attribute__ ((weak, alias("__halt")));
void SPI0_Handler (void) __attribute__ ((weak, alias("__halt")));
#ifdef _SAM3XA_SPI1_INSTANCE_
void SPI1_Handler (void) __attribute__ ((weak, alias("__halt")));
#endif
void SSC_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC0_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC1_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC2_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC3_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC4_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC5_Handler (void) __attribute__ ((weak, alias("__halt")));
#ifdef _SAM3XA_TC2_INSTANCE_
void TC6_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC7_Handler (void) __attribute__ ((weak, alias("__halt")));
void TC8_Handler (void) __attribute__ ((weak, alias("__halt")));
#endif
void PWM_Handler (void) __attribute__ ((weak, alias("__halt")));
void ADC_Handler (void) __attribute__ ((weak, alias("__halt")));
void DACC_Handler (void) __attribute__ ((weak, alias("__halt")));
void DMAC_Handler (void) __attribute__ ((weak, alias("__halt")));
void UOTGHS_Handler (void) __attribute__ ((weak, alias("__halt")));
void TRNG_Handler (void) __attribute__ ((weak, alias("__halt")));
#ifdef _SAM3XA_EMAC_INSTANCE_
void EMAC_Handler (void) __attribute__ ((weak, alias("__halt")));
#endif
void CAN0_Handler (void) __attribute__ ((weak, alias("__halt")));
void CAN1_Handler (void) __attribute__ ((weak, alias("__halt")));
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -29,3 +29,30 @@ static void __empty() {
// Empty // Empty
} }
void yield(void) __attribute__ ((weak, alias("__empty"))); void yield(void) __attribute__ ((weak, alias("__empty")));
/**
* SysTick hook
*
* This function is called from SysTick handler, before the default
* handler provided by Arduino.
*/
static int __false() {
// Return false
return 0;
}
int sysTickHook(void) __attribute__ ((weak, alias("__false")));
/**
* SVC hook
* PendSV hook
*
* These functions are called from SVC handler, and PensSV handler.
* Default action is halting.
*/
static void __halt() {
// Halts
while (1)
;
}
void svcHook(void) __attribute__ ((weak, alias("__halt")));
void pendSVHook(void) __attribute__ ((weak, alias("__halt")));

View File

@ -17,7 +17,6 @@
*/ */
#include "Arduino.h" #include "Arduino.h"
#include "Reset.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -57,17 +56,6 @@ void delayMicroseconds( uint32_t us )
; ;
} }
/*
* Cortex-M3 Systick IT handler: MOVED TO MAIN DUE TO WEAK SYMBOL ISSUE NOT RESOLVED
*/
void SysTick_Handler( void )
{
tickReset();
// Increment tick count each ms
TimeTick_Increment() ;
}
#if defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */ #if defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
extern signed int putchar( signed int c ) ; extern signed int putchar( signed int c ) ;
/** /**

View File

@ -47,86 +47,7 @@ int main(void);
// Arduino: we must setup hardware before doing this // Arduino: we must setup hardware before doing this
// void __libc_init_array(void); // void __libc_init_array(void);
/* Default empty handler */ // Arduino: handlers weak symbols moved into main
void Dummy_Handler(void);
/* Cortex-M3 core handlers */
void NMI_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void HardFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void MemManage_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void BusFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void UsageFault_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void SVC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void DebugMon_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void PendSV_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void SysTick_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
/* Peripherals handlers */
void SUPC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void RSTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void RTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void RTT_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void WDT_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void PMC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void EFC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void EFC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void UART_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_SMC_INSTANCE_
void SMC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_SMC_INSTANCE_ */
#ifdef _SAM3XA_SDRAMC_INSTANCE_
void SDRAMC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_SDRAMC_INSTANCE_ */
void PIOA_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void PIOB_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_PIOC_INSTANCE_
void PIOC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_PIOC_INSTANCE_ */
#ifdef _SAM3XA_PIOD_INSTANCE_
void PIOD_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_PIOD_INSTANCE_ */
#ifdef _SAM3XA_PIOE_INSTANCE_
void PIOE_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_PIOE_INSTANCE_ */
#ifdef _SAM3XA_PIOF_INSTANCE_
void PIOF_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_PIOF_INSTANCE_ */
void USART0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void USART1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void USART2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_USART3_INSTANCE_
void USART3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_USART3_INSTANCE_ */
void HSMCI_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TWI0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TWI1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void SPI0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_SPI1_INSTANCE_
void SPI1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_SPI1_INSTANCE_ */
void SSC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC4_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC5_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_TC2_INSTANCE_
void TC6_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC7_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TC8_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_TC2_INSTANCE_ */
void PWM_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void ADC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void DACC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void DMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void UOTGHS_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TRNG_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#ifdef _SAM3XA_EMAC_INSTANCE_
void EMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
#endif /* _SAM3XA_EMAC_INSTANCE_ */
void CAN0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void CAN1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
/* Exception Table */ /* Exception Table */
__attribute__ ((section(".vectors"))) __attribute__ ((section(".vectors")))
@ -283,13 +204,3 @@ void Reset_Handler(void)
/* Infinite loop */ /* Infinite loop */
while (1); while (1);
} }
/**
* \brief Default interrupt handler for unused IRQs.
*/
void Dummy_Handler(void)
{
while (1) {
}
}

View File

@ -236,58 +236,57 @@ system_sam3xa.o:
00000000 T system_init_flash 00000000 T system_init_flash
startup_sam3xa.o: startup_sam3xa.o:
00000000 W ADC_Handler U ADC_Handler
00000000 W BusFault_Handler U BusFault_Handler
00000000 W CAN0_Handler U CAN0_Handler
00000000 W CAN1_Handler U CAN1_Handler
00000000 W DACC_Handler U DACC_Handler
00000000 W DMAC_Handler U DMAC_Handler
00000000 W DebugMon_Handler U DebugMon_Handler
00000000 T Dummy_Handler U EFC0_Handler
00000000 W EFC0_Handler U EFC1_Handler
00000000 W EFC1_Handler U EMAC_Handler
00000000 W EMAC_Handler U HSMCI_Handler
00000000 W HSMCI_Handler U HardFault_Handler
00000000 W HardFault_Handler U MemManage_Handler
00000000 W MemManage_Handler U NMI_Handler
00000000 W NMI_Handler U PIOA_Handler
00000000 W PIOA_Handler U PIOB_Handler
00000000 W PIOB_Handler U PIOC_Handler
00000000 W PIOC_Handler U PIOD_Handler
00000000 W PIOD_Handler U PMC_Handler
00000000 W PMC_Handler U PWM_Handler
00000000 W PWM_Handler U PendSV_Handler
00000000 W PendSV_Handler U RSTC_Handler
00000000 W RSTC_Handler U RTC_Handler
00000000 W RTC_Handler U RTT_Handler
00000000 W RTT_Handler
00000000 T Reset_Handler 00000000 T Reset_Handler
00000000 W SMC_Handler U SMC_Handler
00000000 W SPI0_Handler U SPI0_Handler
00000000 W SSC_Handler U SSC_Handler
00000000 W SUPC_Handler U SUPC_Handler
00000000 W SVC_Handler U SVC_Handler
00000000 W SysTick_Handler U SysTick_Handler
00000000 W TC0_Handler U TC0_Handler
00000000 W TC1_Handler U TC1_Handler
00000000 W TC2_Handler U TC2_Handler
00000000 W TC3_Handler U TC3_Handler
00000000 W TC4_Handler U TC4_Handler
00000000 W TC5_Handler U TC5_Handler
00000000 W TC6_Handler U TC6_Handler
00000000 W TC7_Handler U TC7_Handler
00000000 W TC8_Handler U TC8_Handler
00000000 W TRNG_Handler U TRNG_Handler
00000000 W TWI0_Handler U TWI0_Handler
00000000 W TWI1_Handler U TWI1_Handler
00000000 W UART_Handler U UART_Handler
00000000 W UOTGHS_Handler U UOTGHS_Handler
00000000 W USART0_Handler U USART0_Handler
00000000 W USART1_Handler U USART1_Handler
00000000 W USART2_Handler U USART2_Handler
00000000 W USART3_Handler U USART3_Handler
00000000 W UsageFault_Handler U UsageFault_Handler
00000000 W WDT_Handler U WDT_Handler
U _erelocate U _erelocate
U _estack U _estack
U _etext U _etext