Skip to content

Commit

Permalink
Add tiny-2 chips, and some missing tiny-0 and tiny-1.
Browse files Browse the repository at this point in the history
See #347
Add a hint to the non-mega0 Makefile about using Makefile.mega0
  • Loading branch information
WestfW committed Jul 19, 2022
1 parent 1ab443c commit 45d4c1a
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 31 deletions.
3 changes: 3 additions & 0 deletions optiboot/bootloaders/optiboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,6 @@ clean_asm:

help:
@echo -e $(HELPTEXT)

.DEFAULT:
@echo No target named \"$<\": Maybe you need \"-f Makefile.mega0\"?
4 changes: 2 additions & 2 deletions optiboot/bootloaders/optiboot/Makefile.mega0
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ atmega%:
attiny%:
$(MAKE) -f $(MF) optiboot_attiny$*.hex

HELPTEXT += "target optiboot_*.hex - Any approriate mega-0, tiny-0, or tiny-1\n"
HELPTEXT += " ie: optiboot_atmega4809\n"
HELPTEXT += "target *.hex - Any approriate mega-0, tiny-0,1 or 2\n"
HELPTEXT += " ie: atmega4809\n"
HELPTEXT += "target drazzy402,412 - Dr Azzy's 8pin dev boards.\n"
drazzy%2:
$(MAKE) -f $(MF) optiboot_attiny$*2.hex UARTTX=A1 TIMEOUT=8 LED=A7
Expand Down
24 changes: 23 additions & 1 deletion optiboot/bootloaders/optiboot/parse_options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ endif
dummy = FORCE
endif

ifdef NODATE
ifneq ($(NODATE),0)
VERSION_CMD = -DPRODUCTION=1
endif
dummy = FORCE
endif


# Build Options

Expand Down Expand Up @@ -142,11 +149,26 @@ endif

HELPTEXT += "Option AVR_FREQ=<n> - Clock rate of AVR CPU\n"

HELPTEXT += "Option BOOT_ON_POR - Run bootloader on power-on\n"
ifdef NO_START_APP_ON_POR
ifneq ($(NO_START_APP_ON_POR),0)
POR_CMD = -DNO_START_APP_ON_POR=1
dummy = FORCE
endif
endif

ifdef BOOT_ON_POR
ifneq ($(NO_START_APP_ON_POR),0)
POR_CMD = -DNO_START_APP_ON_POR=1
dummy = FORCE
endif
endif


LED_OPTIONS = $(LED_START_FLASHES_CMD) $(LED_DATA_FLASH_CMD) $(LED_CMD) $(LED_START_ON_CMD) $(LEDINV_CMD)
CPU_OPTIONS = $(RESETPIN_CMD) $(TIMEOUT_CMD) $(FCPU_CMD)
COMMON_OPTIONS = $(BIGBOOT_CMD) $(APPSPM_CMD) $(VERSION_CMD)
COMMON_OPTIONS += $(SUPPORT_EEPROM_CMD)
COMMON_OPTIONS += $(SUPPORT_EEPROM_CMD) $(POR_CMD)

#UART is handled separately and only passed for devices with more than one.
HELPTEXT += "Option UART=n - use UARTn for communications\n"
Expand Down
111 changes: 83 additions & 28 deletions optiboot/bootloaders/optiboot/pin_defs_x.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,37 +785,92 @@
* The 14, 20, and 24pin packages all conveniently have the UART on the
* same port pins, and the same pinmux structure!
*/
#if defined(__AVR_ATtiny1614__) || defined(__AVR_ATtiny1604__) || \
defined(__AVR_ATtiny814__) || defined(__AVR_ATtiny804__) || \
defined(__AVR_ATtiny1606__) || defined(__AVR_ATtiny806__) || \
defined(__AVR_ATtiny406__) || defined(__AVR_ATtiny3216__) || \
defined(__AVR_ATtiny816__) || defined(__AVR_ATtiny416__) || \
defined(__AVR_ATtiny1617__) || defined(__AVR_ATtiny3217__) || \
defined(__AVR_ATtiny1607__) || defined(__AVR_ATtiny817__)
#define MYPMUX_REG PORTMUX.CTRLB
#if /* 24pin: xxx7 */ \
defined(__AVR_ATtiny3217__) /* 3207 doesn't exist */ || \
defined(__AVR_ATtiny1617__) || defined(__AVR_ATtiny1607__) || \
defined(__AVR_ATtiny817__) || defined(__AVR_ATtiny807__) || \
defined(__AVR_ATtiny417__) /* 407 doesn't exist */ || \
/* 20 pin: xxx6 */ \
defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3206__) || \
defined(__AVR_ATtiny1616__) || defined(__AVR_ATtiny1606__) || \
defined(__AVR_ATtiny816__) || defined(__AVR_ATtiny806__) || \
defined(__AVR_ATtiny416__) || defined(__AVR_ATtiny406__) || \
/* 14 pin: xxx4 */ \
defined(__AVR_ATtiny1614__) || defined(__AVR_ATtiny1604__) || \
defined(__AVR_ATtiny814__) || defined(__AVR_ATtiny804__) || \
defined(__AVR_ATtiny414__) || defined(__AVR_ATtiny404__)

