X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm%2Fao_interrupt.c;h=56cce0c02ff90af23fac42ee05af44783b59626c;hb=7348cc4736c9a94f9ad299edd78199b544d0e95a;hp=4915628590017450b01ea7432406976c0d29afce;hpb=b1a43ce313c85cb7f8f16f7f0647d9d4320ba692;p=fw%2Faltos diff --git a/src/stm/ao_interrupt.c b/src/stm/ao_interrupt.c index 49156285..56cce0c0 100644 --- a/src/stm/ao_interrupt.c +++ b/src/stm/ao_interrupt.c @@ -39,13 +39,46 @@ void stm_ignore_isr(void) const void *stm_interrupt_vector[]; +uint32_t +stm_flash_size(void) { + uint16_t dev_id = stm_dev_id(); + uint16_t kbytes = 0; + + switch (dev_id) { + case 0x416: /* cat 1 */ + kbytes = stm_flash_size_medium.f_size; + break; + case 0x429: /* cat 2 */ + kbytes = stm_flash_size_medium.f_size & 0xff; + break; + case 0x427: /* cat 3 */ + kbytes = stm_flash_size_large.f_size; + break; + case 0x436: /* cat 4 */ + switch (stm_flash_size_large.f_size) { + case 0: + kbytes = 256; + break; + case 1: + kbytes = 384; + break; + } + break; + case 0x437: /* cat 5 */ + kbytes = stm_flash_size_large.f_size; + break; + } + return (uint32_t) kbytes * 1024; +} + void start(void) { #ifdef AO_BOOT_CHAIN - ao_boot_check_chain(); -#endif + if (ao_boot_check_chain()) { #ifdef AO_BOOT_PIN - ao_boot_check_pin(); + ao_boot_check_pin(); +#endif + } #endif /* Set interrupt vector table offset */ stm_nvic.vto = (uint32_t) &stm_interrupt_vector;