#include <stdint.h>
#include "defines.h"
#define ISR_VECTOR_SIZE_WORDS 166

void reset_handler(void);
void default_handler(void);
void nmi_handler(void) __attribute__((weak, alias("default_handler")));
void hard_fault_handler(void) __attribute__((weak, alias("default_handler")));
void bus_fault_handler(void) __attribute__((weak, alias("default_handler")));
void usage_fault_handler(void) __attribute__((weak, alias("default_handler")));
void svcall_handler(void) __attribute__((weak, alias("default_handler")));
void debug_monitor_handler(void) __attribute__((weak, alias("default_handler")));
void pendsv_handler(void) __attribute__((weak, alias("default_handler")));
void systick_handler(void) __attribute__((weak, alias("default_handler")));
void wwdg_handler(void) __attribute__((weak, alias("default_handler"))); /* window watchdog */
void pvd_pvm_handler(void) __attribute__((weak, alias("default_handler"))); /* pvd through exti line detection */
void rtc_tamp_stamp_css_lse_handler(void) __attribute__((weak, alias("default_handler"))); /* tamper and timestamps through the exti line */
void rtc_wkup_handler(void) __attribute__((weak, alias("default_handler"))); /* rtc wakeup through the exti line */
void flash_handler(void) __attribute__((weak, alias("default_handler"))); /* flash */
void rcc_handler(void) __attribute__((weak, alias("default_handler"))); /* rcc */
void exti0_handler(void) __attribute__((weak, alias("default_handler"))); /* exti line0 */
void exti1_handler(void) __attribute__((weak, alias("default_handler"))); /* exti line1 */
void exti2_handler(void) __attribute__((weak, alias("default_handler"))); /* exti line2 */
void exti3_handler(void) __attribute__((weak, alias("default_handler"))); /* exti line3 */
void exti4_handler(void) __attribute__((weak, alias("default_handler"))); /* exti line4 */
void dma1_stream0_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 0                */
void dma1_stream1_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 1                */
void dma1_stream2_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 2                */
void dma1_stream3_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 3 */
void dma1_stream4_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 4 */
void dma1_stream5_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 5 */
void dma1_stream6_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream 6 */
void adc_1_2_handler(void) __attribute__((weak, alias("default_handler"))); /* adc1, adc2 and adc3s         */
void fccan1_it0_handler(void) __attribute__((weak, alias("default_handler")));
void fccan2_it0_handler(void) __attribute__((weak, alias("default_handler")));
void fccan1_it1_handler(void) __attribute__((weak, alias("default_handler")));
void fccan2_it1_handler(void) __attribute__((weak, alias("default_handler")));
void exti9_5_handler(void) __attribute__((weak, alias("default_handler"))); /* external line[9:5]s          */
void tim1_brk_handler(void) __attribute__((weak, alias("default_handler"))); /* tim1 break and tim9          */
void tim1_up_handler(void) __attribute__((weak, alias("default_handler"))); /* tim1 update and tim10        */
void tim1_trg_com_handler(void) __attribute__((weak, alias("default_handler"))); /* tim1 trigger and commutation and tim11 */
void tim_cc_handler(void) __attribute__((weak, alias("default_handler"))); /* tim1 capture compare         */
void tim2_handler(void) __attribute__((weak, alias("default_handler"))); /* tim2                         */
void tim3_handler(void) __attribute__((weak, alias("default_handler"))); /* tim3                         */
void tim4_handler(void) __attribute__((weak, alias("default_handler"))); /* tim4                         */
void i2c1_ev_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c1 event                   */
void i2c1_er_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c1 error                   */
void i2c2_ev_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c2 event                   */
void i2c2_er_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c2 error                   */
void spi1_handler(void) __attribute__((weak, alias("default_handler"))); /* spi1                         */
void spi2_handler(void) __attribute__((weak, alias("default_handler"))); /* spi2                         */
void usart1_handler(void) __attribute__((weak, alias("default_handler"))); /* usart1                       */
void usart2_handler(void) __attribute__((weak, alias("default_handler"))); /* usart2                       */
void usart3_handler(void) __attribute__((weak, alias("default_handler"))); /* usart3                       */
void exti15_10_handler(void) __attribute__((weak, alias("default_handler"))); /* external line[15:10]s        */
void rtc_alarm_handler(void) __attribute__((weak, alias("default_handler"))); /* rtc alarm (a and b) through exti line */
void tim8_brk_tim12_handler(void) __attribute__((weak, alias("default_handler"))); /* tim8 break and tim12         */
void tim8_up_tim13_handler(void) __attribute__((weak, alias("default_handler"))); /* tim8 update and tim13        */
void tim8_trg_com_tim14_handler(void) __attribute__((weak, alias("default_handler"))); /* tim8 trigger and commutation and tim14 */
void tim8_cc_handler(void) __attribute__((weak, alias("default_handler"))); /* tim8 capture compare         */
void dma1_stream7_handler(void) __attribute__((weak, alias("default_handler"))); /* dma1 stream7                 */
void fmc_handler(void) __attribute__((weak, alias("default_handler"))); /* fmc                          */
void sdmmc1_handler(void) __attribute__((weak, alias("default_handler")));
void tim5_handler(void) __attribute__((weak, alias("default_handler"))); /* tim5                         */
void spi3_handler(void) __attribute__((weak, alias("default_handler"))); /* spi3                         */
void uart4_handler(void) __attribute__((weak, alias("default_handler"))); /* uart4                        */
void uart5_handler(void) __attribute__((weak, alias("default_handler"))); /* uart5                        */
void tim6_dac_handler(void) __attribute__((weak, alias("default_handler"))); /* tim6 and dac1&2 underrun errors */
void tim7_handler(void) __attribute__((weak, alias("default_handler"))); /* tim7                         */
void dma2_stream0_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 0                */
void dma2_stream1_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 1                */
void dma2_stream2_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 2                */
void dma2_stream3_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 3                */
void dma2_stream4_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 4                */
void eth_handler(void) __attribute__((weak, alias("default_handler")));
void eth_wkup_handler(void) __attribute__((weak, alias("default_handler")));
void fdcan_cal_handler(void) __attribute__((weak, alias("default_handler")));
void dma2_stream5_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 5                */
void dma2_stream6_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 6                */
void dma2_stream7_handler(void) __attribute__((weak, alias("default_handler"))); /* dma2 stream 7                */
void usart6_handler(void) __attribute__((weak, alias("default_handler"))); /* usart6                       */
void i2c3_ev_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c3 event                   */
void i2c3_er_handler(void) __attribute__((weak, alias("default_handler"))); /* i2c3 error                   */
void otg_hs_ep1_out_handler(void) __attribute__((weak, alias("default_handler"))); /* usb otg hs end point 1 out   */
void otg_hs_ep1_in_handler(void) __attribute__((weak, alias("default_handler"))); /* usb otg hs end point 1 in    */
void otg_hs_wkup_handler(void) __attribute__((weak, alias("default_handler"))); /* usb otg hs wakeup through exti */
void otg_hs_handler(void) __attribute__((weak, alias("default_handler"))); /* usb otg hs                   */
void dcmi_handler(void) __attribute__((weak, alias("default_handler"))); /* dcmi                         */
void cryp_handler(void) __attribute__((weak, alias("default_handler")));
void hash_rng_handler(void) __attribute__((weak, alias("default_handler")));
void fpu_handler(void) __attribute__((weak, alias("default_handler"))); /* fpu                          */
void uart7_handler(void) __attribute__((weak, alias("default_handler")));
void uart8_handler(void) __attribute__((weak, alias("default_handler")));
void spi4_handler(void) __attribute__((weak, alias("default_handler"))); /* spi4                         */
void spi5_handler(void) __attribute__((weak, alias("default_handler"))); /* spi5                         */
void spi6_handler(void) __attribute__((weak, alias("default_handler"))); /* spi6                         */
void sai1_handler(void) __attribute__((weak, alias("default_handler"))); /* sai1                         */
void ltdc_handler(void) __attribute__((weak, alias("default_handler")));
void ltdc_er_handler(void) __attribute__((weak, alias("default_handler")));
void dma2d_handler(void) __attribute__((weak, alias("default_handler")));
void sai2_handler(void) __attribute__((weak, alias("default_handler")));
void quadspi_handler(void) __attribute__((weak, alias("default_handler"))); /* quadspi                      */
void lptim1_handler(void) __attribute__((weak, alias("default_handler"))); /* cec                          */
void cec_handler(void) __attribute__((weak, alias("default_handler"))); /* cec                          */
void i2c4_ev_handler(void) __attribute__((weak, alias("default_handler")));
void i2c4_er_handler(void) __attribute__((weak, alias("default_handler")));
void spdif_handler(void) __attribute__((weak, alias("default_handler"))); /* spdif rx                     */
void otg_fs_ep1_out_handler(void) __attribute__((weak, alias("default_handler")));
void otg_fs_ep1_in_handler(void) __attribute__((weak, alias("default_handler")));
void otg_fs_wkup_handler(void) __attribute__((weak, alias("default_handler")));
void otg_fs_handler(void) __attribute__((weak, alias("default_handler")));
void dmamux1_ov_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_mst_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_tima_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_timb_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_timc_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_timd_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_time_handler(void) __attribute__((weak, alias("default_handler")));
void hrtim1_flt_handler(void) __attribute__((weak, alias("default_handler")));
void dfsdm1_flt0_handler(void) __attribute__((weak, alias("default_handler")));
void dfsdm1_flt1_handler(void) __attribute__((weak, alias("default_handler")));
void dfsdm1_flt2_handler(void) __attribute__((weak, alias("default_handler")));
void dfsdm1_flt3_handler(void) __attribute__((weak, alias("default_handler")));
void sai3_handler(void) __attribute__((weak, alias("default_handler")));
void swpmi1_handler(void) __attribute__((weak, alias("default_handler")));
void tim15_handler(void) __attribute__((weak, alias("default_handler")));
void tim16_handler(void) __attribute__((weak, alias("default_handler")));
void tim17_handler(void) __attribute__((weak, alias("default_handler")));
void mdios_wkup_handler(void) __attribute__((weak, alias("default_handler")));
void mdios_handler(void) __attribute__((weak, alias("default_handler")));
void jpeg_handler(void) __attribute__((weak, alias("default_handler")));
void mdma_handler(void) __attribute__((weak, alias("default_handler")));
void dsi_dsi_wkup_handler(void) __attribute__((weak, alias("default_handler")));
void sdmmc2_handler(void) __attribute__((weak, alias("default_handler")));
void hsem0_handler(void) __attribute__((weak, alias("default_handler")));
void adc3_handler(void) __attribute__((weak, alias("default_handler")));
void dmamux2_ovr_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch0_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch1_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch2_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch3_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch4_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch5_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch6_handler(void) __attribute__((weak, alias("default_handler")));
void bdma_ch7_handler(void) __attribute__((weak, alias("default_handler")));
void comp_handler(void) __attribute__((weak, alias("default_handler")));
void lptim2_handler(void) __attribute__((weak, alias("default_handler")));
void lptim3_handler(void) __attribute__((weak, alias("default_handler")));
void lptim4_handler(void) __attribute__((weak, alias("default_handler")));
void lptim5_handler(void) __attribute__((weak, alias("default_handler")));
void lptim6_handler(void) __attribute__((weak, alias("default_handler")));
void lpuart_handler(void) __attribute__((weak, alias("default_handler")));
void wwdg2_rst_handler(void) __attribute__((weak, alias("default_handler")));
void crs_handler(void) __attribute__((weak, alias("default_handler")));
void ecc_handler(void) __attribute__((weak, alias("default_handler")));
void sai4_handler(void) __attribute__((weak, alias("default_handler")));
void hold_core_handler(void) __attribute__((weak, alias("default_handler")));
void wkup_handler(void) __attribute__((weak, alias("default_handler")));

