From 0a8aa4993092cbbe6cd16eee6d04bee3c35b98fd Mon Sep 17 00:00:00 2001 From: Jakob Gruber Date: Fri, 20 Jul 2012 14:47:06 +0200 Subject: [PATCH] run_avr: Abort if firmware could not be read Otherwise, simavr continues and tries to process whichever random memory content is located in the flash memory section even when the file could not be read. --- simavr/sim/run_avr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simavr/sim/run_avr.c b/simavr/sim/run_avr.c index ccac5fb..f1f04c3 100644 --- a/simavr/sim/run_avr.c +++ b/simavr/sim/run_avr.c @@ -130,7 +130,11 @@ int main(int argc, char *argv[]) } } } else { - elf_read_firmware(filename, &f); + if (elf_read_firmware(filename, &f) == -1) { + fprintf(stderr, "%s: Unable to load firmware from file %s\n", + argv[0], filename); + exit(1); + } } } } -- 2.39.5