Commit d232f0fdad9a14f259c3aa6d47bbd27f599c1361
authorAndrew Dona-Couch <hi@andrewcou.ch>
Thu, 9 Dec 2021 18:06:17 +0000 (13:06 -0500)
committerAndrew Dona-Couch <hi@andrewcou.ch>
Thu, 9 Dec 2021 18:06:17 +0000 (13:06 -0500)
examples/board_simduino/simduino.c

index 007b3832218f986c07499e40a1e51a8370662363..4b515d68cfcdc0b7c07577b03a328d94ee7f4728 100644 (file)
@@ -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;