2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 extern void main(void);
26 /* Interrupt functions */
28 void stm_halt_isr(void)
30 ao_panic(AO_PANIC_CRASH);
33 void stm_ignore_isr(void)
37 #define STRINGIFY(x) #x
40 void __attribute__ ((weak)) stm_ ## name ## _isr(void); \
41 _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_ignore_isr))
43 #define isr_halt(name) \
44 void __attribute__ ((weak)) stm_ ## name ## _isr(void); \
45 _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_halt_isr))
115 isr(dma2_channel4_5);
117 #define i(addr,name) [(addr)/4] = stm_ ## name ## _isr
119 extern char __stack[];
120 void _start(void) __attribute__((__noreturn__));
121 void main(void) __attribute__((__noreturn__));
122 void ao_setup(void) __attribute__((constructor));
124 /* This must be exactly 304 bytes long so that the configuration data
125 * gets loaded at the right place
128 __attribute__ ((section(".init")))
129 const void * const __interrupt_vector[76] = {
143 i(0x48, tamper_stamp),
152 i(0x6c, dma1_channel1),
153 i(0x70, dma1_channel2),
154 i(0x74, dma1_channel3),
155 i(0x78, dma1_channel4),
156 i(0x7c, dma1_channel5),
157 i(0x80, dma1_channel6),
158 i(0x84, dma1_channel7),
167 i(0xa8, tim1_trg_com),
186 i(0xf4, tim8_trg_com),
197 i(0x120, dma2_channel1),
198 i(0x124, dma2_channel2),
199 i(0x128, dma2_channel3),
200 i(0x12c, dma2_channel4_5),
203 void __attribute__((constructor)) ao_setup(void) {
205 if (ao_boot_check_chain()) {
207 if (ao_boot_check_pin())
210 ao_boot_chain(AO_BOOT_APPLICATION_BASE);
214 /* Set interrupt vector table offset */
215 stm_scb.vtor = (uint32_t) &__interrupt_vector;