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.
23 /* Interrupt functions */
25 void stm_halt_isr(void)
27 ao_panic(AO_PANIC_CRASH);
30 void stm_ignore_isr(void)
36 #define STRINGIFY(x) #x
39 void __attribute__ ((weak)) stm_ ## name ## _isr(void); \
40 _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_ignore_isr))
42 #define isr_halt(name) \
43 void __attribute__ ((weak)) stm_ ## name ## _isr(void); \
44 _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_halt_isr))
86 #define i(addr,name) [(addr)/4] = stm_ ## name ## _isr
88 extern char __stack[];
89 void _start(void) __attribute__((__noreturn__));
90 void main(void) __attribute__((__noreturn__));
92 __attribute__ ((section(".init")))
93 const void *const __interrupt_vector[] = {
109 i(0x64, dma1_channel1),
110 i(0x68, dma1_channel3_2),
111 i(0x6c, dma1_channel7_4),
114 i(0x78, usart4_usart5),
128 i(0xb4, lpuart1_aes),
131 extern char __data_source[];
132 extern char __data_start[];
133 extern char __data_size[];
134 extern char __bss_start[];
135 extern char __bss_size[];
140 if (ao_boot_check_chain()) {
142 if (ao_boot_check_pin())
145 ao_boot_chain(AO_BOOT_APPLICATION_BASE);
149 memcpy(__data_start, __data_source, (uintptr_t) __data_size);
150 memset(__bss_start, '\0', (uintptr_t) __bss_size);