# define MYPMUX_REG PORTMUX.CTRLB
# if (UARTTX == B2)
# define UART_NAME "B2"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTB
# define MYUART_TXPIN (1<<PORT2)
# define MYUART_PMUX_VAL 0
# define UART_NAME "B2"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTB
# define MYUART_TXPIN (1<<PORT2)
# define MYUART_PMUX_VAL 0
# elif (UARTTX == A1)
# define UART_NAME "A1"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTA
# define MYUART_TXPIN (1<<PORT1)
# define MYUART_PMUX_VAL (USART_ALTPMUX)
# define UART_NAME "A1"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTA
# define MYUART_TXPIN (1<<PORT1)
# define MYUART_PMUX_VAL (USART_ALTPMUX)
# else
# pragma GCC diagnostic warning "-Wfatal-errors"
# pragma GCC error "Invalid UARTTX pin for chip"
# endif
#endif
# pragma GCC diagnostic warning "-Wfatal-errors"
# pragma GCC error "Invalid UARTTX pin for chip"
# endif /* UARTTX == */
#endif /* ifdef tiny0s, tiny1s */


/*
* 14, 20, and 24 pin Tiny-2
* The 14, 20, and 24pin packages all conveniently have the UART on the
* same port pins, and the same pinmux structure!
*/

#if /* 24pin: xxx7 */ \
defined(__AVR_ATtiny3227__) || defined(__AVR_ATtiny1627__) || \
defined(__AVR_ATtiny827__) || defined(__AVR_ATtiny427__) || \
/* 20 pin: xxx6 */ \
defined(__AVR_ATtiny3226__) || defined(__AVR_ATtiny1626__) || \
defined(__AVR_ATtiny826__) || defined(__AVR_ATtiny426__) || \
/* 14 pin: xxx4 */ \
defined(__AVR_ATtiny3224__) || defined(__AVR_ATtiny1624__) || \
defined(__AVR_ATtiny824__) || defined(__AVR_ATtiny424__)
# define MYPMUX_REG PORTMUX.USARTROUTEA
# if (UARTTX == B2)
# define UART_NAME "B2"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTB
# define MYUART_TXPIN (1 << PORT2)
# define MYUART_PMUX_VAL 0
# elif (UARTTX == A1)
# define UART_NAME "A1"
# ifndef USART0
# error Pin on USART0, but no USART0 exists
# endif
# define MYUART USART0
# define MYUART_TXPORT VPORTA
# define MYUART_TXPIN (1 << PORT1)
# define MYUART_PMUX_VAL (USART_ALTPMUX)
# elif (UARTTX == C2)
# define UART_NAME "C2"
# ifndef USART1
# error Pin on USART1, but no USART1 exists
# endif
# define MYUART USART1
# define MYUART_TXPORT VPORTC
# define MYUART_TXPIN (1 << PORT2)
# define MYUART_PMUX_VAL (USART_ALTPMUX << 2)
# endif /* UARTTX == chain */
#endif /* ifdef tiny2s */

#ifndef MYUART
# warning No UARTTX pin specified.
Expand Down

0 comments on commit 45d4c1a

Please sign in to comment.