From d232f0fdad9a14f259c3aa6d47bbd27f599c1361 Mon Sep 17 00:00:00 2001
From: Andrew Dona-Couch <hi@andrewcou.ch>
Date: Thu, 9 Dec 2021 13:06:17 -0500
Subject: [PATCH] simduino: wat to init avr until we pick a core

---
 examples/board_simduino/simduino.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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;
-- 
2.39.5