diff options
author | Perry Hung <iperry@gmail.com> | 2011-02-27 15:49:51 -0500 |
---|---|---|
committer | Perry Hung <iperry@gmail.com> | 2011-02-27 15:56:40 -0500 |
commit | 214941537f2211d5e2ef16e34440485d7e872d1a (patch) | |
tree | af951df8867ab47bc474828d57a0bd22eed36ae0 /libmaple | |
parent | 43c5092d944ee1aa1424f2743c31bf33cb860c27 (diff) | |
download | librambutan-214941537f2211d5e2ef16e34440485d7e872d1a.tar.gz librambutan-214941537f2211d5e2ef16e34440485d7e872d1a.zip |
Refactor linker scripts. Rename irq and exception handlers.
Add common linker scripts for ram and rom. Add medium and high density
libraries for libcs3.
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/dma.c | 14 | ||||
-rw-r--r-- | libmaple/exc.S | 44 | ||||
-rw-r--r-- | libmaple/exti.c | 14 | ||||
-rw-r--r-- | libmaple/systick.c | 2 | ||||
-rw-r--r-- | libmaple/timers.c | 8 | ||||
-rw-r--r-- | libmaple/usart.c | 10 | ||||
-rw-r--r-- | libmaple/usb/usb.c | 2 | ||||
-rw-r--r-- | libmaple/usb/usb.h | 2 |
8 files changed, 61 insertions, 35 deletions
diff --git a/libmaple/dma.c b/libmaple/dma.c index 15c96e1..c71e52c 100644 --- a/libmaple/dma.c +++ b/libmaple/dma.c @@ -77,31 +77,31 @@ static inline void dispatch_handler(uint8 channel_idx) { } } -void DMAChannel1_IRQHandler(void) { +void __irq_dma1_channel1(void) { dispatch_handler(0); } -void DMAChannel2_IRQHandler(void) { +void __irq_dma1_channel2(void) { dispatch_handler(1); } -void DMAChannel3_IRQHandler(void) { +void __irq_dma2_channel3(void) { dispatch_handler(2); } -void DMAChannel4_IRQHandler(void) { +void __irq_dma2_channel4(void) { dispatch_handler(3); } -void DMAChannel5_IRQHandler(void) { +void __irq_dma2_channel5(void) { dispatch_handler(4); } -void DMAChannel6_IRQHandler(void) { +void __irq_dma2_channel6(void) { dispatch_handler(5); } -void DMAChannel7_IRQHandler(void) { +void __irq_dma2_channel7(void) { dispatch_handler(6); } diff --git a/libmaple/exc.S b/libmaple/exc.S index a9f6561..d01e3d5 100644 --- a/libmaple/exc.S +++ b/libmaple/exc.S @@ -41,16 +41,42 @@ # SP--> r0 .text -.globl HardFaultException +.globl __exc_hardfault +.globl __exc_nmi +.globl __exc_hardfault +.globl __exc_memmanage +.globl __exc_busfault +.globl __exc_usagefault + +/* TODO: Fix this up. */ +.thumb_func +__exc_nmi: + mov r0, #1 + +.thumb_func +__exc_hardfault: + mov r0, #2 + .thumb_func -HardFaultException: - ldr r0, CPSR_MASK @ Set default CPSR - push {r0} - ldr r0, TARGET_PC @ Set target pc - push {r0} - sub sp, sp, #24 @ its not like i even care - ldr r0, EXC_RETURN @ Return to thread mode - mov lr, r0 +__exc_memmanage: + mov r0, #3 + +.thumb_func +__exc_busfault: + mov r0, #4 + +.thumb_func +__exc_usagefault: + mov r0, #5 + +__default: + ldr r1, CPSR_MASK @ Set default CPSR + push {r1} + ldr r1, TARGET_PC @ Set target pc + push {r1} + sub sp, sp, #24 @ Don't care + ldr r1, EXC_RETURN @ Return to thread mode + mov lr, r1 bx lr @ Exception exit .align 4 diff --git a/libmaple/exti.c b/libmaple/exti.c index 150dd05..e8ad52a 100644 --- a/libmaple/exti.c +++ b/libmaple/exti.c @@ -74,32 +74,32 @@ static inline void dispatch_handler(uint32 channel) { * is associated with each channel, so we * don't have to keep track of which channel * we came from */ -void EXTI0_IRQHandler(void) { +void __irq_exti0(void) { dispatch_handler(EXTI0); clear_pending(EXTI0); } -void EXTI1_IRQHandler(void) { +void __irq_exti1(void) { dispatch_handler(EXTI1); clear_pending(EXTI1); } -void EXTI2_IRQHandler(void) { +void __irq_exti2(void) { dispatch_handler(EXTI2); clear_pending(EXTI2); } -void EXTI3_IRQHandler(void) { +void __irq_exti3(void) { dispatch_handler(EXTI3); clear_pending(EXTI3); } -void EXTI4_IRQHandler(void) { +void __irq_exti4(void) { dispatch_handler(EXTI4); clear_pending(EXTI4); } -void EXTI9_5_IRQHandler(void) { +void __irq_exti9_5(void) { /* Figure out which channel it came from */ uint32 pending; uint32 i; @@ -116,7 +116,7 @@ void EXTI9_5_IRQHandler(void) { } } -void EXTI15_10_IRQHandler(void) { +void __irq_exti15_10(void) { /* Figure out which channel it came from */ uint32 pending; uint32 i; diff --git a/libmaple/systick.c b/libmaple/systick.c index b056001..b9a52c1 100644 --- a/libmaple/systick.c +++ b/libmaple/systick.c @@ -64,6 +64,6 @@ void systick_resume() { } /** SysTick interrupt handler. Bumps up the tick counter. */ -void SysTickHandler(void) { +void __exc_systick(void) { systick_timer_millis++; } diff --git a/libmaple/timers.c b/libmaple/timers.c index ff548c0..c561d39 100644 --- a/libmaple/timers.c +++ b/libmaple/timers.c @@ -382,7 +382,7 @@ void timer_generate_update(timer_dev_num timer_num) { * registers /or/ has overflowed. * * This is a rather long implementation... */ -void TIM1_CC_IRQHandler(void) { +void __irq_tim1_cc(void) { timer_port *timer = (timer_port*)TIMER1_BASE; uint16 sr_buffer; sr_buffer = timer->SR; @@ -418,7 +418,7 @@ void TIM1_CC_IRQHandler(void) { //timer->EGR = 1; } } -void TIM2_IRQHandler(void) { +void __irq_tim2(void) { /* This is a rather long implementation... */ timer_port *timer = (timer_port*)TIMER2_BASE; uint16 sr_buffer; @@ -453,7 +453,7 @@ void TIM2_IRQHandler(void) { //timer->EGR = 1; } } -void TIM3_IRQHandler(void) { +void __irq_tim3(void) { /* This is a rather long implementation... */ timer_port *timer = (timer_port*)TIMER3_BASE; uint16 sr_buffer; @@ -489,7 +489,7 @@ void TIM3_IRQHandler(void) { } } -void TIM4_IRQHandler(void) { +void __irq_tim4(void) { /* This is a rather long implementation... */ timer_port*timer = (timer_port*)TIMER4_BASE; uint16 sr_buffer; diff --git a/libmaple/usart.c b/libmaple/usart.c index 030d3cc..494a29f 100644 --- a/libmaple/usart.c +++ b/libmaple/usart.c @@ -95,24 +95,24 @@ static inline void usart_irq(int usart_num) { /* TODO: Check the disassembly for the following functions to make sure GCC inlined properly. */ -void USART1_IRQHandler(void) { +void __irq_usart1(void) { usart_irq(USART1); } -void USART2_IRQHandler(void) { +void __irq_usart2(void) { usart_irq(USART2); } -void USART3_IRQHandler(void) { +void __irq_usart3(void) { usart_irq(USART3); } #ifdef STM32_HIGH_DENSITY -void UART4_IRQHandler(void) { +void __irq_uart4(void) { usart_irq(UART4); } -void UART5_IRQHandler(void) { +void __irq_uart5(void) { usart_irq(UART5); } #endif diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index d875785..62f56fc 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -241,7 +241,7 @@ void usbDsbISR(void) { } /* overloaded ISR routine, this is the main usb ISR */ -void usb_lpIRQHandler(void) { +void __irq_usb_lp_can_rx0(void) { wIstr = _GetISTR(); /* go nuts with the preproc switches since this is an ISTR and must be FAST */ diff --git a/libmaple/usb/usb.h b/libmaple/usb/usb.h index 0ed02e5..92f606c 100644 --- a/libmaple/usb/usb.h +++ b/libmaple/usb/usb.h @@ -69,7 +69,7 @@ void usbDsbISR(void); void usbEnbISR(void); /* overloaded ISR routine, this is the main usb ISR */ -void usb_lpIRQHandler(void); +void __irq_usb_lp_can_rx0(void); void usbWaitReset(void); /* blocking functions for send/receive */ |