fix: broken build with ATmega88A and ATmega168A caused by toolchain
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Mon, 16 Dec 2013 12:32:37 +0000 (13:32 +0100)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Mon, 16 Dec 2013 12:38:50 +0000 (12:38 +0000)
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/bootloaderconfig.h
firmware/main.c
firmware/spminterface.h
firmware/usbdrv/usbportability.h
misc/iofixes.h [new file with mode: 0644]
updater/updater.c
updater/usbasploader.h

index 8c969bd..e0ba814 100644 (file)
@@ -11,7 +11,7 @@
 
 #ifndef __bootloaderconfig_h_included__
 #define __bootloaderconfig_h_included__
-#include <avr/io.h>
+#include "../misc/iofixes.h"
 
 /*
 General Description:
index c378d0f..2f44357 100644 (file)
@@ -11,7 +11,8 @@
 
 #include "spminterface.h"  /* must be included as first! */
 
-#include <avr/io.h>
+#include "../misc/iofixes.h"
+
 #include <avr/interrupt.h>
 #include <avr/pgmspace.h>
 #include <avr/wdt.h>
index 48ddef5..b80163c 100644 (file)
@@ -88,9 +88,11 @@ ret
 *
 */ 
 
-#include <avr/io.h>
 #include "bootloaderconfig.h"
 
+#ifndef SREG
+#      include <avr/io.h>
+#endif
 
 
 /*
index a77c4c8..7fb99b0 100644 (file)
@@ -118,7 +118,7 @@ static inline void  sei(void)
 #else   /* default development environment is avr-gcc/avr-libc */
 /* ------------------------------------------------------------------------- */
 
-#include <avr/io.h>
+#include "../../misc/iofixes.h"
 #ifdef __ASSEMBLER__
 #   define _VECTOR(N)   __vector_ ## N   /* io.h does not define this for asm */
 #else
diff --git a/misc/iofixes.h b/misc/iofixes.h
new file mode 100644 (file)
index 0000000..fac3b7b
--- /dev/null
@@ -0,0 +1,89 @@
+/* Name: iofixes.h
+ * Project: USBaspLoader
+ * Author: Stephan Baerwolf
+ * Creation Date: 2013-12-16
+ * Copyright: (c) 2013 by Stephan Baerwolf
+ * License: GNU GPL v2 (see License.txt)
+ * Version: 0.96.5-testing
+ */
+
+#ifndef __IOFIXES_H_afa5e75bcfb24ef4a91ed4e7fe26e869
+#define __IOFIXES_H_afa5e75bcfb24ef4a91ed4e7fe26e869   1
+
+/* 
+ * WARNING: You should not edit this file !
+ * 
+ * The purpose of this file is the implementation of
+ * workaround for known bugs in existing AVR toolchains.
+ * 
+ * Most of the time it will fix missing definitions
+ * for registers and bitvalues.
+ * 
+ */
+
+#include <avr/io.h>
+
+
+/* ---------------------- Workarounds AVR IO BUGs ---------------------- */
+#if defined (__AVR_ATmega88A__)
+
+/* ATmega88A */
+
+/* IVCE */
+#      ifndef IVCE
+#              warning IVCE not defined for ATmega88A - fixing
+#              define IVCE     0
+#      endif
+
+/* IVSEL */
+#      ifndef IVSEL
+#              warning IVSEL not defined for ATmega88A - fixing
+#              define IVSEL    1
+#      endif
+
+/* RWWSRE */
+#      ifndef RWWSRE
+#              warning RWWSRE not defined for ATmega88A - fixing
+#              define RWWSRE   4
+#      endif
+
+
+
+
+
+
+
+#elif defined (__AVR_ATmega168A__)
+
+/* ATmega168A */
+
+/* IVCE */
+#      ifndef IVCE
+#              warning IVCE not defined for ATmega168A - fixing
+#              define IVCE     0
+#      endif
+
+/* IVSEL */
+#      ifndef IVSEL
+#              warning IVSEL not defined for ATmega168A - fixing
+#              define IVSEL    1
+#      endif
+
+/* RWWSRE */
+#      ifndef RWWSRE
+#              warning RWWSRE not defined for ATmega168A - fixing
+#              define RWWSRE   4
+#      endif
+
+/* RWWSB */
+#      ifndef RWWSB
+#              warning RWWSB not defined for ATmega168A - fixing
+#              define RWWSB    6
+#      endif
+
+
+
+#endif
+
+
+#endif
index b79c958..f61b345 100644 (file)
@@ -2,6 +2,8 @@
   #define F_CPU 1000000UL /* 1 Mhz-Takt; hier richtigen Wert eintragen */
 #endif
 
+
+#include "../misc/iofixes.h"
 #include "../firmware/spminterface.h"
 #include "usbasploader.h"
 
@@ -15,7 +17,6 @@
 #endif
 
 
-#include <avr/io.h>
 #include <avr/interrupt.h>
 #include <avr/wdt.h>
 
index 5400b36..20b71b9 100644 (file)
@@ -2,8 +2,9 @@
 #ifndef USBASPLOADER_H_5f27a7e9840141b1aa57eef07c1d939f
 #define USBASPLOADER_H_5f27a7e9840141b1aa57eef07c1d939f 1
 
+#include "../misc/iofixes.h"
+
 #include <stdint.h>
-#include <avr/io.h>
 #include <avr/pgmspace.h>
 #include "../firmware/spminterface.h"