diff options
Diffstat (limited to 'Bootloaders/TeensyHID')
-rw-r--r-- | Bootloaders/TeensyHID/Descriptors.h | 2 | ||||
-rw-r--r-- | Bootloaders/TeensyHID/TeensyHID.c | 21 | ||||
-rw-r--r-- | Bootloaders/TeensyHID/TeensyHID.txt | 6 | ||||
-rw-r--r-- | Bootloaders/TeensyHID/makefile | 2 |
4 files changed, 18 insertions, 13 deletions
diff --git a/Bootloaders/TeensyHID/Descriptors.h b/Bootloaders/TeensyHID/Descriptors.h index 37a2b644e..f72dec251 100644 --- a/Bootloaders/TeensyHID/Descriptors.h +++ b/Bootloaders/TeensyHID/Descriptors.h @@ -93,7 +93,7 @@ /** Vendor usage page for the Teensy 2.0 board */
#define TEENSY_USAGEPAGE_20 0x1B
- /** Vendor usage page for the Teensy++ 1.0 board */
+ /** Vendor usage page for the Teensy++ 2.0 board */
#define TEENSY_USAGEPAGE_20PP 0x1C
#if defined(USB_SERIES_2_AVR)
diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c index b93be6d18..ff28927b4 100644 --- a/Bootloaders/TeensyHID/TeensyHID.c +++ b/Bootloaders/TeensyHID/TeensyHID.c @@ -105,18 +105,24 @@ void EVENT_USB_Device_UnhandledControlRequest(void) /* Wait until the command has been sent by the host */
while (!(Endpoint_IsOUTReceived()));
- /* Read in the write destination address */
- uint16_t PageAddress = Endpoint_Read_Word_LE();
+ /* Read in the write destination index */
+ uint16_t PageIndex = Endpoint_Read_Word_LE();
/* Check if the command is a program page command, or a start application command */
- if (PageAddress == TEENSY_STARTAPPLICATION)
+ if (PageIndex == TEENSY_STARTAPPLICATION)
{
RunBootloader = false;
}
else
{
+ #if (SPM_PAGESIZE == 128)
+ uint16_t PageByteAddress = PageIndex;
+ #else
+ uint32_t PageByteAddress = ((uint32_t)PageIndex << 8);
+ #endif
+
/* Erase the given FLASH page, ready to be programmed */
- boot_page_erase(PageAddress);
+ boot_page_erase(PageByteAddress);
boot_spm_busy_wait();
/* Write each of the FLASH page's bytes in sequence */
@@ -134,15 +140,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void) }
/* Write the next data word to the FLASH page */
- boot_page_fill(PageAddress + PageByte, Endpoint_Read_Word_LE());
+ boot_page_fill(PageByteAddress + PageByte, Endpoint_Read_Word_LE());
}
/* Write the filled FLASH page to memory */
- boot_page_write(PageAddress);
+ boot_page_write(PageByteAddress);
boot_spm_busy_wait();
-
- /* Re-enable RWW section */
- boot_rww_enable();
}
Endpoint_ClearOUT();
diff --git a/Bootloaders/TeensyHID/TeensyHID.txt b/Bootloaders/TeensyHID/TeensyHID.txt index 9dac8f5d0..1034c1c49 100644 --- a/Bootloaders/TeensyHID/TeensyHID.txt +++ b/Bootloaders/TeensyHID/TeensyHID.txt @@ -13,7 +13,7 @@ * - AT90USB162 (Teensy 1.0)
* - AT90USB646 (Teensy++ 1.0)
* - ATMEGA32U4 (Teensy 2.0)
- * - AT90USB1287 (Teensy++ 2.0)
+ * - AT90USB1286 (Teensy++ 2.0)
*
* \section SSec_Info USB Information:
*
@@ -51,7 +51,9 @@ *
* Out of the box this bootloader builds for the ATMEGA32U4, and will fit into 2-4KB of bootloader space. For other
* devices, the makefile will need to be updated to reflect the altered MCU model and bootloader start address. When
- * calculating the bootloader start address, use (TARGET_FLASH_SIZE_BYTES - 4096).
+ * calculating the bootloader start address, use (TARGET_FLASH_SIZE_BYTES - 4096) for targets where the bootloader
+ * compiles larger than 2KB, or (TARGET_FLASH_SIZE_BYTES - 2048) for smaller targets where the bootloader compiles
+ * under 2KB.
*
* This spoofs (with permission) the official Teensy bootloader's VID and PID, so that the software remains
* compatible with no changes.
diff --git a/Bootloaders/TeensyHID/makefile b/Bootloaders/TeensyHID/makefile index 404b55f9c..9a9f5ff0d 100644 --- a/Bootloaders/TeensyHID/makefile +++ b/Bootloaders/TeensyHID/makefile @@ -68,7 +68,7 @@ BOARD = # does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
-F_CPU = 16000000
+F_CPU = 8000000
# Input clock frequency.
|