Parcourir la source

Add ATtiny1634 and ATtiny841, via Makefile.tiny
These are the non-LIN based tinys,
based on https://github.com/SpenceKonde/ATTinyCore/
(Except: segregate and modernize the make instructions!)

WestfW il y a 6 ans
Parent
commit
57bb015c48

+ 1 - 0
optiboot/bootloaders/optiboot/Makefile

@@ -587,6 +587,7 @@ include Makefile.extras
 include Makefile.1284
 include Makefile.custom
 include Makefile.2560
+include Makefile.tiny
 
 
 #---------------------------------------------------------------------------

+ 234 - 0
optiboot/bootloaders/optiboot/Makefile.tiny

@@ -0,0 +1,234 @@
+#-------------------------------
+# ATtiny 1634, Base instructions
+#-------------------------------
+attiny1634:	TARGET = attiny1634
+attiny1634:	MCU_TARGET = attiny1634
+attiny1634:	LED_CMD ?= -DLED=C0
+attiny1634: CFLAGS += $(COMMON_OPTIONS) -DVIRTUAL_BOOT_PARTITION -DFOURPAGEERASE $(UART_CMD)
+attiny1634: AVR_FREQ ?= 8000000L
+attiny1634: LDSECTIONS  = -Wl,--section-start=.text=0x3d80 -Wl,--section-start=.version=0x3ffe
+attiny1634: $(PROGRAM)_attiny1634.hex
+attiny1634: $(PROGRAM)_attiny1634.lst
+
+
+#-----------------------
+# ATtiny 1634, UART 0 
+#-----------------------
+attiny1634at12:
+	"$(MAKE)" attiny1634	AVR_FREQ=12000000L
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at16:
+	"$(MAKE)" attiny1634	AVR_FREQ=16000000L
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at8:
+	"$(MAKE)" attiny1634	AVR_FREQ=8000000L BAUD_RATE=57600
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at8_5v:
+	"$(MAKE)" attiny1634	AVR_FREQ=8200000L BAUD_RATE=57600
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at737:
+	"$(MAKE)" attiny1634	AVR_FREQ=7372800L BAUD_RATE=57600
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at921:
+	"$(MAKE)" attiny1634	AVR_FREQ=9216000L  BAUD_RATE=57600
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at110:
+	"$(MAKE)" attiny1634	AVR_FREQ=11059200L
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at147:
+	"$(MAKE)" attiny1634	AVR_FREQ=14745600L
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+
+
+#-----------------------
+# ATtiny 1634, UART 1 
+#-----------------------
+
+attiny1634at12ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=12000000L UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at16ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=16000000L UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at8ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=8000000L BAUD_RATE=57600 UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at8_5vser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=8200000L BAUD_RATE=57600 UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at737ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=7372800L BAUD_RATE=57600 UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at921ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=9216000L  BAUD_RATE=57600 UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at110ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=11059200L UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+attiny1634at147ser1:
+	"$(MAKE)" attiny1634	AVR_FREQ=14745600L UART=1
+	mv $(PROGRAM)_attiny1634.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny1634.lst $(PROGRAM)_$@.lst
+
+
+
+#--------------------------------
+# ATtiny 841, base instructions
+#-------------------------------
+
+attiny841: TARGET = attiny841
+attiny841: MCU_TARGET = attiny841
+attiny841: CFLAGS += $(COMMON_OPTIONS) '-DVIRTUAL_BOOT_PARTITION' '-DFOURPAGEERASE' $(UART_CMD)
+attiny841: AVR_FREQ ?= 8000000L
+attiny841: LDSECTIONS  = -Wl,--section-start=.text=0x1d80 -Wl,--section-start=.version=0x1ffe
+attiny841: $(PROGRAM)_attiny841.hex
+attiny841: $(PROGRAM)_attiny841.lst
+
+#-----------------------
+# ATtiny 841, UART 0 
+#-----------------------
+attiny841at184:
+	$(MAKE) attiny841	 AVR_FREQ=18432000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at147:
+	$(MAKE) attiny841	 AVR_FREQ=14745600L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at110:
+	$(MAKE) attiny841	 AVR_FREQ=11059200L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at921:
+	$(MAKE) attiny841	 AVR_FREQ=9216000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at737:
+	$(MAKE) attiny841	 AVR_FREQ=7372800L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at20:
+	$(MAKE) attiny841	 AVR_FREQ=20000000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at16:
+	$(MAKE) attiny841	 AVR_FREQ=16000000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at12:
+	$(MAKE) attiny841	 AVR_FREQ=12000000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at8:
+	$(MAKE) attiny841	 AVR_FREQ=8000000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at8_5v:
+	$(MAKE) attiny841	 AVR_FREQ=8200000L
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+
+
+#-----------------------
+# ATtiny 841, UART 0 
+#-----------------------
+attiny841at184ser1:
+	$(MAKE) attiny841	 AVR_FREQ=18432000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at147ser1:
+	$(MAKE) attiny841	 AVR_FREQ=14745600L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at110ser1:
+	$(MAKE) attiny841	 AVR_FREQ=11059200L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at921ser1:
+	$(MAKE) attiny841	 AVR_FREQ=9216000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at737ser1:
+	$(MAKE) attiny841	 AVR_FREQ=7372800L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at20ser1:
+	$(MAKE) attiny841	 AVR_FREQ=20000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at16ser1:
+	$(MAKE) attiny841	 AVR_FREQ=16000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at12ser1:
+	$(MAKE) attiny841	 AVR_FREQ=12000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at8ser1:
+	$(MAKE) attiny841	 AVR_FREQ=8000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at20noLED:
+	$(MAKE) attiny841	 AVR_FREQ=20000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at16noLED:
+	$(MAKE) attiny841	 AVR_FREQ=16000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+
+attiny841at8noLED:
+	$(MAKE) attiny841	 AVR_FREQ=8000000L UART=1
+	mv $(PROGRAM)_attiny841.hex $(PROGRAM)_$@.hex
+	mv $(PROGRAM)_attiny841.lst $(PROGRAM)_$@.lst
+