uint32_t isr_vector[ISR_VECTOR_SIZE_WORDS] __attribute__((section(".isr_vector"))) = {
  STACK_POINTER_INIT_ADDRESS,
  (uint32_t)&reset_handler,
  (uint32_t)&nmi_handler,
  (uint32_t)&hard_fault_handler,
  (uint32_t)&bus_fault_handler,
  (uint32_t)&usage_fault_handler,
  0,
  0,
  0,
  0,
  0,
  (uint32_t)&svcall_handler,
  (uint32_t)&debug_monitor_handler,
  0,
  (uint32_t)&pendsv_handler,
  (uint32_t)&systick_handler,
  (uint32_t)&wwdg_handler, /* window watchdog */
  (uint32_t)&pvd_pvm_handler, /* pvd through exti line detection */
  (uint32_t)&rtc_tamp_stamp_css_lse_handler, /* tamper and timestamps through the exti line */
  (uint32_t)&rtc_wkup_handler, /* rtc wakeup through the exti line */
  (uint32_t)&flash_handler, /* flash */
  (uint32_t)&rcc_handler, /* rcc */
  (uint32_t)&exti0_handler, /* exti line0 */
  (uint32_t)&exti1_handler, /* exti line1 */
  (uint32_t)&exti2_handler, /* exti line2 */
  (uint32_t)&exti3_handler, /* exti line3 */
  (uint32_t)&exti4_handler, /* exti line4 */
  (uint32_t)&dma1_stream0_handler, /* dma1 stream 0                */
  (uint32_t)&dma1_stream1_handler, /* dma1 stream 1                */
  (uint32_t)&dma1_stream2_handler, /* dma1 stream 2                */
  (uint32_t)&dma1_stream3_handler, /* dma1 stream 3 */
  (uint32_t)&dma1_stream4_handler, /* dma1 stream 4 */
  (uint32_t)&dma1_stream5_handler, /* dma1 stream 5 */
  (uint32_t)&dma1_stream6_handler, /* dma1 stream 6 */
  (uint32_t)&adc_1_2_handler, /* adc1, adc2 and adc3s         */
  (uint32_t)&fccan1_it0_handler,
  (uint32_t)&fccan2_it0_handler,
  (uint32_t)&fccan1_it1_handler,
  (uint32_t)&fccan2_it1_handler,
  (uint32_t)&exti9_5_handler, /* external line[9:5]s          */
  (uint32_t)&tim1_brk_handler, /* tim1 break and tim9          */
  (uint32_t)&tim1_up_handler, /* tim1 update and tim10        */
  (uint32_t)&tim1_trg_com_handler, /* tim1 trigger and commutation and tim11 */
  (uint32_t)&tim_cc_handler, /* tim1 capture compare         */
  (uint32_t)&tim2_handler, /* tim2                         */
  (uint32_t)&tim3_handler, /* tim3                         */
  (uint32_t)&tim4_handler, /* tim4                         */
  (uint32_t)&i2c1_ev_handler, /* i2c1 event                   */
  (uint32_t)&i2c1_er_handler, /* i2c1 error                   */
  (uint32_t)&i2c2_ev_handler, /* i2c2 event                   */
  (uint32_t)&i2c2_er_handler, /* i2c2 error                   */
  (uint32_t)&spi1_handler, /* spi1                         */
  (uint32_t)&spi2_handler, /* spi2                         */
  (uint32_t)&usart1_handler, /* usart1                       */
  (uint32_t)&usart2_handler, /* usart2                       */
  (uint32_t)&usart3_handler, /* usart3                       */
  (uint32_t)&exti15_10_handler, /* external line[15:10]s        */
  (uint32_t)&rtc_alarm_handler, /* rtc alarm (a and b) through exti line */
  0,
  (uint32_t)&tim8_brk_tim12_handler, /* tim8 break and tim12         */
  (uint32_t)&tim8_up_tim13_handler, /* tim8 update and tim13        */
  (uint32_t)&tim8_trg_com_tim14_handler, /* tim8 trigger and commutation and tim14 */
  (uint32_t)&tim8_cc_handler, /* tim8 capture compare         */
  (uint32_t)&dma1_stream7_handler, /* dma1 stream7                 */
  (uint32_t)&fmc_handler, /* fmc                          */
  (uint32_t)&sdmmc1_handler,
  (uint32_t)&tim5_handler, /* tim5                         */
  (uint32_t)&spi3_handler, /* spi3                         */
  (uint32_t)&uart4_handler, /* uart4                        */
  (uint32_t)&uart5_handler, /* uart5                        */
  (uint32_t)&tim6_dac_handler, /* tim6 and dac1&2 underrun errors */
  (uint32_t)&tim7_handler, /* tim7                         */
  (uint32_t)&dma2_stream0_handler, /* dma2 stream 0                */
  (uint32_t)&dma2_stream1_handler, /* dma2 stream 1                */
  (uint32_t)&dma2_stream2_handler, /* dma2 stream 2                */
  (uint32_t)&dma2_stream3_handler, /* dma2 stream 3                */
  (uint32_t)&dma2_stream4_handler, /* dma2 stream 4                */
  (uint32_t)&eth_handler,
  (uint32_t)&eth_wkup_handler,
  (uint32_t)&fdcan_cal_handler,
  0,
  0,
  0,
  0,
  (uint32_t)&dma2_stream5_handler, /* dma2 stream 5                */
  (uint32_t)&dma2_stream6_handler, /* dma2 stream 6                */
  (uint32_t)&dma2_stream7_handler, /* dma2 stream 7                */
  (uint32_t)&usart6_handler, /* usart6                       */
  (uint32_t)&i2c3_ev_handler, /* i2c3 event                   */
  (uint32_t)&i2c3_er_handler, /* i2c3 error                   */
  (uint32_t)&otg_hs_ep1_out_handler, /* usb otg hs end point 1 out   */
  (uint32_t)&otg_hs_ep1_in_handler, /* usb otg hs end point 1 in    */
  (uint32_t)&otg_hs_wkup_handler, /* usb otg hs wakeup through exti */
  (uint32_t)&otg_hs_handler, /* usb otg hs                   */
  (uint32_t)&dcmi_handler, /* dcmi                         */
  (uint32_t)&cryp_handler,
  (uint32_t)&hash_rng_handler,
  (uint32_t)&fpu_handler, /* fpu                          */
  (uint32_t)&uart7_handler,
  (uint32_t)&uart8_handler,
  (uint32_t)&spi4_handler, /* spi4                         */
  (uint32_t)&spi5_handler, /* spi5                         */
  (uint32_t)&spi6_handler, /* spi6                         */
  (uint32_t)&sai1_handler, /* sai1                         */
  (uint32_t)&ltdc_handler,
  (uint32_t)&ltdc_er_handler,
  (uint32_t)&dma2d_handler,
  (uint32_t)&sai2_handler,
  (uint32_t)&quadspi_handler, /* quadspi                      */
  (uint32_t)&lptim1_handler, /* cec                          */
  (uint32_t)&cec_handler, /* cec                          */
  (uint32_t)&i2c4_ev_handler,
  (uint32_t)&i2c4_er_handler,
  (uint32_t)&spdif_handler, /* spdif rx                     */
  (uint32_t)&otg_fs_ep1_out_handler,
  (uint32_t)&otg_fs_ep1_in_handler,
  (uint32_t)&otg_fs_wkup_handler,
  (uint32_t)&otg_fs_handler,
  (uint32_t)&dmamux1_ov_handler,
  (uint32_t)&hrtim1_mst_handler,
  (uint32_t)&hrtim1_tima_handler,
  (uint32_t)&hrtim1_timb_handler,
  (uint32_t)&hrtim1_timc_handler,
  (uint32_t)&hrtim1_timd_handler,
  (uint32_t)&hrtim1_time_handler,
  (uint32_t)&hrtim1_flt_handler,
  (uint32_t)&dfsdm1_flt0_handler,
  (uint32_t)&dfsdm1_flt1_handler,
  (uint32_t)&dfsdm1_flt2_handler,
  (uint32_t)&dfsdm1_flt3_handler,
  (uint32_t)&sai3_handler,
  (uint32_t)&swpmi1_handler,
  (uint32_t)&tim15_handler,
  (uint32_t)&tim16_handler,
  (uint32_t)&tim17_handler,
  (uint32_t)&mdios_wkup_handler,
  (uint32_t)&mdios_handler,
  (uint32_t)&jpeg_handler,
  (uint32_t)&mdma_handler,
  (uint32_t)&dsi_dsi_wkup_handler,
  (uint32_t)&sdmmc2_handler,
  (uint32_t)&hsem0_handler,
  0,
  (uint32_t)&adc3_handler,
  (uint32_t)&dmamux2_ovr_handler,
  (uint32_t)&bdma_ch0_handler,
  (uint32_t)&bdma_ch1_handler,
  (uint32_t)&bdma_ch2_handler,
  (uint32_t)&bdma_ch3_handler,
  (uint32_t)&bdma_ch4_handler,
  (uint32_t)&bdma_ch5_handler,
  (uint32_t)&bdma_ch6_handler,
  (uint32_t)&bdma_ch7_handler,
  (uint32_t)&comp_handler,
  (uint32_t)&lptim2_handler,
  (uint32_t)&lptim3_handler,
  (uint32_t)&lptim4_handler,
  (uint32_t)&lptim5_handler,
  (uint32_t)&lpuart_handler,
  (uint32_t)&wwdg2_rst_handler,
  (uint32_t)&crs_handler,
  (uint32_t)&ecc_handler,
  (uint32_t)&sai4_handler,
  0,
  (uint32_t)&hold_core_handler,
  (uint32_t)&wkup_handler
};

void default_handler(void)
{
  while(1);
}
