From: Osamu Aoki Date: Sun, 5 Dec 2021 03:15:08 +0000 (+0900) Subject: Correct MCU/Board relationship X-Git-Url: http://git.linex4red.de/pub/lufa.git/commitdiff_plain/ba7c69af865ebfbd04a6764379040d7a37b6dc28 Correct MCU/Board relationship https://www.pjrc.com/teensy/jump_to_bootloader.html (2021/Dec) Each board has a different beginning address for the bootloader. Original bootloaders for Teensy 2 comes with a proprietary 512 Byte HID bootloader called halfkey. So the address needs to be adjusted for bigger LUFA bootloaders. For free 512 Byte bootloaders for ATMEGA32U4, see: * https://github.com/volium/nanoBoot (original) * https://github.com/osamuaoki/nanoBoot (LED mod, me) * https://github.com/sigprof/nanoBoot (Mac mod) (I have no information on other original bootloaders) PJRC site lists: Model Chip Jump Address Estimated max bootloader size (byte address) Teensy 1.0 AT90USB162 0x3E00 ( 512 Byte max) Teensy++ 1.0 AT90USB646 0xFC00 (2048 Byte max) Teensy 2.0 ATMEGA32U4 0x7E00 ( 512 Byte max) Teensy++ 2.0 AT90USB1286 0x1FC00 (2048 Byte max) LED pins are always at D6 but its polarity changed from Teensy/Teensy++ to Teensy2/Teensy2++. https://www.pjrc.com/teensy/prescaler.html All use F_CPU = 16000000 Signed-off-by: Osamu Aoki --- diff --git a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c index f29dc81fc..fbd9f942f 100644 --- a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c +++ b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c @@ -1118,6 +1118,8 @@ static const struct { // Add duplicates that match friendly Teensy Names // Match board names in boards.txt + {"TEENSY", 15872, 128}, + {"TEENSYPP", 64512, 256}, {"TEENSY2", 32256, 128}, {"TEENSY2PP", 130048, 256}, {"TEENSYLC", 63488, 512}, diff --git a/BuildTests/BoardDriverTest/BoardDeviceMap.cfg b/BuildTests/BoardDriverTest/BoardDeviceMap.cfg index 94324f301..2100ed27a 100644 --- a/BuildTests/BoardDriverTest/BoardDeviceMap.cfg +++ b/BuildTests/BoardDriverTest/BoardDeviceMap.cfg @@ -56,7 +56,9 @@ BOARD_SPARKFUN8U2 = AVR8 : atmega8u2 : BOARD_STK525 = AVR8 : at90usb647 : BOARD_STK526 = AVR8 : at90usb162 : BOARD_TEENSY = AVR8 : at90usb162 : -BOARD_TEENSY2 = AVR8 : at90usb646 : +BOARD_TEENSYPP = AVR8 : at90usb646 : +BOARD_TEENSY2 = AVR8 : atmega32u4 : +BOARD_TEENSY2PP = AVR8 : at90usb1286 : BOARD_TUL = AVR8 : atmega32u4 : BOARD_UDIP = AVR8 : atmega32u2 : BOARD_UNO = AVR8 : atmega8u2 : diff --git a/LUFA/Common/BoardTypes.h b/LUFA/Common/BoardTypes.h index eb24296c0..c641438e0 100644 --- a/LUFA/Common/BoardTypes.h +++ b/LUFA/Common/BoardTypes.h @@ -246,6 +246,13 @@ /** Selects the Atmel Xplained-MINI specific board drivers, including the driver for the board LEDs. */ #define BOARD_XPLAINED_MINI 60 + /** Selects the Teensy version 1.x ++ specific board drivers, including the driver for the board LEDs. */ + #define BOARD_TEENSYPP 61 + + /** Selects the Teensy version 2.x ++ specific board drivers, including the driver for the board LEDs. */ + #define BOARD_TEENSY2PP 62 + + #if !defined(__DOXYGEN__) #define BOARD_ BOARD_NONE diff --git a/LUFA/Drivers/Board/AVR8/TEENSY/Board.h b/LUFA/Drivers/Board/AVR8/TEENSY/Board.h index 2e0a68d62..e93080ad8 100644 --- a/LUFA/Drivers/Board/AVR8/TEENSY/Board.h +++ b/LUFA/Drivers/Board/AVR8/TEENSY/Board.h @@ -37,6 +37,13 @@ */ /** \ingroup Group_BoardInfo + * \defgroup Group_BoardInfo_TEENSY2 TEENSY2PP + * \brief Board specific information header for the PJRC Teensy 2 ++ boards. + * + * See \ref Group_BoardInfo_TEENSY for more details. + */ + +/** \ingroup Group_BoardInfo * \defgroup Group_BoardInfo_TEENSY2 TEENSY2 * \brief Board specific information header for the PJRC Teensy 2 boards. * @@ -44,10 +51,17 @@ */ /** \ingroup Group_BoardInfo + * \defgroup Group_BoardInfo_TEENSY TEENSYPP + * \brief Board specific information header for the PJRC Teensy 1 ++ boards. + * + * See \ref Group_BoardInfo_TEENSY for more details. + */ + +/** \ingroup Group_BoardInfo * \defgroup Group_BoardInfo_TEENSY TEENSY - * \brief Board specific information header for the PJRC Teensy 1.x/2.x boards. + * \brief Board specific information header for the PJRC Teensy 1 boards. * - * Board specific information header for the PJRC Teensy boards (http://www.pjrc.com/teensy/index.html). + * Board specific information header for the PJRC Teensy 1, 1++, 2, 2 ++ boards (http://www.pjrc.com/teensy/index.html). * * @{ */ diff --git a/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h b/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h index f465a83ad..19d4d718e 100644 --- a/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h @@ -37,6 +37,13 @@ */ /** \ingroup Group_LEDs + * \defgroup Group_LEDs_TEENSY2PP TEENSY2PP + * \brief Board specific LED driver header for the PJRC Teensy 2 ++ boards. + * + * See \ref Group_LEDs_TEENSY for more details. + */ + +/** \ingroup Group_LEDs * \defgroup Group_LEDs_TEENSY2 TEENSY2 * \brief Board specific LED driver header for the PJRC Teensy 2 boards. * @@ -44,20 +51,33 @@ */ /** \ingroup Group_LEDs + * \defgroup Group_LEDs_TEENSYPP TEENSYPP + * \brief Board specific LED driver header for the PJRC Teensy 1 ++ boards. + * + * See \ref Group_LEDs_TEENSY for more details. + */ + +/** \ingroup Group_LEDs * \defgroup Group_LEDs_TEENSY TEENSY * \brief Board specific LED driver header for the PJRC Teensy 1.x/2.x boards. * + * \note For version 2 ++ Teensy boards, compile with BOARD = TEENSY2PP. + * * \note For version 2 Teensy boards, compile with BOARD = TEENSY2. * + * \note For version 1 ++ Teensy boards, compile with BOARD = TEENSYPP. + * + * \note For version 1 Teensy boards, compile with BOARD = TEENSY. + * * Board specific LED driver header for the PJRC Teensy boards (http://www.pjrc.com/teensy/index.html). * - * TEENSY: + * TEENSY, TEENSYPP: * * * *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.6
* - * TEENSY2: + * TEENSY2, TEENSY2PP: * * * @@ -99,7 +119,7 @@ { DDRD |= LEDS_ALL_LEDS; - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) PORTD &= ~LEDS_ALL_LEDS; #else PORTD |= LEDS_ALL_LEDS; @@ -114,7 +134,7 @@ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) { - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) PORTD |= LEDMask; #else PORTD &= ~LEDMask; @@ -123,7 +143,7 @@ static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) { - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) PORTD &= ~LEDMask; #else PORTD |= LEDMask; @@ -132,7 +152,7 @@ static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) { - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); #else PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); @@ -142,7 +162,7 @@ static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) { - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) PORTD = ((PORTD & ~LEDMask) | ActiveMask); #else PORTD = ((PORTD | LEDMask) & ~ActiveMask); @@ -157,7 +177,7 @@ static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t LEDs_GetLEDs(void) { - #if (BOARD == BOARD_TEENSY2) + #if (BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP) return (PORTD & LEDS_ALL_LEDS); #else return (~PORTD & LEDS_ALL_LEDS); diff --git a/LUFA/Drivers/Board/Board.h b/LUFA/Drivers/Board/Board.h index 457bfbf0d..fc6c3f2d3 100644 --- a/LUFA/Drivers/Board/Board.h +++ b/LUFA/Drivers/Board/Board.h @@ -79,7 +79,8 @@ #include "AVR8/BUMBLEB/Board.h" #elif (BOARD == BOARD_EVK527) #include "AVR8/EVK527/Board.h" - #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSY2)) + #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSYPP)) || \ + ((BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP)) #include "AVR8/TEENSY/Board.h" #elif (BOARD == BOARD_USBTINYMKII) #include "AVR8/USBTINYMKII/Board.h" diff --git a/LUFA/Drivers/Board/LEDs.h b/LUFA/Drivers/Board/LEDs.h index db34e68da..5e56a6e39 100644 --- a/LUFA/Drivers/Board/LEDs.h +++ b/LUFA/Drivers/Board/LEDs.h @@ -132,7 +132,8 @@ #include "AVR8/BUMBLEB/LEDs.h" #elif (BOARD == BOARD_EVK527) #include "AVR8/EVK527/LEDs.h" - #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSY2)) + #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSYPP)) || \ + ((BOARD == BOARD_TEENSY2) || (BOARD == BOARD_TEENSY2PP)) #include "AVR8/TEENSY/LEDs.h" #elif (BOARD == BOARD_USBTINYMKII) #include "AVR8/USBTINYMKII/LEDs.h"
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTD.6