Merge branch 'generalizations'
this merges common c and header files of different architectures, adds a dispatch mechanism and yaml descriptions of interrupt handlers from which the whole interrupt table setup c code is generated.
This commit is contained in:
@@ -28,10 +28,10 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
|
||||
-ffunction-sections -fdata-sections -MD -DSTM32F1
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = vector.o rcc.o gpio.o usart.o adc.o spi.o flash.o nvic.o \
|
||||
rtc.o i2c.o dma.o systick.o exti.o scb.o ethernet.o \
|
||||
OBJS = rcc.o gpio.o usart.o adc.o spi.o flash.o \
|
||||
rtc.o i2c.o dma.o exti.o ethernet.o \
|
||||
usb_f103.o usb.o usb_control.o usb_standard.o can.o \
|
||||
timer.o usb_f107.o desig.o crc.o assert.o dac.o iwdg.o pwr.o
|
||||
timer.o usb_f107.o desig.o crc.o dac.o iwdg.o pwr.o
|
||||
|
||||
VPATH += ../../usb:../:../../cm3
|
||||
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define WEAK __attribute__ ((weak))
|
||||
|
||||
/* Symbols exported by the linker script(s): */
|
||||
extern unsigned _data_loadaddr, _data, _edata, _ebss, _stack;
|
||||
|
||||
void main(void);
|
||||
void reset_handler(void);
|
||||
void blocking_handler(void);
|
||||
void null_handler(void);
|
||||
|
||||
void WEAK nmi_handler(void);
|
||||
void WEAK hard_fault_handler(void);
|
||||
void WEAK mem_manage_handler(void);
|
||||
void WEAK bus_fault_handler(void);
|
||||
void WEAK usage_fault_handler(void);
|
||||
void WEAK sv_call_handler(void);
|
||||
void WEAK debug_monitor_handler(void);
|
||||
void WEAK pend_sv_handler(void);
|
||||
void WEAK sys_tick_handler(void);
|
||||
void WEAK wwdg_isr(void);
|
||||
void WEAK pvd_isr(void);
|
||||
void WEAK tamper_isr(void);
|
||||
void WEAK rtc_isr(void);
|
||||
void WEAK flash_isr(void);
|
||||
void WEAK rcc_isr(void);
|
||||
void WEAK exti0_isr(void);
|
||||
void WEAK exti1_isr(void);
|
||||
void WEAK exti2_isr(void);
|
||||
void WEAK exti3_isr(void);
|
||||
void WEAK exti4_isr(void);
|
||||
void WEAK dma1_channel1_isr(void);
|
||||
void WEAK dma1_channel2_isr(void);
|
||||
void WEAK dma1_channel3_isr(void);
|
||||
void WEAK dma1_channel4_isr(void);
|
||||
void WEAK dma1_channel5_isr(void);
|
||||
void WEAK dma1_channel6_isr(void);
|
||||
void WEAK dma1_channel7_isr(void);
|
||||
void WEAK adc1_2_isr(void);
|
||||
void WEAK usb_hp_can_tx_isr(void);
|
||||
void WEAK usb_lp_can_rx0_isr(void);
|
||||
void WEAK can_rx1_isr(void);
|
||||
void WEAK can_sce_isr(void);
|
||||
void WEAK exti9_5_isr(void);
|
||||
void WEAK tim1_brk_isr(void);
|
||||
void WEAK tim1_up_isr(void);
|
||||
void WEAK tim1_trg_com_isr(void);
|
||||
void WEAK tim1_cc_isr(void);
|
||||
void WEAK tim2_isr(void);
|
||||
void WEAK tim3_isr(void);
|
||||
void WEAK tim4_isr(void);
|
||||
void WEAK i2c1_ev_isr(void);
|
||||
void WEAK i2c1_er_isr(void);
|
||||
void WEAK i2c2_ev_isr(void);
|
||||
void WEAK i2c2_er_isr(void);
|
||||
void WEAK spi1_isr(void);
|
||||
void WEAK spi2_isr(void);
|
||||
void WEAK usart1_isr(void);
|
||||
void WEAK usart2_isr(void);
|
||||
void WEAK usart3_isr(void);
|
||||
void WEAK exti15_10_isr(void);
|
||||
void WEAK rtc_alarm_isr(void);
|
||||
void WEAK usb_wakeup_isr(void);
|
||||
void WEAK tim8_brk_isr(void);
|
||||
void WEAK tim8_up_isr(void);
|
||||
void WEAK tim8_trg_com_isr(void);
|
||||
void WEAK tim8_cc_isr(void);
|
||||
void WEAK adc3_isr(void);
|
||||
void WEAK fsmc_isr(void);
|
||||
void WEAK sdio_isr(void);
|
||||
void WEAK tim5_isr(void);
|
||||
void WEAK spi3_isr(void);
|
||||
void WEAK uart4_isr(void);
|
||||
void WEAK uart5_isr(void);
|
||||
void WEAK tim6_isr(void);
|
||||
void WEAK tim7_isr(void);
|
||||
void WEAK dma2_channel1_isr(void);
|
||||
void WEAK dma2_channel2_isr(void);
|
||||
void WEAK dma2_channel3_isr(void);
|
||||
void WEAK dma2_channel4_5_isr(void);
|
||||
void WEAK dma2_channel5_isr(void);
|
||||
void WEAK eth_isr(void);
|
||||
void WEAK eth_wkup_isr(void);
|
||||
void WEAK can2_tx_isr(void);
|
||||
void WEAK can2_rx0_isr(void);
|
||||
void WEAK can2_rx1_isr(void);
|
||||
void WEAK can2_sce_isr(void);
|
||||
void WEAK otg_fs_isr(void);
|
||||
|
||||
|
||||
__attribute__ ((section(".vectors")))
|
||||
void (*const vector_table[]) (void) = {
|
||||
(void*)&_stack, /* Addr: 0x0000_0000 */
|
||||
reset_handler, /* Addr: 0x0000_0004 */
|
||||
nmi_handler, /* Addr: 0x0000_0008 */
|
||||
hard_fault_handler, /* Addr: 0x0000_000C */
|
||||
mem_manage_handler, /* Addr: 0x0000_0010 */
|
||||
bus_fault_handler, /* Addr: 0x0000_0014 */
|
||||
usage_fault_handler, /* Addr: 0x0000_0018 */
|
||||
0, 0, 0, 0, /* Reserved Addr: 0x0000_001C - 0x0000_002B */
|
||||
sv_call_handler, /* Addr: 0x0000_002C */
|
||||
debug_monitor_handler, /* Addr: 0x0000_0030*/
|
||||
0, /* Reserved Addr: 0x0000_00034 */
|
||||
pend_sv_handler, /* Addr: 0x0000_0038 */
|
||||
sys_tick_handler, /* Addr: 0x0000_003C */
|
||||
wwdg_isr, /* Addr: 0x0000_0040 */
|
||||
pvd_isr, /* Addr: 0x0000_0044 */
|
||||
tamper_isr, /* Addr: 0x0000_0048 */
|
||||
rtc_isr, /* Addr: 0x0000_004C */
|
||||
flash_isr, /* Addr: 0x0000_0050 */
|
||||
rcc_isr, /* Addr: 0x0000_0054 */
|
||||
exti0_isr, /* Addr: 0x0000_0058 */
|
||||
exti1_isr, /* Addr: 0x0000_005C */
|
||||
exti2_isr, /* Addr: 0x0000_0060 */
|
||||
exti3_isr, /* Addr: 0x0000_0064 */
|
||||
exti4_isr, /* Addr: 0x0000_0068 */
|
||||
dma1_channel1_isr, /* Addr: 0x0000_006C */
|
||||
dma1_channel2_isr, /* Addr: 0x0000_0070 */
|
||||
dma1_channel3_isr, /* Addr: 0x0000_0074 */
|
||||
dma1_channel4_isr, /* Addr: 0x0000_0078 */
|
||||
dma1_channel5_isr, /* Addr: 0x0000_007C */
|
||||
dma1_channel6_isr, /* Addr: 0x0000_0080 */
|
||||
dma1_channel7_isr, /* Addr: 0x0000_0084 */
|
||||
adc1_2_isr, /* Addr: 0x0000_0088 */
|
||||
usb_hp_can_tx_isr, /* Addr: 0x0000_008C */
|
||||
usb_lp_can_rx0_isr, /* Addr: 0x0000_0090 */
|
||||
can_rx1_isr, /* Addr: 0x0000_0094 */
|
||||
can_sce_isr, /* Addr: 0x0000_0098 */
|
||||
exti9_5_isr, /* Addr: 0x0000_009C */
|
||||
tim1_brk_isr, /* Addr: 0x0000_00A0 */
|
||||
tim1_up_isr, /* Addr: 0x0000_00A4 */
|
||||
tim1_trg_com_isr, /* Addr: 0x0000_00A8 */
|
||||
tim1_cc_isr, /* Addr: 0x0000_00AC */
|
||||
tim2_isr, /* Addr: 0x0000_00B0 */
|
||||
tim3_isr, /* Addr: 0x0000_00B4 */
|
||||
tim4_isr, /* Addr: 0x0000_00B8 */
|
||||
i2c1_ev_isr, /* Addr: 0x0000_00BC */
|
||||
i2c1_er_isr, /* Addr: 0x0000_00C0 */
|
||||
i2c2_ev_isr, /* Addr: 0x0000_00C4 */
|
||||
i2c2_er_isr, /* Addr: 0x0000_00C8 */
|
||||
spi1_isr, /* Addr: 0x0000_00CC */
|
||||
spi2_isr, /* Addr: 0x0000_00D0 */
|
||||
usart1_isr, /* Addr: 0x0000_00D4 */
|
||||
usart2_isr, /* Addr: 0x0000_00D8 */
|
||||
usart3_isr, /* Addr: 0x0000_00DC */
|
||||
exti15_10_isr, /* Addr: 0x0000_00E0 */
|
||||
rtc_alarm_isr, /* Addr: 0x0000_00E4 */
|
||||
usb_wakeup_isr, /* Addr: 0x0000_00E8 */
|
||||
tim8_brk_isr, /* Addr: 0x0000_00EC */
|
||||
tim8_up_isr, /* Addr: 0x0000_00F0 */
|
||||
tim8_trg_com_isr, /* Addr: 0x0000_00F4 */
|
||||
tim8_cc_isr, /* Addr: 0x0000_00F8 */
|
||||
adc3_isr, /* Addr: 0x0000_00FC */
|
||||
fsmc_isr, /* Addr: 0x0000_0100 */
|
||||
sdio_isr, /* Addr: 0x0000_0104 */
|
||||
tim5_isr, /* Addr: 0x0000_0108 */
|
||||
spi3_isr, /* Addr: 0x0000_010C */
|
||||
uart4_isr, /* Addr: 0x0000_0110 */
|
||||
uart5_isr, /* Addr: 0x0000_0114 */
|
||||
tim6_isr, /* Addr: 0x0000_0118 */
|
||||
tim7_isr, /* Addr: 0x0000_011C */
|
||||
dma2_channel1_isr, /* Addr: 0x0000_0120 */
|
||||
dma2_channel2_isr, /* Addr: 0x0000_0124 */
|
||||
dma2_channel3_isr, /* Addr: 0x0000_0128 */
|
||||
dma2_channel4_5_isr, /* Addr: 0x0000_012C */
|
||||
dma2_channel5_isr, /* Addr: 0x0000_0130 */
|
||||
eth_isr, /* Addr: 0x0000_0134 */
|
||||
eth_wkup_isr, /* Addr: 0x0000_0138 */
|
||||
can2_tx_isr, /* Addr: 0x0000_013C */
|
||||
can2_rx0_isr, /* Addr: 0x0000_0140 */
|
||||
can2_rx1_isr, /* Addr: 0x0000_0144 */
|
||||
can2_sce_isr, /* Addr: 0x0000_0148 */
|
||||
otg_fs_isr, /* Addr: 0x0000_014C */
|
||||
};
|
||||
|
||||
void reset_handler(void)
|
||||
{
|
||||
volatile unsigned *src, *dest;
|
||||
|
||||
__asm__("MSR msp, %0" : : "r"(&_stack));
|
||||
|
||||
for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++)
|
||||
*dest = *src;
|
||||
|
||||
while (dest < &_ebss)
|
||||
*dest++ = 0;
|
||||
|
||||
/* Call the application's entry point. */
|
||||
main();
|
||||
}
|
||||
|
||||
void blocking_handler(void)
|
||||
{
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
void null_handler(void)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
#pragma weak nmi_handler = null_handler
|
||||
#pragma weak hard_fault_handler = blocking_handler
|
||||
#pragma weak mem_manage_handler = blocking_handler
|
||||
#pragma weak bus_fault_handler = blocking_handler
|
||||
#pragma weak usage_fault_handler = blocking_handler
|
||||
#pragma weak sv_call_handler = null_handler
|
||||
#pragma weak debug_monitor_handler = null_handler
|
||||
#pragma weak pend_sv_handler = null_handler
|
||||
#pragma weak sys_tick_handler = null_handler
|
||||
#pragma weak wwdg_isr = null_handler
|
||||
#pragma weak pvd_isr = null_handler
|
||||
#pragma weak tamper_isr = null_handler
|
||||
#pragma weak rtc_isr = null_handler
|
||||
#pragma weak flash_isr = null_handler
|
||||
#pragma weak rcc_isr = null_handler
|
||||
#pragma weak exti0_isr = null_handler
|
||||
#pragma weak exti1_isr = null_handler
|
||||
#pragma weak exti2_isr = null_handler
|
||||
#pragma weak exti3_isr = null_handler
|
||||
#pragma weak exti4_isr = null_handler
|
||||
#pragma weak dma1_channel1_isr = null_handler
|
||||
#pragma weak dma1_channel2_isr = null_handler
|
||||
#pragma weak dma1_channel3_isr = null_handler
|
||||
#pragma weak dma1_channel4_isr = null_handler
|
||||
#pragma weak dma1_channel5_isr = null_handler
|
||||
#pragma weak dma1_channel6_isr = null_handler
|
||||
#pragma weak dma1_channel7_isr = null_handler
|
||||
#pragma weak adc1_2_isr = null_handler
|
||||
#pragma weak usb_hp_can_tx_isr = null_handler
|
||||
#pragma weak usb_lp_can_rx0_isr = null_handler
|
||||
#pragma weak can_rx1_isr = null_handler
|
||||
#pragma weak can_sce_isr = null_handler
|
||||
#pragma weak exti9_5_isr = null_handler
|
||||
#pragma weak tim1_brk_isr = null_handler
|
||||
#pragma weak tim1_up_isr = null_handler
|
||||
#pragma weak tim1_trg_com_isr = null_handler
|
||||
#pragma weak tim1_cc_isr = null_handler
|
||||
#pragma weak tim2_isr = null_handler
|
||||
#pragma weak tim3_isr = null_handler
|
||||
#pragma weak tim4_isr = null_handler
|
||||
#pragma weak i2c1_ev_isr = null_handler
|
||||
#pragma weak i2c1_er_isr = null_handler
|
||||
#pragma weak i2c2_ev_isr = null_handler
|
||||
#pragma weak i2c2_er_isr = null_handler
|
||||
#pragma weak spi1_isr = null_handler
|
||||
#pragma weak spi2_isr = null_handler
|
||||
#pragma weak usart1_isr = null_handler
|
||||
#pragma weak usart2_isr = null_handler
|
||||
#pragma weak usart3_isr = null_handler
|
||||
#pragma weak exti15_10_isr = null_handler
|
||||
#pragma weak rtc_alarm_isr = null_handler
|
||||
#pragma weak usb_wakeup_isr = null_handler
|
||||
#pragma weak tim8_brk_isr = null_handler
|
||||
#pragma weak tim8_up_isr = null_handler
|
||||
#pragma weak tim8_trg_com_isr = null_handler
|
||||
#pragma weak tim8_cc_isr = null_handler
|
||||
#pragma weak adc3_isr = null_handler
|
||||
#pragma weak fsmc_isr = null_handler
|
||||
#pragma weak sdio_isr = null_handler
|
||||
#pragma weak tim5_isr = null_handler
|
||||
#pragma weak spi3_isr = null_handler
|
||||
#pragma weak uart4_isr = null_handler
|
||||
#pragma weak uart5_isr = null_handler
|
||||
#pragma weak tim6_isr = null_handler
|
||||
#pragma weak tim7_isr = null_handler
|
||||
#pragma weak dma2_channel1_isr = null_handler
|
||||
#pragma weak dma2_channel2_isr = null_handler
|
||||
#pragma weak dma2_channel3_isr = null_handler
|
||||
#pragma weak dma2_channel4_5_isr = null_handler
|
||||
#pragma weak dma2_channel5_isr
|
||||
#pragma weak eth_isr = null_handler
|
||||
#pragma weak eth_wkup_isr = null_handler
|
||||
#pragma weak can2_tx_isr = null_handler
|
||||
#pragma weak can2_rx0_isr = null_handler
|
||||
#pragma weak can2_rx1_isr = null_handler
|
||||
#pragma weak can2_sce_isr = null_handler
|
||||
#pragma weak otg_fs_isr = null_handler
|
||||
@@ -28,8 +28,8 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
|
||||
-ffunction-sections -fdata-sections -MD -DSTM32F2
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = vector.o rcc.o gpio.o usart.o spi.o flash.o nvic.o \
|
||||
i2c.o systick.o exti.o scb.o timer.o assert.o
|
||||
OBJS = rcc.o gpio.o usart.o spi.o flash.o \
|
||||
i2c.o exti.o timer.o
|
||||
|
||||
VPATH += ../../usb:../:../../cm3
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/f2/scb.h>
|
||||
|
||||
void scb_reset_core(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_VECTRESET;
|
||||
}
|
||||
|
||||
void scb_reset_system(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ;
|
||||
}
|
||||
|
||||
void scb_set_priority_grouping(u32 prigroup)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | prigroup;
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
||||
* Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define WEAK __attribute__ ((weak))
|
||||
|
||||
/* Symbols exported by the linker script(s): */
|
||||
extern unsigned _data_loadaddr, _data, _edata, _ebss, _stack;
|
||||
|
||||
void main(void);
|
||||
void reset_handler(void);
|
||||
void blocking_handler(void);
|
||||
void null_handler(void);
|
||||
|
||||
void WEAK reset_handler(void);
|
||||
void WEAK nmi_handler(void);
|
||||
void WEAK hard_fault_handler(void);
|
||||
void WEAK mem_manage_handler(void);
|
||||
void WEAK bus_fault_handler(void);
|
||||
void WEAK usage_fault_handler(void);
|
||||
void WEAK sv_call_handler(void);
|
||||
void WEAK debug_monitor_handler(void);
|
||||
void WEAK pend_sv_handler(void);
|
||||
void WEAK sys_tick_handler(void);
|
||||
void WEAK wwdg_isr(void);
|
||||
void WEAK pvd_isr(void);
|
||||
void WEAK tamp_stamp_isr(void);
|
||||
void WEAK rtc_wkup_isr(void);
|
||||
void WEAK flash_isr(void);
|
||||
void WEAK rcc_isr(void);
|
||||
void WEAK exti0_isr(void);
|
||||
void WEAK exti1_isr(void);
|
||||
void WEAK exti2_isr(void);
|
||||
void WEAK exti3_isr(void);
|
||||
void WEAK exti4_isr(void);
|
||||
void WEAK dma1_stream0_isr(void);
|
||||
void WEAK dma1_stream1_isr(void);
|
||||
void WEAK dma1_stream2_isr(void);
|
||||
void WEAK dma1_stream3_isr(void);
|
||||
void WEAK dma1_stream4_isr(void);
|
||||
void WEAK dma1_stream5_isr(void);
|
||||
void WEAK dma1_stream6_isr(void);
|
||||
void WEAK adc_isr(void);
|
||||
void WEAK can1_tx_isr(void);
|
||||
void WEAK can1_rx0_isr(void);
|
||||
void WEAK can1_rx1_isr(void);
|
||||
void WEAK can1_sce_isr(void);
|
||||
void WEAK exti9_5_isr(void);
|
||||
void WEAK tim1_brk_tim9_isr(void);
|
||||
void WEAK tim1_up_tim10_isr(void);
|
||||
void WEAK tim1_trg_com_tim11_isr(void);
|
||||
void WEAK tim1_cc_isr(void);
|
||||
void WEAK tim2_isr(void);
|
||||
void WEAK tim3_isr(void);
|
||||
void WEAK tim4_isr(void);
|
||||
void WEAK i2c1_ev_isr(void);
|
||||
void WEAK i2c1_er_isr(void);
|
||||
void WEAK i2c2_ev_isr(void);
|
||||
void WEAK i2c2_er_isr(void);
|
||||
void WEAK spi1_isr(void);
|
||||
void WEAK spi2_isr(void);
|
||||
void WEAK usart1_isr(void);
|
||||
void WEAK usart2_isr(void);
|
||||
void WEAK usart3_isr(void);
|
||||
void WEAK exti15_10_isr(void);
|
||||
void WEAK rtc_alarm_isr(void);
|
||||
void WEAK usb_fs_wkup_isr(void);
|
||||
void WEAK tim8_brk_tim12_isr(void);
|
||||
void WEAK tim8_up_tim13_isr(void);
|
||||
void WEAK tim8_trg_com_tim14_isr(void);
|
||||
void WEAK tim8_cc_isr(void);
|
||||
void WEAK dma1_stream7_isr(void);
|
||||
void WEAK fsmc_isr(void);
|
||||
void WEAK sdio_isr(void);
|
||||
void WEAK tim5_isr(void);
|
||||
void WEAK spi3_isr(void);
|
||||
void WEAK uart4_isr(void);
|
||||
void WEAK uart5_isr(void);
|
||||
void WEAK tim6_dac_isr(void);
|
||||
void WEAK tim7_isr(void);
|
||||
void WEAK dma2_stream0_isr(void);
|
||||
void WEAK dma2_stream1_isr(void);
|
||||
void WEAK dma2_stream2_isr(void);
|
||||
void WEAK dma2_stream3_isr(void);
|
||||
void WEAK dma2_stream4_isr(void);
|
||||
void WEAK eth_isr(void);
|
||||
void WEAK eth_wkup_isr(void);
|
||||
void WEAK can2_tx_isr(void);
|
||||
void WEAK can2_rx0_isr(void);
|
||||
void WEAK can2_rx1_isr(void);
|
||||
void WEAK can2_sce_isr(void);
|
||||
void WEAK otg_fs_isr(void);
|
||||
void WEAK dma2_stream5_isr(void);
|
||||
void WEAK dma2_stream6_isr(void);
|
||||
void WEAK dma2_stream7_isr(void);
|
||||
void WEAK usart6_isr(void);
|
||||
void WEAK i2c3_ev_isr(void);
|
||||
void WEAK i2c3_er_isr(void);
|
||||
void WEAK otg_hs_ep1_out_isr(void);
|
||||
void WEAK otg_hs_ep1_in_isr(void);
|
||||
void WEAK otg_hs_wkup_isr(void);
|
||||
void WEAK otg_hs_isr(void);
|
||||
void WEAK dcmi_isr(void);
|
||||
void WEAK cryp_isr(void);
|
||||
void WEAK hash_rng_isr(void);
|
||||
|
||||
__attribute__ ((section(".vectors")))
|
||||
void (*const vector_table[]) (void) = {
|
||||
(void *)&_stack,
|
||||
reset_handler,
|
||||
nmi_handler,
|
||||
hard_fault_handler,
|
||||
mem_manage_handler,
|
||||
bus_fault_handler,
|
||||
usage_fault_handler,
|
||||
0, 0, 0, 0, /* Reserved */
|
||||
sv_call_handler,
|
||||
debug_monitor_handler,
|
||||
0, /* Reserved */
|
||||
pend_sv_handler,
|
||||
sys_tick_handler,
|
||||
wwdg_isr,
|
||||
pvd_isr,
|
||||
tamp_stamp_isr,
|
||||
rtc_wkup_isr,
|
||||
flash_isr,
|
||||
rcc_isr,
|
||||
exti0_isr,
|
||||
exti1_isr,
|
||||
exti2_isr,
|
||||
exti3_isr,
|
||||
exti4_isr,
|
||||
dma1_stream0_isr,
|
||||
dma1_stream1_isr,
|
||||
dma1_stream2_isr,
|
||||
dma1_stream3_isr,
|
||||
dma1_stream4_isr,
|
||||
dma1_stream5_isr,
|
||||
dma1_stream6_isr,
|
||||
adc_isr,
|
||||
can1_tx_isr,
|
||||
can1_rx0_isr,
|
||||
can1_rx1_isr,
|
||||
can1_sce_isr,
|
||||
exti9_5_isr,
|
||||
tim1_brk_tim9_isr,
|
||||
tim1_up_tim10_isr,
|
||||
tim1_trg_com_tim11_isr,
|
||||
tim1_cc_isr,
|
||||
tim2_isr,
|
||||
tim3_isr,
|
||||
tim4_isr,
|
||||
i2c1_ev_isr,
|
||||
i2c1_er_isr,
|
||||
i2c2_ev_isr,
|
||||
i2c2_er_isr,
|
||||
spi1_isr,
|
||||
spi2_isr,
|
||||
usart1_isr,
|
||||
usart2_isr,
|
||||
usart3_isr,
|
||||
exti15_10_isr,
|
||||
rtc_alarm_isr,
|
||||
usb_fs_wkup_isr,
|
||||
tim8_brk_tim12_isr,
|
||||
tim8_up_tim13_isr,
|
||||
tim8_trg_com_tim14_isr,
|
||||
tim8_cc_isr,
|
||||
dma1_stream7_isr,
|
||||
fsmc_isr,
|
||||
sdio_isr,
|
||||
tim5_isr,
|
||||
spi3_isr,
|
||||
uart4_isr,
|
||||
uart5_isr,
|
||||
tim6_dac_isr,
|
||||
tim7_isr,
|
||||
dma2_stream0_isr,
|
||||
dma2_stream1_isr,
|
||||
dma2_stream2_isr,
|
||||
dma2_stream3_isr,
|
||||
dma2_stream4_isr,
|
||||
eth_isr,
|
||||
eth_wkup_isr,
|
||||
can2_tx_isr,
|
||||
can2_rx0_isr,
|
||||
can2_rx1_isr,
|
||||
can2_sce_isr,
|
||||
otg_fs_isr,
|
||||
dma2_stream5_isr,
|
||||
dma2_stream6_isr,
|
||||
dma2_stream7_isr,
|
||||
usart6_isr,
|
||||
i2c3_ev_isr,
|
||||
i2c3_er_isr,
|
||||
otg_hs_ep1_out_isr,
|
||||
otg_hs_ep1_in_isr,
|
||||
otg_hs_wkup_isr,
|
||||
otg_hs_isr,
|
||||
dcmi_isr,
|
||||
cryp_isr,
|
||||
hash_rng_isr,
|
||||
};
|
||||
|
||||
void reset_handler(void)
|
||||
{
|
||||
volatile unsigned *src, *dest;
|
||||
|
||||
__asm__("MSR msp, %0" : : "r"(&_stack));
|
||||
|
||||
for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++)
|
||||
*dest = *src;
|
||||
|
||||
while (dest < &_ebss)
|
||||
*dest++ = 0;
|
||||
|
||||
/* Call the application's entry point. */
|
||||
main();
|
||||
}
|
||||
|
||||
void blocking_handler(void)
|
||||
{
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
void null_handler(void)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
#pragma weak nmi_handler = null_handler
|
||||
#pragma weak hard_fault_handler = blocking_handler
|
||||
#pragma weak mem_manage_handler = blocking_handler
|
||||
#pragma weak bus_fault_handler = blocking_handler
|
||||
#pragma weak usage_fault_handler = blocking_handler
|
||||
#pragma weak sv_call_handler = null_handler
|
||||
#pragma weak debug_monitor_handler = null_handler
|
||||
#pragma weak pend_sv_handler = null_handler
|
||||
#pragma weak sys_tick_handler = null_handler
|
||||
#pragma weak wwdg_isr = null_handler
|
||||
#pragma weak pvd_isr = null_handler
|
||||
#pragma weak tamp_stamp_isr = null_handler
|
||||
#pragma weak rtc_wkup_isr = null_handler
|
||||
#pragma weak flash_isr = null_handler
|
||||
#pragma weak rcc_isr = null_handler
|
||||
#pragma weak exti0_isr = null_handler
|
||||
#pragma weak exti1_isr = null_handler
|
||||
#pragma weak exti2_isr = null_handler
|
||||
#pragma weak exti3_isr = null_handler
|
||||
#pragma weak exti4_isr = null_handler
|
||||
#pragma weak dma1_stream0_isr = null_handler
|
||||
#pragma weak dma1_stream1_isr = null_handler
|
||||
#pragma weak dma1_stream2_isr = null_handler
|
||||
#pragma weak dma1_stream3_isr = null_handler
|
||||
#pragma weak dma1_stream4_isr = null_handler
|
||||
#pragma weak dma1_stream5_isr = null_handler
|
||||
#pragma weak dma1_stream6_isr = null_handler
|
||||
#pragma weak adc_isr = null_handler
|
||||
#pragma weak can1_tx_isr = null_handler
|
||||
#pragma weak can1_rx0_isr = null_handler
|
||||
#pragma weak can1_rx1_isr = null_handler
|
||||
#pragma weak can1_sce_isr = null_handler
|
||||
#pragma weak exti9_5_isr = null_handler
|
||||
#pragma weak tim1_brk_tim9_isr = null_handler
|
||||
#pragma weak tim1_up_tim10_isr = null_handler
|
||||
#pragma weak tim1_trg_com_tim11_isr = null_handler
|
||||
#pragma weak tim1_cc_isr = null_handler
|
||||
#pragma weak tim2_isr = null_handler
|
||||
#pragma weak tim3_isr = null_handler
|
||||
#pragma weak tim4_isr = null_handler
|
||||
#pragma weak i2c1_ev_isr = null_handler
|
||||
#pragma weak i2c1_er_isr = null_handler
|
||||
#pragma weak i2c2_ev_isr = null_handler
|
||||
#pragma weak i2c2_er_isr = null_handler
|
||||
#pragma weak spi1_isr = null_handler
|
||||
#pragma weak spi2_isr = null_handler
|
||||
#pragma weak usart1_isr = null_handler
|
||||
#pragma weak usart2_isr = null_handler
|
||||
#pragma weak usart3_isr = null_handler
|
||||
#pragma weak exti15_10_isr = null_handler
|
||||
#pragma weak rtc_alarm_isr = null_handler
|
||||
#pragma weak usb_fs_wkup_isr = null_handler
|
||||
#pragma weak tim8_brk_tim12_isr = null_handler
|
||||
#pragma weak tim8_up_tim13_isr = null_handler
|
||||
#pragma weak tim8_trg_com_tim14_isr = null_handler
|
||||
#pragma weak tim8_cc_isr = null_handler
|
||||
#pragma weak dma1_stream7_isr = null_handler
|
||||
#pragma weak fsmc_isr = null_handler
|
||||
#pragma weak sdio_isr = null_handler
|
||||
#pragma weak tim5_isr = null_handler
|
||||
#pragma weak spi3_isr = null_handler
|
||||
#pragma weak uart4_isr = null_handler
|
||||
#pragma weak uart5_isr = null_handler
|
||||
#pragma weak tim6_dac_isr = null_handler
|
||||
#pragma weak tim7_isr = null_handler
|
||||
#pragma weak dma2_stream0_isr = null_handler
|
||||
#pragma weak dma2_stream1_isr = null_handler
|
||||
#pragma weak dma2_stream2_isr = null_handler
|
||||
#pragma weak dma2_stream3_isr = null_handler
|
||||
#pragma weak dma2_stream4_isr = null_handler
|
||||
#pragma weak eth_isr = null_handler
|
||||
#pragma weak eth_wkup_isr = null_handler
|
||||
#pragma weak can2_tx_isr = null_handler
|
||||
#pragma weak can2_rx0_isr = null_handler
|
||||
#pragma weak can2_rx1_isr = null_handler
|
||||
#pragma weak can2_sce_isr = null_handler
|
||||
#pragma weak otg_fs_isr = null_handler
|
||||
#pragma weak dma2_stream5_isr = null_handler
|
||||
#pragma weak dma2_stream6_isr = null_handler
|
||||
#pragma weak dma2_stream7_isr = null_handler
|
||||
#pragma weak usart6_isr = null_handler
|
||||
#pragma weak i2c3_ev_isr = null_handler
|
||||
#pragma weak i2c3_er_isr = null_handler
|
||||
#pragma weak otg_hs_ep1_out_isr = null_handler
|
||||
#pragma weak otg_hs_ep1_in_isr = null_handler
|
||||
#pragma weak otg_hs_wkup_isr = null_handler
|
||||
#pragma weak otg_hs_isr = null_handler
|
||||
#pragma weak dcmi_isr = null_handler
|
||||
#pragma weak cryp_isr = null_handler
|
||||
#pragma weak hash_rng_isr = null_handler
|
||||
@@ -29,10 +29,9 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
|
||||
-ffunction-sections -fdata-sections -MD -DSTM32F4
|
||||
# ARFLAGS = rcsv
|
||||
ARFLAGS = rcs
|
||||
OBJS = vector.o rcc.o gpio.o usart.o spi.o flash.o nvic.o \
|
||||
i2c.o systick.o exti.o scb.o pwr.o timer.o \
|
||||
usb.o usb_standard.o usb_control.o usb_f107.o \
|
||||
assert.o
|
||||
OBJS = rcc.o gpio.o usart.o spi.o flash.o \
|
||||
i2c.o exti.o pwr.o timer.o \
|
||||
usb.o usb_standard.o usb_control.o usb_f107.o
|
||||
|
||||
VPATH += ../../usb:../:../../cm3
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/f4/scb.h>
|
||||
|
||||
void scb_reset_core(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_VECTRESET;
|
||||
}
|
||||
|
||||
void scb_reset_system(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ;
|
||||
}
|
||||
|
||||
void scb_set_priority_grouping(u32 prigroup)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | prigroup;
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
||||
* Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/f4/scb.h>
|
||||
|
||||
#define WEAK __attribute__ ((weak))
|
||||
|
||||
/* Symbols exported by the linker script(s): */
|
||||
extern unsigned _data_loadaddr, _data, _edata, _ebss, _stack;
|
||||
|
||||
void main(void);
|
||||
void reset_handler(void);
|
||||
void blocking_handler(void);
|
||||
void null_handler(void);
|
||||
|
||||
void WEAK reset_handler(void);
|
||||
void WEAK nmi_handler(void);
|
||||
void WEAK hard_fault_handler(void);
|
||||
void WEAK mem_manage_handler(void);
|
||||
void WEAK bus_fault_handler(void);
|
||||
void WEAK usage_fault_handler(void);
|
||||
void WEAK sv_call_handler(void);
|
||||
void WEAK debug_monitor_handler(void);
|
||||
void WEAK pend_sv_handler(void);
|
||||
void WEAK sys_tick_handler(void);
|
||||
void WEAK wwdg_isr(void);
|
||||
void WEAK pvd_isr(void);
|
||||
void WEAK tamp_stamp_isr(void);
|
||||
void WEAK rtc_wkup_isr(void);
|
||||
void WEAK flash_isr(void);
|
||||
void WEAK rcc_isr(void);
|
||||
void WEAK exti0_isr(void);
|
||||
void WEAK exti1_isr(void);
|
||||
void WEAK exti2_isr(void);
|
||||
void WEAK exti3_isr(void);
|
||||
void WEAK exti4_isr(void);
|
||||
void WEAK dma1_stream0_isr(void);
|
||||
void WEAK dma1_stream1_isr(void);
|
||||
void WEAK dma1_stream2_isr(void);
|
||||
void WEAK dma1_stream3_isr(void);
|
||||
void WEAK dma1_stream4_isr(void);
|
||||
void WEAK dma1_stream5_isr(void);
|
||||
void WEAK dma1_stream6_isr(void);
|
||||
void WEAK adc_isr(void);
|
||||
void WEAK can1_tx_isr(void);
|
||||
void WEAK can1_rx0_isr(void);
|
||||
void WEAK can1_rx1_isr(void);
|
||||
void WEAK can1_sce_isr(void);
|
||||
void WEAK exti9_5_isr(void);
|
||||
void WEAK tim1_brk_tim9_isr(void);
|
||||
void WEAK tim1_up_tim10_isr(void);
|
||||
void WEAK tim1_trg_com_tim11_isr(void);
|
||||
void WEAK tim1_cc_isr(void);
|
||||
void WEAK tim2_isr(void);
|
||||
void WEAK tim3_isr(void);
|
||||
void WEAK tim4_isr(void);
|
||||
void WEAK i2c1_ev_isr(void);
|
||||
void WEAK i2c1_er_isr(void);
|
||||
void WEAK i2c2_ev_isr(void);
|
||||
void WEAK i2c2_er_isr(void);
|
||||
void WEAK spi1_isr(void);
|
||||
void WEAK spi2_isr(void);
|
||||
void WEAK usart1_isr(void);
|
||||
void WEAK usart2_isr(void);
|
||||
void WEAK usart3_isr(void);
|
||||
void WEAK exti15_10_isr(void);
|
||||
void WEAK rtc_alarm_isr(void);
|
||||
void WEAK usb_fs_wkup_isr(void);
|
||||
void WEAK tim8_brk_tim12_isr(void);
|
||||
void WEAK tim8_up_tim13_isr(void);
|
||||
void WEAK tim8_trg_com_tim14_isr(void);
|
||||
void WEAK tim8_cc_isr(void);
|
||||
void WEAK dma1_stream7_isr(void);
|
||||
void WEAK fsmc_isr(void);
|
||||
void WEAK sdio_isr(void);
|
||||
void WEAK tim5_isr(void);
|
||||
void WEAK spi3_isr(void);
|
||||
void WEAK uart4_isr(void);
|
||||
void WEAK uart5_isr(void);
|
||||
void WEAK tim6_dac_isr(void);
|
||||
void WEAK tim7_isr(void);
|
||||
void WEAK dma2_stream0_isr(void);
|
||||
void WEAK dma2_stream1_isr(void);
|
||||
void WEAK dma2_stream2_isr(void);
|
||||
void WEAK dma2_stream3_isr(void);
|
||||
void WEAK dma2_stream4_isr(void);
|
||||
void WEAK eth_isr(void);
|
||||
void WEAK eth_wkup_isr(void);
|
||||
void WEAK can2_tx_isr(void);
|
||||
void WEAK can2_rx0_isr(void);
|
||||
void WEAK can2_rx1_isr(void);
|
||||
void WEAK can2_sce_isr(void);
|
||||
void WEAK otg_fs_isr(void);
|
||||
void WEAK dma2_stream5_isr(void);
|
||||
void WEAK dma2_stream6_isr(void);
|
||||
void WEAK dma2_stream7_isr(void);
|
||||
void WEAK usart6_isr(void);
|
||||
void WEAK i2c3_ev_isr(void);
|
||||
void WEAK i2c3_er_isr(void);
|
||||
void WEAK otg_hs_ep1_out_isr(void);
|
||||
void WEAK otg_hs_ep1_in_isr(void);
|
||||
void WEAK otg_hs_wkup_isr(void);
|
||||
void WEAK otg_hs_isr(void);
|
||||
void WEAK dcmi_isr(void);
|
||||
void WEAK cryp_isr(void);
|
||||
void WEAK hash_rng_isr(void);
|
||||
|
||||
__attribute__ ((section(".vectors")))
|
||||
void (*const vector_table[]) (void) = {
|
||||
(void *)&_stack,
|
||||
reset_handler,
|
||||
nmi_handler,
|
||||
hard_fault_handler,
|
||||
mem_manage_handler,
|
||||
bus_fault_handler,
|
||||
usage_fault_handler,
|
||||
0, 0, 0, 0, /* Reserved */
|
||||
sv_call_handler,
|
||||
debug_monitor_handler,
|
||||
0, /* Reserved */
|
||||
pend_sv_handler,
|
||||
sys_tick_handler,
|
||||
wwdg_isr,
|
||||
pvd_isr,
|
||||
tamp_stamp_isr,
|
||||
rtc_wkup_isr,
|
||||
flash_isr,
|
||||
rcc_isr,
|
||||
exti0_isr,
|
||||
exti1_isr,
|
||||
exti2_isr,
|
||||
exti3_isr,
|
||||
exti4_isr,
|
||||
dma1_stream0_isr,
|
||||
dma1_stream1_isr,
|
||||
dma1_stream2_isr,
|
||||
dma1_stream3_isr,
|
||||
dma1_stream4_isr,
|
||||
dma1_stream5_isr,
|
||||
dma1_stream6_isr,
|
||||
adc_isr,
|
||||
can1_tx_isr,
|
||||
can1_rx0_isr,
|
||||
can1_rx1_isr,
|
||||
can1_sce_isr,
|
||||
exti9_5_isr,
|
||||
tim1_brk_tim9_isr,
|
||||
tim1_up_tim10_isr,
|
||||
tim1_trg_com_tim11_isr,
|
||||
tim1_cc_isr,
|
||||
tim2_isr,
|
||||
tim3_isr,
|
||||
tim4_isr,
|
||||
i2c1_ev_isr,
|
||||
i2c1_er_isr,
|
||||
i2c2_ev_isr,
|
||||
i2c2_er_isr,
|
||||
spi1_isr,
|
||||
spi2_isr,
|
||||
usart1_isr,
|
||||
usart2_isr,
|
||||
usart3_isr,
|
||||
exti15_10_isr,
|
||||
rtc_alarm_isr,
|
||||
usb_fs_wkup_isr,
|
||||
tim8_brk_tim12_isr,
|
||||
tim8_up_tim13_isr,
|
||||
tim8_trg_com_tim14_isr,
|
||||
tim8_cc_isr,
|
||||
dma1_stream7_isr,
|
||||
fsmc_isr,
|
||||
sdio_isr,
|
||||
tim5_isr,
|
||||
spi3_isr,
|
||||
uart4_isr,
|
||||
uart5_isr,
|
||||
tim6_dac_isr,
|
||||
tim7_isr,
|
||||
dma2_stream0_isr,
|
||||
dma2_stream1_isr,
|
||||
dma2_stream2_isr,
|
||||
dma2_stream3_isr,
|
||||
dma2_stream4_isr,
|
||||
eth_isr,
|
||||
eth_wkup_isr,
|
||||
can2_tx_isr,
|
||||
can2_rx0_isr,
|
||||
can2_rx1_isr,
|
||||
can2_sce_isr,
|
||||
otg_fs_isr,
|
||||
dma2_stream5_isr,
|
||||
dma2_stream6_isr,
|
||||
dma2_stream7_isr,
|
||||
usart6_isr,
|
||||
i2c3_ev_isr,
|
||||
i2c3_er_isr,
|
||||
otg_hs_ep1_out_isr,
|
||||
otg_hs_ep1_in_isr,
|
||||
otg_hs_wkup_isr,
|
||||
otg_hs_isr,
|
||||
dcmi_isr,
|
||||
cryp_isr,
|
||||
hash_rng_isr,
|
||||
};
|
||||
|
||||
void reset_handler(void)
|
||||
{
|
||||
volatile unsigned *src, *dest;
|
||||
|
||||
__asm__("MSR msp, %0" : : "r"(&_stack));
|
||||
|
||||
/* Enable access to Floating-Point coprocessor. */
|
||||
SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11);
|
||||
|
||||
for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++)
|
||||
*dest = *src;
|
||||
|
||||
while (dest < &_ebss)
|
||||
*dest++ = 0;
|
||||
|
||||
/* Call the application's entry point. */
|
||||
main();
|
||||
}
|
||||
|
||||
void blocking_handler(void)
|
||||
{
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
void null_handler(void)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
|
||||
#pragma weak nmi_handler = null_handler
|
||||
#pragma weak hard_fault_handler = blocking_handler
|
||||
#pragma weak mem_manage_handler = blocking_handler
|
||||
#pragma weak bus_fault_handler = blocking_handler
|
||||
#pragma weak usage_fault_handler = blocking_handler
|
||||
#pragma weak sv_call_handler = null_handler
|
||||
#pragma weak debug_monitor_handler = null_handler
|
||||
#pragma weak pend_sv_handler = null_handler
|
||||
#pragma weak sys_tick_handler = null_handler
|
||||
#pragma weak wwdg_isr = null_handler
|
||||
#pragma weak pvd_isr = null_handler
|
||||
#pragma weak tamp_stamp_isr = null_handler
|
||||
#pragma weak rtc_wkup_isr = null_handler
|
||||
#pragma weak flash_isr = null_handler
|
||||
#pragma weak rcc_isr = null_handler
|
||||
#pragma weak exti0_isr = null_handler
|
||||
#pragma weak exti1_isr = null_handler
|
||||
#pragma weak exti2_isr = null_handler
|
||||
#pragma weak exti3_isr = null_handler
|
||||
#pragma weak exti4_isr = null_handler
|
||||
#pragma weak dma1_stream0_isr = null_handler
|
||||
#pragma weak dma1_stream1_isr = null_handler
|
||||
#pragma weak dma1_stream2_isr = null_handler
|
||||
#pragma weak dma1_stream3_isr = null_handler
|
||||
#pragma weak dma1_stream4_isr = null_handler
|
||||
#pragma weak dma1_stream5_isr = null_handler
|
||||
#pragma weak dma1_stream6_isr = null_handler
|
||||
#pragma weak adc_isr = null_handler
|
||||
#pragma weak can1_tx_isr = null_handler
|
||||
#pragma weak can1_rx0_isr = null_handler
|
||||
#pragma weak can1_rx1_isr = null_handler
|
||||
#pragma weak can1_sce_isr = null_handler
|
||||
#pragma weak exti9_5_isr = null_handler
|
||||
#pragma weak tim1_brk_tim9_isr = null_handler
|
||||
#pragma weak tim1_up_tim10_isr = null_handler
|
||||
#pragma weak tim1_trg_com_tim11_isr = null_handler
|
||||
#pragma weak tim1_cc_isr = null_handler
|
||||
#pragma weak tim2_isr = null_handler
|
||||
#pragma weak tim3_isr = null_handler
|
||||
#pragma weak tim4_isr = null_handler
|
||||
#pragma weak i2c1_ev_isr = null_handler
|
||||
#pragma weak i2c1_er_isr = null_handler
|
||||
#pragma weak i2c2_ev_isr = null_handler
|
||||
#pragma weak i2c2_er_isr = null_handler
|
||||
#pragma weak spi1_isr = null_handler
|
||||
#pragma weak spi2_isr = null_handler
|
||||
#pragma weak usart1_isr = null_handler
|
||||
#pragma weak usart2_isr = null_handler
|
||||
#pragma weak usart3_isr = null_handler
|
||||
#pragma weak exti15_10_isr = null_handler
|
||||
#pragma weak rtc_alarm_isr = null_handler
|
||||
#pragma weak usb_fs_wkup_isr = null_handler
|
||||
#pragma weak tim8_brk_tim12_isr = null_handler
|
||||
#pragma weak tim8_up_tim13_isr = null_handler
|
||||
#pragma weak tim8_trg_com_tim14_isr = null_handler
|
||||
#pragma weak tim8_cc_isr = null_handler
|
||||
#pragma weak dma1_stream7_isr = null_handler
|
||||
#pragma weak fsmc_isr = null_handler
|
||||
#pragma weak sdio_isr = null_handler
|
||||
#pragma weak tim5_isr = null_handler
|
||||
#pragma weak spi3_isr = null_handler
|
||||
#pragma weak uart4_isr = null_handler
|
||||
#pragma weak uart5_isr = null_handler
|
||||
#pragma weak tim6_dac_isr = null_handler
|
||||
#pragma weak tim7_isr = null_handler
|
||||
#pragma weak dma2_stream0_isr = null_handler
|
||||
#pragma weak dma2_stream1_isr = null_handler
|
||||
#pragma weak dma2_stream2_isr = null_handler
|
||||
#pragma weak dma2_stream3_isr = null_handler
|
||||
#pragma weak dma2_stream4_isr = null_handler
|
||||
#pragma weak eth_isr = null_handler
|
||||
#pragma weak eth_wkup_isr = null_handler
|
||||
#pragma weak can2_tx_isr = null_handler
|
||||
#pragma weak can2_rx0_isr = null_handler
|
||||
#pragma weak can2_rx1_isr = null_handler
|
||||
#pragma weak can2_sce_isr = null_handler
|
||||
#pragma weak otg_fs_isr = null_handler
|
||||
#pragma weak dma2_stream5_isr = null_handler
|
||||
#pragma weak dma2_stream6_isr = null_handler
|
||||
#pragma weak dma2_stream7_isr = null_handler
|
||||
#pragma weak usart6_isr = null_handler
|
||||
#pragma weak i2c3_ev_isr = null_handler
|
||||
#pragma weak i2c3_er_isr = null_handler
|
||||
#pragma weak otg_hs_ep1_out_isr = null_handler
|
||||
#pragma weak otg_hs_ep1_in_isr = null_handler
|
||||
#pragma weak otg_hs_wkup_isr = null_handler
|
||||
#pragma weak otg_hs_isr = null_handler
|
||||
#pragma weak dcmi_isr = null_handler
|
||||
#pragma weak cryp_isr = null_handler
|
||||
#pragma weak hash_rng_isr = null_handler
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
* Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
|
||||
* Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -17,19 +18,10 @@
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/f1/scb.h>
|
||||
#include <libopencm3/cm3/scb.h>
|
||||
|
||||
void scb_reset_core(void)
|
||||
static void pre_main(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_VECTRESET;
|
||||
}
|
||||
|
||||
void scb_reset_system(void)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ;
|
||||
}
|
||||
|
||||
void scb_set_priority_grouping(u32 prigroup)
|
||||
{
|
||||
SCB_AIRCR = SCB_AIRCR_VECTKEY | prigroup;
|
||||
/* Enable access to Floating-Point coprocessor. */
|
||||
SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11);
|
||||
}
|
||||
174
lib/stm32/nvic.c
174
lib/stm32/nvic.c
@@ -1,174 +0,0 @@
|
||||
/** @defgroup STM32F_nvic_file NVIC
|
||||
|
||||
@ingroup STM32F_files
|
||||
|
||||
@brief <b>libopencm3 STM32F Nested Vectored Interrupt Controller</b>
|
||||
|
||||
@version 1.0.0
|
||||
|
||||
@author @htmlonly © @endhtmlonly 2010 Thomas Otto <tommi@viadmin.org>
|
||||
@author @htmlonly © @endhtmlonly 2012 Fergus Noble <fergusnoble@gmail.com>
|
||||
|
||||
@date 18 August 2012
|
||||
|
||||
The STM32F series provides up to 68 maskable user interrupts for the STM32F10x
|
||||
series, and 87 for the STM32F2xx and STM32F4xx series.
|
||||
|
||||
The NVIC registers are defined by the ARM standards but the STM32F series have some
|
||||
additional limitations
|
||||
@see Cortex-M3 Devices Generic User Guide
|
||||
@see STM32F10xxx Cortex-M3 programming manual
|
||||
|
||||
LGPL License Terms @ref lgpl_license
|
||||
*/
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
|
||||
* Copyright (C) 2012 Fergus Noble <fergusnoble@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
|
||||
#include <libopencm3/stm32/nvic.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Enable Interrupt
|
||||
|
||||
Enables a user interrupt.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
*/
|
||||
|
||||
void nvic_enable_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ISER(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Disable Interrupt
|
||||
|
||||
Disables a user interrupt.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
*/
|
||||
|
||||
void nvic_disable_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ICER(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Return Pending Interrupt
|
||||
|
||||
True if the interrupt has occurred and is waiting for service.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
@return Boolean. Interrupt pending.
|
||||
*/
|
||||
|
||||
u8 nvic_get_pending_irq(u8 irqn)
|
||||
{
|
||||
return NVIC_ISPR(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Set Pending Interrupt
|
||||
|
||||
Force a user interrupt to a pending state. This has no effect if the interrupt
|
||||
is already pending.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
*/
|
||||
|
||||
void nvic_set_pending_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ISPR(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Clear Pending Interrupt
|
||||
|
||||
Force remove a user interrupt from a pending state. This has no effect if the
|
||||
interrupt is actively being serviced.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
*/
|
||||
|
||||
void nvic_clear_pending_irq(u8 irqn)
|
||||
{
|
||||
NVIC_ICPR(irqn / 32) = (1 << (irqn % 32));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Return Active Interrupt
|
||||
|
||||
Interrupt has occurred and is currently being serviced.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
@return Boolean. Interrupt active.
|
||||
*/
|
||||
|
||||
u8 nvic_get_active_irq(u8 irqn)
|
||||
{
|
||||
return NVIC_IABR(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Return Enabled Interrupt
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
@return Boolean. Interrupt enabled.
|
||||
*/
|
||||
|
||||
u8 nvic_get_irq_enabled(u8 irqn)
|
||||
{
|
||||
return NVIC_ISER(irqn / 32) & (1 << (irqn % 32)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Set Interrupt Priority
|
||||
|
||||
There are 16 priority levels only, given by the upper four bits of the priority
|
||||
byte, as required by ARM standards. The priority levels are interpreted according
|
||||
to the pre-emptive priority grouping set in the SCB Application Interrupt and Reset
|
||||
Control Register (SCB_AIRCR), as done in @ref scb_set_priority_grouping.
|
||||
|
||||
@param[in] irqn Unsigned int8. Interrupt number @ref nvic_stm32f1_userint
|
||||
@param[in] priority Unsigned int8. Interrupt priority (0 ... 255 in steps of 16)
|
||||
*/
|
||||
|
||||
void nvic_set_priority(u8 irqn, u8 priority)
|
||||
{
|
||||
NVIC_IPR(irqn) = priority;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief NVIC Software Trigger Interrupt
|
||||
|
||||
Generate an interrupt from software. This has no effect for unprivileged access
|
||||
unless the privilege level has been elevated through the System Control Registers.
|
||||
|
||||
@param[in] irqn Unsigned int16. Interrupt number (0 ... 239)
|
||||
*/
|
||||
|
||||
void nvic_generate_software_interrupt(u16 irqn)
|
||||
{
|
||||
if (irqn <= 239)
|
||||
NVIC_STIR |= irqn;
|
||||
}
|
||||
/**@}*/
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
/** @defgroup STM32F_systick_file SysTick
|
||||
|
||||
@ingroup STM32F_files
|
||||
|
||||
@brief <b>libopencm3 STM32Fxx System Tick Timer</b>
|
||||
|
||||
@version 1.0.0
|
||||
|
||||
@author @htmlonly © @endhtmlonly 2010 Thomas Otto <tommi@viadmin.org>
|
||||
|
||||
@date 19 August 2012
|
||||
|
||||
This library supports the System Tick timer in the
|
||||
STM32F series of ARM Cortex Microcontrollers by ST Microelectronics.
|
||||
|
||||
The System Tick timer is part of the ARM Cortex core. It is a 24 bit
|
||||
down counter that can be configured with an automatical reload value.
|
||||
|
||||
LGPL License Terms @ref lgpl_license
|
||||
*/
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**@{*/
|
||||
#include <libopencm3/stm32/systick.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief SysTick Set the Automatic Reload Value.
|
||||
|
||||
The counter is set to the reload value when the counter starts and after it
|
||||
reaches zero.
|
||||
|
||||
@param[in] value u32. 24 bit reload value.
|
||||
*/
|
||||
|
||||
void systick_set_reload(u32 value)
|
||||
{
|
||||
STK_LOAD = (value & 0x00FFFFFF);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief SysTick Read the Automatic Reload Value.
|
||||
|
||||
@returns 24 bit reload value as u32.
|
||||
*/
|
||||
|
||||
u32 systick_get_value(void)
|
||||
{
|
||||
return STK_VAL;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief Set the SysTick Clock Source.
|
||||
|
||||
The clock source can be either the AHB clock or the same clock divided by 8.
|
||||
|
||||
@param[in] clocksource u8. Clock source from @ref systick_clksource.
|
||||
*/
|
||||
|
||||
void systick_set_clocksource(u8 clocksource)
|
||||
{
|
||||
if (clocksource < 2)
|
||||
STK_CTRL |= (clocksource << STK_CTRL_CLKSOURCE_LSB);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief Enable SysTick Interrupt.
|
||||
|
||||
*/
|
||||
|
||||
void systick_interrupt_enable(void)
|
||||
{
|
||||
STK_CTRL |= STK_CTRL_TICKINT;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief Disable SysTick Interrupt.
|
||||
|
||||
*/
|
||||
|
||||
void systick_interrupt_disable(void)
|
||||
{
|
||||
STK_CTRL &= ~STK_CTRL_TICKINT;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief Enable SysTick Counter.
|
||||
|
||||
*/
|
||||
|
||||
void systick_counter_enable(void)
|
||||
{
|
||||
STK_CTRL |= STK_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief Disable SysTick Counter.
|
||||
|
||||
*/
|
||||
|
||||
void systick_counter_disable(void)
|
||||
{
|
||||
STK_CTRL &= ~STK_CTRL_ENABLE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/** @brief SysTick Read the Counter Flag.
|
||||
|
||||
The count flag is set when the timer count becomes zero, and is cleared when the
|
||||
flag is read.
|
||||
|
||||
@returns Boolean if flag set.
|
||||
*/
|
||||
|
||||
u8 systick_get_countflag(void)
|
||||
{
|
||||
if (STK_CTRL & STK_CTRL_COUNTFLAG)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
/**@}*/
|
||||
|
||||
Reference in New Issue
Block a user