From 6855916d10c6e7acf94765a27d9253aaddb4c22c Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Thu, 5 Apr 2012 15:27:12 +0100 Subject: [PATCH] elf: Do not set values that weren't present Some ELF binaries without a simavr section can now be loaded Signed-off-by: Michel Pollet --- simavr/sim/sim_elf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/simavr/sim/sim_elf.c b/simavr/sim/sim_elf.c index 4f8cebb..7d41ddd 100644 --- a/simavr/sim/sim_elf.c +++ b/simavr/sim/sim_elf.c @@ -38,10 +38,14 @@ 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 -- 2.39.5