X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm%2Fao_interrupt.c;h=0d6e450f581b1911e4ae3e3089154c5348ef1577;hb=b140da92536d7c48ba37868f1c2afce7bb86dfdb;hp=c62870b745ffebfb616f9e0498d61e7c919ff81c;hpb=2108da105ed9c915fc09d1251dc655bf11203d79;p=fw%2Faltos diff --git a/src/stm/ao_interrupt.c b/src/stm/ao_interrupt.c index c62870b7..0d6e450f 100644 --- a/src/stm/ao_interrupt.c +++ b/src/stm/ao_interrupt.c @@ -34,8 +34,6 @@ void stm_ignore_isr(void) { } -void *const __interrupt_vector[]; - uint32_t stm_flash_size(void) { uint16_t dev_id = stm_dev_id(); @@ -138,13 +136,14 @@ isr(tim7) extern char __stack[]; void _start(void) __attribute__((__noreturn__)); void main(void) __attribute__((__noreturn__)); +void ao_setup(void) __attribute__((constructor)); /* This must be exactly 256 bytes long so that the configuration data * gets loaded at the right place */ __attribute__ ((section(".init"))) -void * const __interrupt_vector[64] = { +const void * const __interrupt_vector[64] = { [0] = &__stack, [1] = _start, i(0x08, nmi), @@ -203,16 +202,7 @@ void * const __interrupt_vector[64] = { i(0xf0, tim7), }; -extern char __data_source[]; -extern char __data_start[]; -extern char __data_size[]; -extern char __bss_start[]; -extern char __bss_size[]; - -void _start(void) { - memcpy(__data_start, __data_source, (uintptr_t) __data_size); - memset(__bss_start, '\0', (uintptr_t) __bss_size); - +void __attribute__((constructor)) ao_setup(void) { #ifdef AO_BOOT_CHAIN if (ao_boot_check_chain()) { #ifdef AO_BOOT_PIN @@ -225,5 +215,4 @@ void _start(void) { #endif /* Set interrupt vector table offset */ stm_nvic.vto = (uint32_t) &__interrupt_vector; - main(); }