From: Jakob Gruber Date: Fri, 20 Jul 2012 12:47:06 +0000 (+0200) Subject: run_avr: Abort if firmware could not be read X-Git-Tag: v1.0~51 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=0a8aa4993092cbbe6cd16eee6d04bee3c35b98fd;p=sx%2Fsimavr.git 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. --- 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); + } } } }