From e0a9c87532e6e79479113b3b235e678bb4407583 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rados=C5=82aw=20Koppel?= Date: Thu, 4 May 2017 21:58:06 +0200 Subject: [PATCH] ioend implemented in core declaration --- simavr/cores/sim_core_declare.h | 2 ++ simavr/sim/sim_avr.c | 3 +-- simavr/sim/sim_avr.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/simavr/cores/sim_core_declare.h b/simavr/cores/sim_core_declare.h index 32aef38..1c74dfc 100644 --- a/simavr/cores/sim_core_declare.h +++ b/simavr/cores/sim_core_declare.h @@ -79,6 +79,7 @@ #ifdef SIGNATURE_0 #define DEFAULT_CORE(_vector_size) \ + .ioend = RAMSTART - 1, \ .ramend = RAMEND, \ .flashend = FLASHEND, \ .e2end = E2END, \ @@ -95,6 +96,7 @@ #else // Disable signature when using an old avr toolchain #define DEFAULT_CORE(_vector_size) \ + .ioend = RAMSTART - 1, \ .ramend = RAMEND, \ .flashend = FLASHEND, \ .e2end = E2END, \ diff --git a/simavr/sim/sim_avr.c b/simavr/sim/sim_avr.c index 63b5a9d..9999a17 100644 --- a/simavr/sim/sim_avr.c +++ b/simavr/sim/sim_avr.c @@ -137,11 +137,10 @@ void avr_reset( avr_t * avr) { - int noof_ios = MAX_IOs > avr->ramend ? avr->ramend : avr->ramend; AVR_LOG(avr, LOG_TRACE, "%s reset\n", avr->mmcu); avr->state = cpu_Running; - for(int i = 0x20; i < noof_ios; i++) + for(int i = 0x20; i <= avr->ioend; i++) avr->data[i] = 0; _avr_sp_set(avr, avr->ramend); avr->pc = avr->reset_pc; // Likely to be zero diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index edbe7a7..035e41e 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -149,6 +149,7 @@ typedef void (*avr_run_t)( typedef struct avr_t { const char * mmcu; // name of the AVR // these are filled by sim_core_declare from constants in /usr/lib/avr/include/avr/io*.h + uint16_t ioend; uint16_t ramend; uint32_t flashend; uint32_t e2end; -- 2.39.5