From 32e57dac2e61e79b029593eb4d34d727bcc10678 Mon Sep 17 00:00:00 2001 From: iperry Date: Thu, 17 Dec 2009 02:37:07 +0000 Subject: Initial commit of library code, moved from leaftest repo git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@69 749a229e-a60e-11de-b98f-4500b42dc123 --- .../src/exceptions/lanchon-stm32-isrs.S.epilog | 2 + .../src/exceptions/lanchon-stm32-isrs.S.prolog | 14 ++++ .../src/exceptions/lanchon-stm32-names.inc.epilog | 0 .../src/exceptions/lanchon-stm32-names.inc.prolog | 4 ++ .../src/exceptions/lanchon-stm32-vector.S.epilog | 2 + .../src/exceptions/lanchon-stm32-vector.S.prolog | 10 +++ .../lanchon-stm32/src/exceptions/make-clean.cmd | 10 +++ .../lanchon-stm32/src/exceptions/make-foreach.cmd | 38 +++++++++++ stm32conf/lanchon-stm32/src/exceptions/make.cmd | 76 ++++++++++++++++++++++ .../src/exceptions/stm32exceptions.c.epilog | 1 + .../src/exceptions/stm32exceptions.c.prolog | 20 ++++++ .../src/exceptions/stm32exceptions.h.epilog | 5 ++ .../src/exceptions/stm32exceptions.h.prolog | 24 +++++++ 13 files changed, 206 insertions(+) create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.epilog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.prolog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.epilog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.prolog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.epilog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.prolog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/make-clean.cmd create mode 100644 stm32conf/lanchon-stm32/src/exceptions/make-foreach.cmd create mode 100644 stm32conf/lanchon-stm32/src/exceptions/make.cmd create mode 100644 stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.epilog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.prolog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.epilog create mode 100644 stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.prolog (limited to 'stm32conf/lanchon-stm32/src/exceptions') diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.epilog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.epilog new file mode 100644 index 0000000..7102d59 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.epilog @@ -0,0 +1,2 @@ + +#endif /* L_lanchon_stm32_isr_interrupt */ diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.prolog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.prolog new file mode 100644 index 0000000..8e0629b --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-isrs.S.prolog @@ -0,0 +1,14 @@ +/* ISRs for STM32 (by Lanchon) */ + + .thumb + +#if defined (L_lanchon_stm32_isr_interrupt) + + .globl __STM32DefaultExceptionHandler + .type __STM32DefaultExceptionHandler, %function + +__STM32DefaultExceptionHandler: + b . + + .size __STM32DefaultExceptionHandler, . - __STM32DefaultExceptionHandler + diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.epilog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.epilog new file mode 100644 index 0000000..e69de29 diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.prolog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.prolog new file mode 100644 index 0000000..a233a3f --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-names.inc.prolog @@ -0,0 +1,4 @@ +/* ISR names for STM32 (by Lanchon) */ + +EXTERN (__cs3_stack) +EXTERN (__cs3_reset) diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.epilog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.epilog new file mode 100644 index 0000000..c8f3f4b --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.epilog @@ -0,0 +1,2 @@ + + .size __cs3_interrupt_vector_lanchon_stm32, . - __cs3_interrupt_vector_lanchon_stm32 diff --git a/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.prolog b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.prolog new file mode 100644 index 0000000..85fa6f5 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/lanchon-stm32-vector.S.prolog @@ -0,0 +1,10 @@ +/* Vector table for STM32 (by Lanchon) */ + + .section ".cs3.interrupt_vector" + + .globl __cs3_interrupt_vector_lanchon_stm32 + .type __cs3_interrupt_vector_lanchon_stm32, %object + +__cs3_interrupt_vector_lanchon_stm32: + .long __cs3_stack + .long __cs3_reset diff --git a/stm32conf/lanchon-stm32/src/exceptions/make-clean.cmd b/stm32conf/lanchon-stm32/src/exceptions/make-clean.cmd new file mode 100644 index 0000000..82e4746 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/make-clean.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal + +set DO=del + +%DO% lanchon-stm32-vector.S +%DO% lanchon-stm32-isrs.S +%DO% lanchon-stm32-names.inc +%DO% stm32exceptions.h +%DO% stm32exceptions.c diff --git a/stm32conf/lanchon-stm32/src/exceptions/make-foreach.cmd b/stm32conf/lanchon-stm32/src/exceptions/make-foreach.cmd new file mode 100644 index 0000000..4c3b00e --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/make-foreach.cmd @@ -0,0 +1,38 @@ +setlocal + +set ADR=0x%~1 +set TYPE=%~2 +set NAME=%~3 +set TEXT=%~4 +set HELP=%~5 + +set /a NUM=%ADR%/4 +if %TYPE%==x set NAME=__STM32ReservedException%NUM% +if %TYPE%==e set FULLTYPE=Exception +if %TYPE%==i set FULLTYPE=Interrupt +set FULLTEXT=%TEXT% %FULLTYPE% +if not "%HELP%"=="" set FULLHELP= (%HELP%) +set FULL=[%ADR%] %FULLTEXT%%FULLHELP% + +rem echo %NAME% + +echo .long %NAME%>>lanchon-stm32-vector.S + +echo .weak %NAME%>>lanchon-stm32-isrs.S +echo .globl %NAME%>>lanchon-stm32-isrs.S +echo .set %NAME%, __STM32DefaultExceptionHandler>>lanchon-stm32-isrs.S + +echo EXTERN (%NAME%)>>lanchon-stm32-names.inc + +if %TYPE%==x goto :eof + +echo /* %FULL% */>>stm32exceptions.h +echo void %NAME%(void);>>stm32exceptions.h +echo.>>stm32exceptions.h + +echo /* %FULL% */>>stm32exceptions.c +echo void %NAME%(void)>>stm32exceptions.c +echo {>>stm32exceptions.c +echo DEFAULT_EXCEPTION_HANDLER(%NAME%, "%TEXT%", %NUM%, %ADR%);>>stm32exceptions.c +echo }>>stm32exceptions.c +echo.>>stm32exceptions.c diff --git a/stm32conf/lanchon-stm32/src/exceptions/make.cmd b/stm32conf/lanchon-stm32/src/exceptions/make.cmd new file mode 100644 index 0000000..918ffeb --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/make.cmd @@ -0,0 +1,76 @@ +@echo off +setlocal + +type lanchon-stm32-vector.S.prolog>lanchon-stm32-vector.S +type lanchon-stm32-isrs.S.prolog>lanchon-stm32-isrs.S +type lanchon-stm32-names.inc.prolog>lanchon-stm32-names.inc +type stm32exceptions.h.prolog>stm32exceptions.h +type stm32exceptions.c.prolog>stm32exceptions.c + +set DO=call make-foreach + +rem %DO% 00 - __cs3_stack +rem %DO% 04 - __cs3_reset +%DO% 08 e NMIException "NMI" "from the RCC Clock Security System" +%DO% 0C e HardFaultException "Hard Fault" +%DO% 10 e MemManageException "Memory Management" +%DO% 14 e BusFaultException "Bus Fault" "prefetch and memory access faults" +%DO% 18 e UsageFaultException "Usage Fault" "undefined instruction or illegal state faults" +%DO% 1C x +%DO% 20 x +%DO% 24 x +%DO% 28 x +%DO% 2C e SVCHandler "SVCall" "system service call via SWI instruction" +%DO% 30 e DebugMonitor "Debug Monitor" +%DO% 34 x +%DO% 38 e PendSVC "PendSVC" "pendable request for system service" +%DO% 3C e SysTickHandler "SysTick" +%DO% 40 i WWDG_IRQHandler "WWDG" +%DO% 44 i PVD_IRQHandler "PVD" "EXTI Line 16" +%DO% 48 i TAMPER_IRQHandler "Tamper" +%DO% 4C i RTC_IRQHandler "RTC" +%DO% 50 i FLASH_IRQHandler "Flash" +%DO% 54 i RCC_IRQHandler "RCC" +%DO% 58 i EXTI0_IRQHandler "EXTI Line 0" +%DO% 5C i EXTI1_IRQHandler "EXTI Line 1" +%DO% 60 i EXTI2_IRQHandler "EXTI Line 2" +%DO% 64 i EXTI3_IRQHandler "EXTI Line 3" +%DO% 68 i EXTI4_IRQHandler "EXTI Line 4" +%DO% 6C i DMAChannel1_IRQHandler "DMA Channel 1" +%DO% 70 i DMAChannel2_IRQHandler "DMA Channel 2" +%DO% 74 i DMAChannel3_IRQHandler "DMA Channel 3" +%DO% 78 i DMAChannel4_IRQHandler "DMA Channel 4" +%DO% 7C i DMAChannel5_IRQHandler "DMA Channel 5" +%DO% 80 i DMAChannel6_IRQHandler "DMA Channel 6" +%DO% 84 i DMAChannel7_IRQHandler "DMA Channel 7" +%DO% 88 i ADC_IRQHandler "ADC" +%DO% 8C i USB_HP_CAN_TX_IRQHandler "USB High Priority/CAN TX" +%DO% 90 i USB_LP_CAN_RX0_IRQHandler "USB Low Priority/CAN RX0" +%DO% 94 i CAN_RX1_IRQHandler "CAN RX1" +%DO% 98 i CAN_SCE_IRQHandler "CAN SCE" +%DO% 9C i EXTI9_5_IRQHandler "EXTI Lines 5-9" +%DO% A0 i TIM1_BRK_IRQHandler "TIM1 Break" +%DO% A4 i TIM1_UP_IRQHandler "TIM1 Update" +%DO% A8 i TIM1_TRG_COM_IRQHandler "TIM1 Trigger/Commutation" +%DO% AC i TIM1_CC_IRQHandler "TIM1 Capture/Compare" +%DO% B0 i TIM2_IRQHandler "TIM2" +%DO% B4 i TIM3_IRQHandler "TIM3" +%DO% B8 i TIM4_IRQHandler "TIM4" +%DO% BC i I2C1_EV_IRQHandler "I2C1 Event" +%DO% C0 i I2C1_ER_IRQHandler "I2C1 Error" +%DO% C4 i I2C2_EV_IRQHandler "I2C2 Event" +%DO% C8 i I2C2_ER_IRQHandler "I2C2 Error" +%DO% CC i SPI1_IRQHandler "SPI1" +%DO% D0 i SPI2_IRQHandler "SPI2" +%DO% D4 i USART1_IRQHandler "USART1" +%DO% D8 i USART2_IRQHandler "USART2" +%DO% DC i USART3_IRQHandler "USART3" +%DO% E0 i EXTI15_10_IRQHandler "EXTI Lines 10-15" +%DO% E4 i RTCAlarm_IRQHandler "RTC Alarm" "EXTI Line 17" +%DO% E8 i USBWakeUp_IRQHandler "USB Wake Up" "EXTI Line 18" + +type lanchon-stm32-vector.S.epilog>>lanchon-stm32-vector.S +type lanchon-stm32-isrs.S.epilog>>lanchon-stm32-isrs.S +type lanchon-stm32-names.inc.epilog>>lanchon-stm32-names.inc +type stm32exceptions.h.epilog>>stm32exceptions.h +type stm32exceptions.c.epilog>>stm32exceptions.c diff --git a/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.epilog b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.epilog new file mode 100644 index 0000000..7e500a1 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.epilog @@ -0,0 +1 @@ +#endif /* COMBINED_DEFAULT_HANDLER */ diff --git a/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.prolog b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.prolog new file mode 100644 index 0000000..140f151 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.c.prolog @@ -0,0 +1,20 @@ +/* Exception handlers for STM32 (by Lanchon) + * + * This code is meant to handle exceptions that the application does not expect. + * Handlers that are part of the application should be defined elsewhere. */ + +#include "stm32exceptions.h" + +#ifndef CUSTOM_EXCEPTION_HANDLER + #ifdef DEBUG + /* Use individual infinite loops to ease debugging. */ + #define DEFAULT_EXCEPTION_HANDLER(handler, name, number, address) while (1); + #else + /* Avoid individual infinite loops when not debugging. */ + #define SHARED_EXCEPTION_HANDLER + #endif +#endif + +/* Undefined handlers will default to a shared infinite loop (see lanchon-stm32-isrs.S). */ +#ifndef SHARED_EXCEPTION_HANDLER + diff --git a/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.epilog b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.epilog new file mode 100644 index 0000000..6314553 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.epilog @@ -0,0 +1,5 @@ +#if __cplusplus +} +#endif + +#endif /* __STM32EXCEPTIONS_H */ diff --git a/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.prolog b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.prolog new file mode 100644 index 0000000..dbf6ce9 --- /dev/null +++ b/stm32conf/lanchon-stm32/src/exceptions/stm32exceptions.h.prolog @@ -0,0 +1,24 @@ +/* Exception handlers for STM32 (by Lanchon) */ + +#ifndef __STM32EXCEPTIONS_H +#define __STM32EXCEPTIONS_H + +#if __cplusplus +extern "C" +{ +#endif + +/* Use a shared infinite loop for unexpected exceptions. */ +/* #define SHARED_EXCEPTION_HANDLER */ + +/* Or use an external handler for unexpected exceptions. */ +/* #define CUSTOM_EXCEPTION_HANDLER */ + +/* Or else use individual infinite loops when debugging, + * or a shared infinite loop when not. */ + +#ifdef CUSTOM_EXCEPTION_HANDLER + void unexpected_exception(const char* name, int address); + #define DEFAULT_EXCEPTION_HANDLER(handler, name, number, address) unexpected_exception(name, address); +#endif + -- cgit v1.2.3