From f6385bb3856d565207b2a8bba081fe80583d6a9f Mon Sep 17 00:00:00 2001 From: Edgar Bonet Date: Tue, 13 Oct 2020 11:41:24 +0200 Subject: [PATCH] Expand the I/O table to support the ATmega2560 The I/O space of the ATmega640/1280/1281/2560/2561 extends from 0x0020 to 0x01ff, for a total of 512 - 32 = 480 memory locations. Fixes a crash that would result from writing to an unmapped location. --- simavr/sim/sim_avr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index 35539761b..5eed0d50c 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -66,7 +66,7 @@ enum { R_SREG = 32+0x3f, // maximum number of IO registers, on normal AVRs - MAX_IOs = 280, // Bigger AVRs need more than 256-32 (mega1280) + MAX_IOs = 480, // Bigger AVRs need 512-32 (mega2560) }; #define AVR_DATA_TO_IO(v) ((v) - 32)