From: Andrew Dona-Couch Date: Thu, 9 Dec 2021 18:06:17 +0000 (-0500) Subject: simduino: wat to init avr until we pick a core X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=d232f0fdad9a14f259c3aa6d47bbd27f599c1361;p=sx%2Fsimavr.git simduino: wat to init avr until we pick a core --- diff --git a/examples/board_simduino/simduino.c b/examples/board_simduino/simduino.c index 007b383..4b515d6 100644 --- a/examples/board_simduino/simduino.c +++ b/examples/board_simduino/simduino.c @@ -115,12 +115,6 @@ int main(int argc, char *argv[]) } } - avr = avr_make_mcu_by_name(mmcu); - if (!avr) { - fprintf(stderr, "%s: Error creating the AVR core\n", argv[0]); - exit(1); - } - uint8_t * boot = read_ihex_file(boot_path, &boot_size, &boot_base); if (!boot) { fprintf(stderr, "%s: Unable to load %s\n", argv[0], boot_path); @@ -132,6 +126,12 @@ int main(int argc, char *argv[]) } printf("%s booloader 0x%05x: %d bytes\n", mmcu, boot_base, boot_size); + avr = avr_make_mcu_by_name(mmcu); + if (!avr) { + fprintf(stderr, "%s: Error creating the AVR core\n", argv[0]); + exit(1); + } + snprintf(flash_data.avr_flash_path, sizeof(flash_data.avr_flash_path), "simduino_%s_flash.bin", mmcu); flash_data.avr_flash_fd = 0;