own firmware. interrupt handler
Posted: Sun Jan 04, 2015 8:40 pm
Hello. I write my own firmware for quadrocopter. And I have a problem with the implementation of the interrupt handlers. This is my code:
In this form, the code works. The red LED blinks. But if I uncomment line
In which I enable systick interrupt, both LEDs stop blinking. It seems like processor go to hardFault.
I specify using thoose memory area in my linker script:
Interrupt vector table defined in startup file in standart manner:
Used bootloader - is standart, given to crazyflie.
What is proper way of handle interrupts in case of using bootloader?
Code: Select all
#include <gpio.h>
#include <clk.h>
#include <led.h>
#include <crazyflie_board.h>
void SysTick_Handler(void)
{
led_toggle(LED_GREEN);
}
int main (void)
{
clk_HSE_enable();
// sysTick_init(50);
led_init(LED_GREEN);
led_on(LED_GREEN);
led_init(LED_RED);
led_on(LED_RED);
uint32_t cnt = 0;
while(1)
{
led_toggle(LED_RED);
for(cnt=0;cnt<1000000;cnt++);
}
return 1;
}
Code: Select all
// sysTick_init(50);
I specify using thoose memory area in my linker script:
Code: Select all
/* Specify the memory areas */
/* FLASH (rx) : ORIGIN = 0x08002800, LENGTH = 118K */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08002800, LENGTH = 118K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
}
Code: Select all
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word WWDG_IRQHandler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
What is proper way of handle interrupts in case of using bootloader?