From f10736a5aa410ff0818754c3d5635e9f0d9f05cd Mon Sep 17 00:00:00 2001 From: Konstantin Begun Date: Tue, 3 Oct 2017 22:52:10 +0100 Subject: [PATCH] Make sure sim_core_declare.h is included *after* avr includes, as currently dependant ifdefs never succeed --- simavr/cores/sim_core_declare.h | 6 +++--- simavr/cores/sim_mega128.c | 3 ++- simavr/cores/sim_mega1280.c | 3 ++- simavr/cores/sim_mega1281.c | 3 ++- simavr/cores/sim_mega128rfa1.c | 3 ++- simavr/cores/sim_mega128rfr2.c | 3 ++- simavr/cores/sim_mega169.c | 3 ++- simavr/cores/sim_mega2560.c | 3 ++- simavr/cores/sim_mega32u4.c | 3 ++- simavr/cores/sim_tiny13.c | 3 ++- simavr/cores/sim_tiny2313.c | 3 ++- simavr/cores/sim_tiny2313a.c | 3 ++- simavr/cores/sim_tiny4313.c | 3 ++- simavr/cores/sim_usb162.c | 3 ++- 14 files changed, 29 insertions(+), 16 deletions(-) diff --git a/simavr/cores/sim_core_declare.h b/simavr/cores/sim_core_declare.h index 1c74dfc..7d6dac7 100644 --- a/simavr/cores/sim_core_declare.h +++ b/simavr/cores/sim_core_declare.h @@ -71,10 +71,10 @@ # define _FUSE_HELPER { 0 } #endif -#ifdef MCUSR -# define MCU_STATUS_REG MCUSR -#else +#ifdef MCUCSR # define MCU_STATUS_REG MCUCSR +#else +# define MCU_STATUS_REG MCUSR #endif #ifdef SIGNATURE_0 diff --git a/simavr/cores/sim_mega128.c b/simavr/cores/sim_mega128.c index 3b11f2a..9c8a427 100644 --- a/simavr/cores/sim_mega128.c +++ b/simavr/cores/sim_mega128.c @@ -20,7 +20,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -40,6 +39,8 @@ void m128_reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iom128.h" +#include "sim_core_declare.h" + /* * This is a template for all of the 128 devices, hopefully */ diff --git a/simavr/cores/sim_mega1280.c b/simavr/cores/sim_mega1280.c index cff44a1..316bfd6 100644 --- a/simavr/cores/sim_mega1280.c +++ b/simavr/cores/sim_mega1280.c @@ -20,7 +20,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -43,6 +42,8 @@ void m1280_reset(struct avr_t * avr); #endif #include "avr/iom1280.h" +#include "sim_core_declare.h" + /* * This is a template for all of the 1280 devices, hopefully */ diff --git a/simavr/cores/sim_mega1281.c b/simavr/cores/sim_mega1281.c index 3bf28a0..222743c 100644 --- a/simavr/cores/sim_mega1281.c +++ b/simavr/cores/sim_mega1281.c @@ -20,7 +20,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -40,6 +39,8 @@ void m1281_reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iom1281.h" +#include "sim_core_declare.h" + /* * This is a template for all of the 1281 devices, hopefully */ diff --git a/simavr/cores/sim_mega128rfa1.c b/simavr/cores/sim_mega128rfa1.c index 5fa6141..2821e83 100644 --- a/simavr/cores/sim_mega128rfa1.c +++ b/simavr/cores/sim_mega128rfa1.c @@ -22,7 +22,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -42,6 +41,8 @@ void m128rfa1_reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iom128rfa1.h" +#include "sim_core_declare.h" + /* * This is a template for all of the 128rfa1 devices, hopefully */ diff --git a/simavr/cores/sim_mega128rfr2.c b/simavr/cores/sim_mega128rfr2.c index 1eb844b..5ffbab9 100644 --- a/simavr/cores/sim_mega128rfr2.c +++ b/simavr/cores/sim_mega128rfr2.c @@ -22,7 +22,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -42,6 +41,8 @@ void m128rfr2_reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iom128rfr2.h" +#include "sim_core_declare.h" + /* * Temporary hack for mangled avr-libc headers */ diff --git a/simavr/cores/sim_mega169.c b/simavr/cores/sim_mega169.c index 81c5319..209ff2f 100644 --- a/simavr/cores/sim_mega169.c +++ b/simavr/cores/sim_mega169.c @@ -3,7 +3,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -30,6 +29,8 @@ void m169p_reset(struct avr_t * avr); #define MCUCSR MCUSR #endif +#include "sim_core_declare.h" + const struct mcu_t { avr_t core; avr_eeprom_t eeprom; diff --git a/simavr/cores/sim_mega2560.c b/simavr/cores/sim_mega2560.c index fc3812e..2004498 100644 --- a/simavr/cores/sim_mega2560.c +++ b/simavr/cores/sim_mega2560.c @@ -21,7 +21,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -44,6 +43,8 @@ void m2560_reset(struct avr_t * avr); #endif #include "avr/iom2560.h" +#include "sim_core_declare.h" + /* * This is a template for all of the 2560 devices, hopefully */ diff --git a/simavr/cores/sim_mega32u4.c b/simavr/cores/sim_mega32u4.c index 583448e..ea79fac 100644 --- a/simavr/cores/sim_mega32u4.c +++ b/simavr/cores/sim_mega32u4.c @@ -36,7 +36,6 @@ #define PE6 6 #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -60,6 +59,8 @@ void m32u4_reset(struct avr_t * avr); #endif #include "avr/iom32u4.h" +#include "sim_core_declare.h" + /* * ATmega32u4 definitions */ diff --git a/simavr/cores/sim_tiny13.c b/simavr/cores/sim_tiny13.c index 34b439e..a741ef4 100644 --- a/simavr/cores/sim_tiny13.c +++ b/simavr/cores/sim_tiny13.c @@ -21,7 +21,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_watchdog.h" #include "avr_extint.h" @@ -34,6 +33,8 @@ #define __ASSEMBLER__ #include "avr/iotn13.h" +#include "sim_core_declare.h" + static void init(struct avr_t * avr); static void reset(struct avr_t * avr); diff --git a/simavr/cores/sim_tiny2313.c b/simavr/cores/sim_tiny2313.c index 537401b..7bca988 100644 --- a/simavr/cores/sim_tiny2313.c +++ b/simavr/cores/sim_tiny2313.c @@ -19,7 +19,6 @@ along with simavr. If not, see . */ -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_watchdog.h" #include "avr_extint.h" @@ -35,6 +34,8 @@ static void reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iotn2313.h" +#include "sim_core_declare.h" + /* * This is a template for all of the tinyx5 devices, hopefully */ diff --git a/simavr/cores/sim_tiny2313a.c b/simavr/cores/sim_tiny2313a.c index ce605da..66c30a5 100644 --- a/simavr/cores/sim_tiny2313a.c +++ b/simavr/cores/sim_tiny2313a.c @@ -19,7 +19,6 @@ along with simavr. If not, see . */ -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_watchdog.h" #include "avr_extint.h" @@ -35,6 +34,8 @@ static void reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iotn2313a.h" +#include "sim_core_declare.h" + /* * This is a template for all of the tinyx5 devices, hopefully */ diff --git a/simavr/cores/sim_tiny4313.c b/simavr/cores/sim_tiny4313.c index 1dba423..8123823 100644 --- a/simavr/cores/sim_tiny4313.c +++ b/simavr/cores/sim_tiny4313.c @@ -19,7 +19,6 @@ along with simavr. If not, see . */ -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_watchdog.h" #include "avr_extint.h" @@ -35,6 +34,8 @@ static void reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iotn4313.h" +#include "sim_core_declare.h" + /* * This is a template for all of the tinyx5 devices, hopefully */ diff --git a/simavr/cores/sim_usb162.c b/simavr/cores/sim_usb162.c index 9a45d15..0ed9874 100644 --- a/simavr/cores/sim_usb162.c +++ b/simavr/cores/sim_usb162.c @@ -20,7 +20,6 @@ */ #include "sim_avr.h" -#include "sim_core_declare.h" #include "avr_eeprom.h" #include "avr_flash.h" #include "avr_watchdog.h" @@ -40,6 +39,8 @@ void usb162_reset(struct avr_t * avr); #define __ASSEMBLER__ #include "avr/iousb162.h" +#include "sim_core_declare.h" + const struct mcu_t { avr_t core; avr_eeprom_t eeprom; -- 2.39.5