vectors.c 12.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
/*
 * Copyright (C) 2015 Eistec AB
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @ingroup         cpu_k60
 * @{
 *
 * @file
 *
 * @brief Interrupt vector for K60 MCU.
 *
 * @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
 *
 * @note It is not necessary to modify this file to define custom interrupt
 * service routines. All symbols are defined weak, it is only necessary to
 * define a function with the same name in another file to override the default
 * interrupt handlers.
 */

/**
 * @name Interrupt vector definition
 * @{
 */

#include "cpu.h"
#include "vectors_cortexm.h"
#include "wdog.h"

/**
 * memory markers as defined in the linker script
 */
extern uint32_t _estack;

void pre_startup(void)
{
    /* disable the WDOG */
    wdog_disable();

    /*
     * Workaround for hardware errata e4218: "SIM/FLEXBUS: SIM_SCGC7[FLEXBUS]
     * bit should be cleared when the FlexBus is not being used."
     */
    BITBAND_REG32(SIM->SCGC7, SIM_SCGC7_FLEXBUS_SHIFT) = 0;
}

void dummy_handler(void)
{
    dummy_handler_default();
}

/* Cortex-M specific interrupt vectors */
WEAK_DEFAULT void isr_svc(void);
WEAK_DEFAULT void isr_pendsv(void);
WEAK_DEFAULT void isr_systick(void);
/* K60 specific interrupt vector */
WEAK_DEFAULT void isr_dma0_complete(void);
WEAK_DEFAULT void isr_dma1_complete(void);
WEAK_DEFAULT void isr_dma2_complete(void);
WEAK_DEFAULT void isr_dma3_complete(void);
WEAK_DEFAULT void isr_dma4_complete(void);
WEAK_DEFAULT void isr_dma5_complete(void);
WEAK_DEFAULT void isr_dma6_complete(void);
WEAK_DEFAULT void isr_dma7_complete(void);
WEAK_DEFAULT void isr_dma8_complete(void);
WEAK_DEFAULT void isr_dma9_complete(void);
WEAK_DEFAULT void isr_dma10_complete(void);
WEAK_DEFAULT void isr_dma11_complete(void);
WEAK_DEFAULT void isr_dma12_complete(void);
WEAK_DEFAULT void isr_dma13_complete(void);
WEAK_DEFAULT void isr_dma14_complete(void);
WEAK_DEFAULT void isr_dma15_complete(void);
WEAK_DEFAULT void isr_dma_error(void);
WEAK_DEFAULT void isr_mcm(void);
WEAK_DEFAULT void isr_flash_command_complete(void);
WEAK_DEFAULT void isr_flash_read_collision(void);
WEAK_DEFAULT void isr_low_voltage(void);
WEAK_DEFAULT void isr_llwu(void);
WEAK_DEFAULT void isr_watchdog(void);
WEAK_DEFAULT void isr_random_number_generator(void);
WEAK_DEFAULT void isr_i2c0(void);
WEAK_DEFAULT void isr_i2c1(void);
WEAK_DEFAULT void isr_spi0(void);
WEAK_DEFAULT void isr_spi1(void);
WEAK_DEFAULT void isr_spi2(void);
WEAK_DEFAULT void isr_can0_ored_msg_buffer(void);
WEAK_DEFAULT void isr_can0_bus_off(void);
WEAK_DEFAULT void isr_can0_error(void);
WEAK_DEFAULT void isr_can0_tx_warn(void);
WEAK_DEFAULT void isr_can0_rx_warn(void);
WEAK_DEFAULT void isr_can0_wake_up(void);
WEAK_DEFAULT void isr_i2s0_tx(void);
WEAK_DEFAULT void isr_i2s0_rx(void);
WEAK_DEFAULT void isr_can1_ored_msg_buffer(void);
WEAK_DEFAULT void isr_can1_bus_off(void);
WEAK_DEFAULT void isr_can1_error(void);
WEAK_DEFAULT void isr_can1_tx_warn(void);
WEAK_DEFAULT void isr_can1_rx_warn(void);
WEAK_DEFAULT void isr_can1_wake_up(void);
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_uart0_lon(void);
WEAK_DEFAULT void isr_uart0_status(void);
WEAK_DEFAULT void isr_uart0_error(void);
WEAK_DEFAULT void isr_uart1_status(void);
WEAK_DEFAULT void isr_uart1_error(void);
WEAK_DEFAULT void isr_uart2_status(void);
WEAK_DEFAULT void isr_uart2_error(void);
WEAK_DEFAULT void isr_uart3_status(void);
WEAK_DEFAULT void isr_uart3_error(void);
WEAK_DEFAULT void isr_uart4_status(void);
WEAK_DEFAULT void isr_uart4_error(void);
/* void dummy_handler(void); */
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_adc0(void);
WEAK_DEFAULT void isr_adc1(void);
WEAK_DEFAULT void isr_cmp0(void);
WEAK_DEFAULT void isr_cmp1(void);
WEAK_DEFAULT void isr_cmp2(void);
WEAK_DEFAULT void isr_ftm0(void);
WEAK_DEFAULT void isr_ftm1(void);
WEAK_DEFAULT void isr_ftm2(void);
WEAK_DEFAULT void isr_cmt(void);
WEAK_DEFAULT void isr_rtc_alarm(void);
WEAK_DEFAULT void isr_rtc_seconds(void);
WEAK_DEFAULT void isr_pit0(void);
WEAK_DEFAULT void isr_pit1(void);
WEAK_DEFAULT void isr_pit2(void);
WEAK_DEFAULT void isr_pit3(void);
WEAK_DEFAULT void isr_pdb(void);
WEAK_DEFAULT void isr_usb_otg(void);
WEAK_DEFAULT void isr_usb_charger_detect(void);
WEAK_DEFAULT void isr_enet_1588_timer(void);
WEAK_DEFAULT void isr_enet_tx(void);
WEAK_DEFAULT void isr_enet_rx(void);
WEAK_DEFAULT void isr_enet_error_misc(void);
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_sdhc(void);
WEAK_DEFAULT void isr_dac0(void);
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_tsi(void);
WEAK_DEFAULT void isr_mcg(void);
WEAK_DEFAULT void isr_lptmr0(void);
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_porta(void);
WEAK_DEFAULT void isr_portb(void);
WEAK_DEFAULT void isr_portc(void);
WEAK_DEFAULT void isr_portd(void);
WEAK_DEFAULT void isr_porte(void);
/* void dummy_handler(void); */
/* void dummy_handler(void); */
WEAK_DEFAULT void isr_software(void);