+ 13 - 0
optiboot/bootloaders/optiboot/optiboot.c

@@ -945,8 +945,21 @@ void watchdogReset() {
 }
 
 void watchdogConfig(uint8_t x) {
+#ifdef WDCE //does it have a Watchdog Change Enable?
+ #ifdef WDTCSR
   WDTCSR = _BV(WDCE) | _BV(WDE);
+ #else
+  WDTCR= _BV(WDCE) | _BV(WDE);
+ #endif
+#else //then it must be one of those newfangled ones that use CCP
+  CCP=0xD8; //so write this magic number to CCP
+#endif 
+
+#ifdef WDTCSR
   WDTCSR = x;
+#else
+  WDTCR= x;
+#endif
 }
 
 void appStart(uint8_t rstFlags) {

+ 82 - 0
optiboot/bootloaders/optiboot/pin_defs.h

@@ -156,6 +156,88 @@
 #endif
 #endif
 
+/*------------------------------------------------------------------------ */
+#if defined(__AVR_ATtiny1634__)
+/*------------------------------------------------------------------------ */
+/* LED is on C0 */
+#if !defined(LED)
+#define LED 	C0
+#endif
+#define TIFR1 TIFR
+
+#ifdef SOFT_UART
+#define UART_PORT   PORTA
+#define UART_PIN    PINA
+#define UART_DDR    DDRA
+#define UART_TX_BIT 2
+#define UART_RX_BIT 3
+#endif
+#endif
+
+
+/*------------------------------------------------------------------------ */
+#if defined(__AVR_ATtiny841__)
+/*------------------------------------------------------------------------ */
+/* LED is on B2 */
+#if !defined(LED)
+#define LED 	B2
+#endif
+
+#ifdef SOFT_UART
+#define UART_PORT   PORTA
+#define UART_PIN    PINA
+#define UART_DDR    DDRA
+#define UART_TX_BIT 2
+#define UART_RX_BIT 3
+#endif
+#endif
+
+/*------------------------------------------------------------------------ */
+#if defined(__AVR_ATtiny167__)
+/*------------------------------------------------------------------------ */
+/* LED is on B2 */
+#if !defined(LED)
+#define LED 	A3
+#endif
+#endif
+
+/*------------------------------------------------------------------------ */
+#if defined(__AVR_ATtiny87__)
+/*------------------------------------------------------------------------ */
+/* LED is on B2 */
+#if !defined(LED)
+#define LED 	A3
+#endif
+#endif
+
+
+/*------------------------------------------------------------------------ */
+#if defined(__AVR_ATtiny828__)
+/*------------------------------------------------------------------------ */
+/* LED is on B2 */
+#if !defined(LED)
+#define LED 	B0
+#endif
+
+#define UDRE0 UDRE 
+#define FE0 FE 
+#define RXC0 RXC
+#define UCSZ00 UCSZ0
+#define UCSZ01 UCSZ1 
+#define TXEN0 TXEN
+#define RXEN0 RXEN
+#define U2X0 U2X
+
+
+#ifdef SOFT_UART
+#define UART_PORT   PORTA
+#define UART_PIN    PINA
+#define UART_DDR    DDRA
+#define UART_TX_BIT 2
+#define UART_RX_BIT 3
+#endif
+#endif
+
 /*
  * ------------------------------------------------------------------------
  * A bunch of macros to enable the LED to be specifed as "B5" for bit 5