Commit 6855916d10c6e7acf94765a27d9253aaddb4c22c
authorMichel Pollet <buserror@gmail.com>
Thu, 5 Apr 2012 14:27:12 +0000 (15:27 +0100)
committerMichel Pollet <buserror@gmail.com>
Thu, 5 Apr 2012 14:27:12 +0000 (15:27 +0100)
Some ELF binaries without a simavr section can now be loaded

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/sim_elf.c

index 4f8cebbf0df2cdbb359b65c40717797efbded010..7d41ddd3ef9703e04f8ff33569060601572f5688 100644 (file)
 
 void avr_load_firmware(avr_t * avr, elf_firmware_t * firmware)
 {
-       avr->frequency = firmware->frequency;
-       avr->vcc = firmware->vcc;
-       avr->avcc = firmware->avcc;
-       avr->aref = firmware->aref;
+       if (firmware->frequency)
+               avr->frequency = firmware->frequency;
+       if (firmware->vcc)
+               avr->vcc = firmware->vcc;
+       if (firmware->avcc)
+               avr->avcc = firmware->avcc;
+       if (firmware->aref)
+               avr->aref = firmware->aref;
 #if CONFIG_SIMAVR_TRACE
        avr->trace_data->codeline = firmware->codeline;
 #endif