/**
 * @brief Interrupt vector definition
 */
__attribute__((used, section(".vector_table")))
const void *interrupt_vector[] = {
    /* Stack pointer */
    (void *)(&_estack),             /* pointer to the top of the empty stack */
    /* Cortex-M4 handlers */
    (void*) reset_handler_default,  /* entry point of the program */
    (void*) nmi_default,            /* non maskable interrupt handler */
    (void*) hard_fault_default,     /* hard fault exception */
    (void*) mem_manage_default,     /* memory manage exception */
    (void*) bus_fault_default,      /* bus fault exception */
    (void*) usage_fault_default,    /* usage fault exception */
    (void*) (0UL),                  /* Reserved */
    (void*) (0UL),                  /* Reserved */
    (void*) (0UL),                  /* Reserved */
    (void*) (0UL),                  /* Reserved */
    (void*) isr_svc,                /* system call interrupt, in RIOT used for
                                     * switching into thread context on boot */
    (void*) debug_mon_default,      /* debug monitor exception */
    (void*) (0UL),                  /* Reserved */
    (void*) isr_pendsv,             /* pendSV interrupt, in RIOT the actual
                                     * context switching is happening here */
    (void*) isr_systick,            /* SysTick interrupt, not used in RIOT */
    /* K60 specific peripheral handlers */
    (void*) isr_dma0_complete,
    (void*) isr_dma1_complete,
    (void*) isr_dma2_complete,
    (void*) isr_dma3_complete,
    (void*) isr_dma4_complete,
    (void*) isr_dma5_complete,
    (void*) isr_dma6_complete,
    (void*) isr_dma7_complete,
    (void*) isr_dma8_complete,
    (void*) isr_dma9_complete,
    (void*) isr_dma10_complete,
    (void*) isr_dma11_complete,
    (void*) isr_dma12_complete,
    (void*) isr_dma13_complete,
    (void*) isr_dma14_complete,
    (void*) isr_dma15_complete,
    (void*) isr_dma_error,
    (void*) isr_mcm,
    (void*) isr_flash_command_complete,
    (void*) isr_flash_read_collision,
    (void*) isr_low_voltage,
    (void*) isr_llwu,
    (void*) isr_watchdog,
    (void*) isr_random_number_generator,
    (void*) isr_i2c0,
    (void*) isr_i2c1,
    (void*) isr_spi0,
    (void*) isr_spi1,
    (void*) isr_spi2,
    (void*) isr_can0_ored_msg_buffer,
    (void*) isr_can0_bus_off,
    (void*) isr_can0_error,
    (void*) isr_can0_tx_warn,
    (void*) isr_can0_rx_warn,
    (void*) isr_can0_wake_up,
    (void*) isr_i2s0_tx,
    (void*) isr_i2s0_rx,
    (void*) isr_can1_ored_msg_buffer,
    (void*) isr_can1_bus_off,
    (void*) isr_can1_error,
    (void*) isr_can1_tx_warn,
    (void*) isr_can1_rx_warn,
    (void*) isr_can1_wake_up,
    (void*) dummy_handler,
    (void*) isr_uart0_lon,
    (void*) isr_uart0_status,
    (void*) isr_uart0_error,
    (void*) isr_uart1_status,
    (void*) isr_uart1_error,
    (void*) isr_uart2_status,
    (void*) isr_uart2_error,
    (void*) isr_uart3_status,
    (void*) isr_uart3_error,
    (void*) isr_uart4_status,
    (void*) isr_uart4_error,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) isr_adc0,
    (void*) isr_adc1,
    (void*) isr_cmp0,
    (void*) isr_cmp1,
    (void*) isr_cmp2,
    (void*) isr_ftm0,
    (void*) isr_ftm1,
    (void*) isr_ftm2,
    (void*) isr_cmt,
    (void*) isr_rtc_alarm,
    (void*) isr_rtc_seconds,
    (void*) isr_pit0,
    (void*) isr_pit1,
    (void*) isr_pit2,
    (void*) isr_pit3,
    (void*) isr_pdb,
    (void*) isr_usb_otg,
    (void*) isr_usb_charger_detect,
    (void*) isr_enet_1588_timer,
    (void*) isr_enet_tx,
    (void*) isr_enet_rx,
    (void*) isr_enet_error_misc,
    (void*) dummy_handler,
    (void*) isr_sdhc,
    (void*) isr_dac0,
    (void*) dummy_handler,
    (void*) isr_tsi,
    (void*) isr_mcg,
    (void*) isr_lptmr0,
    (void*) dummy_handler,
    (void*) isr_porta,
    (void*) isr_portb,
    (void*) isr_portc,
    (void*) isr_portd,
    (void*) isr_porte,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) isr_software, /* Vector 110 */
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler,
    (void*) dummy_handler /* vector 255 */
};

/** @} */