Commit 0a8aa4993092cbbe6cd16eee6d04bee3c35b98fd
authorJakob Gruber <jakob.gruber@gmail.com>
Fri, 20 Jul 2012 12:47:06 +0000 (14:47 +0200)
committerJakob Gruber <jakob.gruber@gmail.com>
Fri, 20 Jul 2012 12:51:14 +0000 (14:51 +0200)
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

index ccac5fbee06e10ae000b75b1d637e0295a06da60..f1f04c378a9e18ee9c8a22ac6f517592e7911984 100644 (file)
@@ -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);
+                               }
                        }
                }
        }