Compare commits
279 Commits
LUFA-13090
...
LUFA-17041
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a854652992 | ||
|
|
0b9b632926 | ||
|
|
4ad929f19d | ||
|
|
f0c5dfe8b8 | ||
|
|
0b95817130 | ||
|
|
f92cc29e3a | ||
|
|
da5ca91756 | ||
|
|
d1862656bb | ||
|
|
fd50862e4e | ||
|
|
39aa928de1 | ||
|
|
75f367897d | ||
|
|
477326edc6 | ||
|
|
66db760a33 | ||
|
|
def392aca0 | ||
|
|
0f470dc8b4 | ||
|
|
fe1c241ff7 | ||
|
|
738ded0f02 | ||
|
|
7e97be22a3 | ||
|
|
49148fef9b | ||
|
|
3126cbbf96 | ||
|
|
75b68126d0 | ||
|
|
e3ff551659 | ||
|
|
0ecd09c3e1 | ||
|
|
51d3adfe18 | ||
|
|
3069b7d9d2 | ||
|
|
9cca7a594f | ||
|
|
9669a00c34 | ||
|
|
0c9856f405 | ||
|
|
df16148a02 | ||
|
|
f7cdc82369 | ||
|
|
f52566d6db | ||
|
|
1d2369e9be | ||
|
|
cfe2b9eff1 | ||
|
|
6b0c46af6e | ||
|
|
1e05d46b66 | ||
|
|
78478be260 | ||
|
|
0afb548b51 | ||
|
|
9864c02eb4 | ||
|
|
25b2027544 | ||
|
|
a86b502294 | ||
|
|
d0161e0a9b | ||
|
|
dfdf4de8fa | ||
|
|
0b69eeaf5d | ||
|
|
59b9cf8d0f | ||
|
|
dd09a833d9 | ||
|
|
593dd3dd55 | ||
|
|
2fcd50ada8 | ||
|
|
09b6c80555 | ||
|
|
b590350df0 | ||
|
|
e952f681db | ||
|
|
231658362e | ||
|
|
40e1caa2da | ||
|
|
92e9cb71e2 | ||
|
|
f42a4f3a47 | ||
|
|
9ec72190b9 | ||
|
|
400d3581ca | ||
|
|
b95848ab36 | ||
|
|
3642ea0b97 | ||
|
|
6b06bc6237 | ||
|
|
4afebc8b70 | ||
|
|
c9db3f0aa9 | ||
|
|
f2af532481 | ||
|
|
903fa4a500 | ||
|
|
8a483fde0b | ||
|
|
13c2d91d27 | ||
|
|
f381d71d72 | ||
|
|
07e521db92 | ||
|
|
1914573cd4 | ||
|
|
8f33ba8237 | ||
|
|
5d674dddfa | ||
|
|
7a32e96f2b | ||
|
|
b061f8d241 | ||
|
|
9ef4196863 | ||
|
|
2fa6cbdb10 | ||
|
|
815a29c7b2 | ||
|
|
b0c64393c7 | ||
|
|
a9f34b5803 | ||
|
|
43d993e1f6 | ||
|
|
55adec1f4f | ||
|
|
7638128d47 | ||
|
|
23ada65625 | ||
|
|
56ef2b192c | ||
|
|
e10b5ffe94 | ||
|
|
0626ac1f63 | ||
|
|
7c9c3d15e0 | ||
|
|
617763ae20 | ||
|
|
d30294936d | ||
|
|
a52ca7007d | ||
|
|
ed20c250af | ||
|
|
8fb0b4905a | ||
|
|
1d2680b358 | ||
|
|
366a846156 | ||
|
|
a9364a866f | ||
|
|
9efce7263c | ||
|
|
faf41c4445 | ||
|
|
be2df78637 | ||
|
|
4dbe0176ba | ||
|
|
4d31a05d62 | ||
|
|
bf3a95d5a7 | ||
|
|
05fe6ab871 | ||
|
|
b504397d94 | ||
|
|
599c84ef26 | ||
|
|
64ef5396a5 | ||
|
|
4185d21fcd | ||
|
|
fd39bcf72b | ||
|
|
e3988f19dd | ||
|
|
017d0d8f91 | ||
|
|
6e5df9e4be | ||
|
|
31f4260705 | ||
|
|
0c3cc14006 | ||
|
|
e37e86583c | ||
|
|
99ca3aff38 | ||
|
|
250feb29cf | ||
|
|
2358d7dcac | ||
|
|
2304a73050 | ||
|
|
a09cb7e3d8 | ||
|
|
4c637c93ba | ||
|
|
fef991e28b | ||
|
|
df366e055d | ||
|
|
17158b359f | ||
|
|
def7fca736 | ||
|
|
f2993bd6de | ||
|
|
2d00107efe | ||
|
|
77829096ad | ||
|
|
5df2027e79 | ||
|
|
41634c4530 | ||
|
|
6c8ebd70c7 | ||
|
|
025e57bd72 | ||
|
|
70f7e6558c | ||
|
|
c69a623652 | ||
|
|
5e4b14f007 | ||
|
|
7046ebb37b | ||
|
|
7dc746c2c1 | ||
|
|
b62c68810d | ||
|
|
7423c1213f | ||
|
|
3692325f58 | ||
|
|
b73cec0876 | ||
|
|
b1603ba06e | ||
|
|
2f4b2e6f34 | ||
|
|
4d8ff75993 | ||
|
|
0091b3c819 | ||
|
|
5f75c592e0 | ||
|
|
0e68abcd4f | ||
|
|
2db71bc8a4 | ||
|
|
d0a147f5bb | ||
|
|
0fd7b2cf09 | ||
|
|
0ae0b1995f | ||
|
|
a52dc06e62 | ||
|
|
4cc04eec01 | ||
|
|
f6fe9db8ba | ||
|
|
b6899bb987 | ||
|
|
4c06a9c88f | ||
|
|
89df1efcf3 | ||
|
|
c499a0b755 | ||
|
|
526091fba4 | ||
|
|
0c15a45128 | ||
|
|
d90ef9aa2f | ||
|
|
3d818fbb86 | ||
|
|
0c00c2aaa3 | ||
|
|
2812287488 | ||
|
|
ffb5f7e3b3 | ||
|
|
b8f7dae24c | ||
|
|
910c6eb599 | ||
|
|
22b3970338 | ||
|
|
1b93c85b20 | ||
|
|
f63496a117 | ||
|
|
c4e85215bf | ||
|
|
7768935889 | ||
|
|
7ad97a3d5d | ||
|
|
57ef7a79b4 | ||
|
|
45f0971da5 | ||
|
|
c0e32775f3 | ||
|
|
a532f2ad1b | ||
|
|
d8f36aa7a8 | ||
|
|
261284f5e1 | ||
|
|
00ddff45c1 | ||
|
|
b6c18b2a7c | ||
|
|
a80d0c9965 | ||
|
|
fa32989f2e | ||
|
|
aaef4fa84c | ||
|
|
9dc7e68d76 | ||
|
|
2141155e9e | ||
|
|
c49d4af449 | ||
|
|
987cd32f65 | ||
|
|
b095177e20 | ||
|
|
c5282637ed | ||
|
|
0d84b65f0b | ||
|
|
5789767889 | ||
|
|
32c5c43bf0 | ||
|
|
8328175482 | ||
|
|
deb1675f84 | ||
|
|
28cadf077e | ||
|
|
2e70de6194 | ||
|
|
812114d9c1 | ||
|
|
129824028b | ||
|
|
92006938d3 | ||
|
|
0f6c155a04 | ||
|
|
161263af47 | ||
|
|
5cae541545 | ||
|
|
e368a89987 | ||
|
|
510d29d472 | ||
|
|
ef16683b42 | ||
|
|
6e0baf4342 | ||
|
|
ccbba9bfe5 | ||
|
|
92d1d0342b | ||
|
|
123b5bc47b | ||
|
|
4c25f212c3 | ||
|
|
af893c3df6 | ||
|
|
31022dfbe9 | ||
|
|
1cd0f66347 | ||
|
|
d8f0d2709b | ||
|
|
9965b2ca0a | ||
|
|
25a02432e7 | ||
|
|
a359a266df | ||
|
|
70a726b5aa | ||
|
|
e3cb0f48ef | ||
|
|
52c69331ec | ||
|
|
52a5016576 | ||
|
|
8edd561948 | ||
|
|
32013ebffb | ||
|
|
6eba84bf4b | ||
|
|
16c4f1d43c | ||
|
|
4b6049bb59 | ||
|
|
d251ef6bed | ||
|
|
9d6303cead | ||
|
|
90c7491e51 | ||
|
|
d2eaf94dbb | ||
|
|
6b214472b7 | ||
|
|
d31e0a4d37 | ||
|
|
bcd07f4f8a | ||
|
|
94323fadd1 | ||
|
|
b7b6f212e9 | ||
|
|
14e44b626f | ||
|
|
814d0b9098 | ||
|
|
85141b37f9 | ||
|
|
560e5f75fb | ||
|
|
e1b19e4e10 | ||
|
|
13b3014db4 | ||
|
|
3fc75f130b | ||
|
|
cf41d16bc7 | ||
|
|
e7a8fd6033 | ||
|
|
cb10891bd6 | ||
|
|
7024bb4c79 | ||
|
|
352152c664 | ||
|
|
ab238601b9 | ||
|
|
7ce4d35c39 | ||
|
|
9ef29ea229 | ||
|
|
8e2476a125 | ||
|
|
8026bee8d6 | ||
|
|
b6bf314d50 | ||
|
|
ef1a4b750b | ||
|
|
c41512c1e8 | ||
|
|
75419b4d97 | ||
|
|
cd3aae87da | ||
|
|
d6be06ea6a | ||
|
|
716f356b21 | ||
|
|
b229aef6f7 | ||
|
|
012c565609 | ||
|
|
dbad27dd6d | ||
|
|
53f7499009 | ||
|
|
96f2634770 | ||
|
|
c18283a275 | ||
|
|
14ba7a7047 | ||
|
|
adb61c7b29 | ||
|
|
2ba22d5571 | ||
|
|
a8d907d704 | ||
|
|
6216a71e1c | ||
|
|
ce546b43cc | ||
|
|
af0adbcb36 | ||
|
|
e5bee74fca | ||
|
|
8cd0b383c5 | ||
|
|
fbe2982858 | ||
|
|
aded8373cc | ||
|
|
44bc433fb0 | ||
|
|
46621b7a11 | ||
|
|
41046f2354 | ||
|
|
179e18cf58 | ||
|
|
cba09e323d | ||
|
|
03ce1bc503 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,5 +9,7 @@
|
||||
*.map
|
||||
*.bak
|
||||
*.class
|
||||
Documentation/
|
||||
LUFA/StudioIntegration/ProjectGenerator/*
|
||||
LUFA/StudioIntegration/DocBook/*
|
||||
!LUFA/StudioIntegration/Docbook/mshelp/*
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <LUFA/Common/Common.h>
|
||||
|
||||
#include "Config/AppConfig.h"
|
||||
|
||||
|
||||
/* Function Prototypes: */
|
||||
void BootloaderAPI_ErasePage(const uint32_t Address);
|
||||
void BootloaderAPI_WritePage(const uint32_t Address);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -72,7 +72,17 @@ void Application_Jump_Check(void)
|
||||
{
|
||||
bool JumpToApplication = false;
|
||||
|
||||
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
|
||||
#if (BOARD == BOARD_LEONARDO)
|
||||
/* Enable pull-up on the IO13 pin so we can use it to select the mode */
|
||||
PORTC |= (1 << 7);
|
||||
Delay_MS(10);
|
||||
|
||||
/* If IO13 is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication = ((PINC & (1 << 7)) != 0);
|
||||
|
||||
/* Disable pull-up after the check has completed */
|
||||
PORTC &= ~(1 << 7);
|
||||
#elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
|
||||
/* Disable JTAG debugging */
|
||||
JTAG_DISABLE();
|
||||
|
||||
@@ -81,21 +91,41 @@ void Application_Jump_Check(void)
|
||||
Delay_MS(10);
|
||||
|
||||
/* If the TCK pin is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication |= ((PINF & (1 << 4)) != 0);
|
||||
JumpToApplication = ((PINF & (1 << 4)) != 0);
|
||||
|
||||
/* Re-enable JTAG debugging */
|
||||
JTAG_ENABLE();
|
||||
#else
|
||||
/* Check if the device's BOOTRST fuse is set */
|
||||
if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST)
|
||||
{
|
||||
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
|
||||
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << EXTRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application;
|
||||
* this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication |= true;
|
||||
/* Don't run the user application if the reset vector is blank (no app loaded) */
|
||||
bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF);
|
||||
|
||||
/* If a request has been made to jump to the user application, honor it */
|
||||
if (JumpToApplication)
|
||||
if (JumpToApplication && ApplicationValid)
|
||||
{
|
||||
/* Turn off the watchdog */
|
||||
MCUSR &= ~(1<<WDRF);
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Clear the boot key and jump to the user application */
|
||||
@@ -127,6 +157,9 @@ int main(void)
|
||||
USB_USBTask();
|
||||
}
|
||||
|
||||
/* Wait a short time to end all USB transactions and then disconnect */
|
||||
_delay_us(1000);
|
||||
|
||||
/* Disconnect from the host - USB interface will be reset later along with the AVR */
|
||||
USB_Detach();
|
||||
|
||||
@@ -236,9 +269,9 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||
|
||||
#if !defined(NO_BLOCK_SUPPORT)
|
||||
/** Reads or writes a block of EEPROM or FLASH memory to or from the appropriate CDC data endpoint, depending
|
||||
* on the AVR910 protocol command issued.
|
||||
* on the AVR109 protocol command issued.
|
||||
*
|
||||
* \param[in] Command Single character AVR910 protocol command indicating what memory operation to perform
|
||||
* \param[in] Command Single character AVR109 protocol command indicating what memory operation to perform
|
||||
*/
|
||||
static void ReadWriteMemoryBlock(const uint8_t Command)
|
||||
{
|
||||
@@ -327,7 +360,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
|
||||
else
|
||||
{
|
||||
/* Write the next EEPROM byte from the endpoint */
|
||||
eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
|
||||
eeprom_update_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
|
||||
|
||||
/* Increment the address counter after use */
|
||||
CurrAddress += 2;
|
||||
@@ -402,7 +435,7 @@ static void WriteNextResponseByte(const uint8_t Response)
|
||||
Endpoint_Write_8(Response);
|
||||
}
|
||||
|
||||
/** Task to read in AVR910 commands from the CDC data OUT endpoint, process them, perform the required actions
|
||||
/** Task to read in AVR109 commands from the CDC data OUT endpoint, process them, perform the required actions
|
||||
* and send the appropriate response back to the host.
|
||||
*/
|
||||
static void CDC_Task(void)
|
||||
@@ -581,7 +614,7 @@ static void CDC_Task(void)
|
||||
else if (Command == AVR109_COMMAND_WriteEEPROM)
|
||||
{
|
||||
/* Read the byte from the endpoint and write it to the EEPROM */
|
||||
eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
|
||||
eeprom_update_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
|
||||
|
||||
/* Increment the address after use */
|
||||
CurrAddress += 2;
|
||||
@@ -638,4 +671,3 @@ static void CDC_Task(void)
|
||||
/* Acknowledge the command from the host */
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -54,6 +54,33 @@
|
||||
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
|
||||
* bootloader from the normal user application.
|
||||
*
|
||||
* \warning <b>THIS BOOTLOADER IS NOT SECURE.</b> Malicious entities can recover written data, even if the device
|
||||
* lockbits are set.
|
||||
*
|
||||
* \section Sec_Running Running the Bootloader
|
||||
*
|
||||
* On the USB AVR8 devices, setting the \c HWBE device fuse will cause the bootloader to run if the \c HWB pin of
|
||||
* the AVR is grounded when the device is reset.
|
||||
*
|
||||
* The are two behaviours of this bootloader, depending on the device's fuses:
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is reset from
|
||||
* the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the
|
||||
* device's external reset pin should be grounded momentarily.
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is not set</b>, the bootloader will run only if initiated via a software
|
||||
* jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set).
|
||||
*
|
||||
* For board specific exceptions to the above, see below.
|
||||
*
|
||||
* \subsection SSec_XPLAIN Atmel Xplain Board
|
||||
* Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the
|
||||
* \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \subsection SSec_Leonardo Arduino Leonardo Board
|
||||
* Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the
|
||||
* \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \section Sec_Installation Driver Installation
|
||||
*
|
||||
* After running this bootloader for the first time on a new computer, you will need to supply the .INF
|
||||
@@ -168,6 +195,8 @@
|
||||
* this module to try to take control over inserted CDC devices, corrupting the
|
||||
* datastream. A UDEV rule is required to prevent this.
|
||||
* See <a href=https://groups.google.com/d/msg/lufa-support/CP9cy2bc8yo/kBqsOu-RBeMJ>here</a> for resolution steps.
|
||||
* If the issue still persists then uninstall modemmanager by executing <tt>sudo apt-get remove modemmanager</tt>, or
|
||||
* the equivalent using your chosen distribution's package manager.
|
||||
*
|
||||
* \par On Linux machines, the CDC bootloader is inaccessible.
|
||||
* On many Linux systems, non-root users do not have automatic access to newly
|
||||
@@ -175,12 +204,6 @@
|
||||
* access.
|
||||
* See <a href=https://groups.google.com/d/msg/lufa-support/CP9cy2bc8yo/kBqsOu-RBeMJ>here</a> for resolution steps.
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section Sec_Options Project Options
|
||||
*
|
||||
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -35,7 +35,7 @@
|
||||
* compile time options, as an alternative to the compile time
|
||||
* constants supplied through a makefile.
|
||||
*
|
||||
* For information on what each token does, refer to the
|
||||
* For information on what each token does, refer to the
|
||||
* \ref Sec_Options section of the application documentation.
|
||||
*/
|
||||
|
||||
@@ -47,4 +47,4 @@
|
||||
// #define NO_FLASH_BYTE_SUPPORT
|
||||
// #define NO_LOCK_BYTE_WRITE_SUPPORT
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -46,7 +46,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.USBSpecification = VERSION_BCD(1,1,0),
|
||||
.Class = CDC_CSCP_CDCClass,
|
||||
.SubClass = CDC_CSCP_NoSpecificSubclass,
|
||||
.Protocol = CDC_CSCP_NoSpecificProtocol,
|
||||
@@ -55,7 +55,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x204A,
|
||||
.ReleaseNumber = VERSION_BCD(01.00),
|
||||
.ReleaseNumber = VERSION_BCD(1,0,0),
|
||||
|
||||
.ManufacturerStrIndex = STRING_ID_Manufacturer,
|
||||
.ProductStrIndex = STRING_ID_Product,
|
||||
@@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_CDC_CCI,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
@@ -107,7 +107,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = 0x00,
|
||||
|
||||
.CDCSpecification = VERSION_BCD(01.10),
|
||||
.CDCSpecification = VERSION_BCD(1,1,0),
|
||||
},
|
||||
|
||||
.CDC_Functional_ACM =
|
||||
@@ -123,8 +123,8 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = 0x06,
|
||||
|
||||
.MasterInterfaceNumber = 0,
|
||||
.SlaveInterfaceNumber = 1,
|
||||
.MasterInterfaceNumber = INTERFACE_ID_CDC_CCI,
|
||||
.SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI,
|
||||
},
|
||||
|
||||
.CDC_NotificationEndpoint =
|
||||
@@ -141,7 +141,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 1,
|
||||
.InterfaceNumber = INTERFACE_ID_CDC_DCI,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
@@ -178,34 +178,19 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
|
||||
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
|
||||
*/
|
||||
const USB_Descriptor_String_t LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {LANGUAGE_ID_ENG}
|
||||
};
|
||||
const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
|
||||
|
||||
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
|
||||
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Dean Camera"
|
||||
};
|
||||
const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
|
||||
|
||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
|
||||
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA CDC"
|
||||
};
|
||||
const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA CDC");
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see LUFA library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
@@ -214,7 +199,7 @@ const USB_Descriptor_String_t ProductString =
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -84,7 +84,7 @@
|
||||
#define AVR_SIGNATURE_3 0x89
|
||||
#elif defined(__AVR_AT90USB82__)
|
||||
#define AVR_SIGNATURE_1 0x1E
|
||||
#define AVR_SIGNATURE_2 0x94
|
||||
#define AVR_SIGNATURE_2 0x93
|
||||
#define AVR_SIGNATURE_3 0x82
|
||||
#else
|
||||
#error The selected AVR part is not currently supported by this bootloader.
|
||||
@@ -127,20 +127,30 @@
|
||||
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
|
||||
* should have a unique ID index associated with it, which can be used to refer to the
|
||||
* interface from other descriptors.
|
||||
*/
|
||||
enum InterfaceDescriptors_t
|
||||
{
|
||||
INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */
|
||||
INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */
|
||||
};
|
||||
|
||||
/** Enum for the device string descriptor IDs within the device. Each string descriptor should
|
||||
* have a unique ID index associated with it, which can be used to refer to the string from
|
||||
* other descriptors.
|
||||
*/
|
||||
enum StringDescriptors_t
|
||||
{
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,9 @@
|
||||
; Copyright (c) 2000 Microsoft Corporation
|
||||
;************************************************************
|
||||
|
||||
[DefaultInstall]
|
||||
CopyINF="LUFA CDC Bootloader.inf"
|
||||
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
@@ -60,4 +63,4 @@ HKR,,EnumPropPages32,,"msports.dll,SerialPortPropPageProvider"
|
||||
;------------------------------------------------------------------------------
|
||||
[Strings]
|
||||
MFGNAME="http://www.lufa-lib.org"
|
||||
DESCRIPTION="LUFA CDC Class Bootloader"
|
||||
DESCRIPTION="LUFA CDC Class Bootloader"
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
<build type="header-file" value="Config/LUFAConfig.h"/>
|
||||
<build type="header-file" value="Config/AppConfig.h"/>
|
||||
|
||||
<build type="distribute" subtype="user-file" value="doxyfile"/>
|
||||
<build type="distribute" subtype="user-file" value="BootloaderCDC.txt"/>
|
||||
<build type="distribute" subtype="user-file" value="LUFA CDC Bootloader.inf"/>
|
||||
|
||||
|
||||
2396
Bootloaders/CDC/doxyfile
Normal file
2396
Bootloaders/CDC/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -45,11 +45,18 @@ BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, Boot
|
||||
# Default target
|
||||
all:
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
include $(LUFA_PATH)/Build/lufa_doxygen.mk
|
||||
include $(LUFA_PATH)/Build/lufa_avrdude.mk
|
||||
include $(LUFA_PATH)/Build/lufa_atprogram.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
include $(DMBS_PATH)/doxygen.mk
|
||||
include $(DMBS_PATH)/dfu.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
include $(DMBS_PATH)/hid.mk
|
||||
include $(DMBS_PATH)/avrdude.mk
|
||||
include $(DMBS_PATH)/atprogram.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -108,7 +108,17 @@ void Application_Jump_Check(void)
|
||||
{
|
||||
bool JumpToApplication = false;
|
||||
|
||||
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
|
||||
#if (BOARD == BOARD_LEONARDO)
|
||||
/* Enable pull-up on the IO13 pin so we can use it to select the mode */
|
||||
PORTC |= (1 << 7);
|
||||
Delay_MS(10);
|
||||
|
||||
/* If IO13 is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication = ((PINC & (1 << 7)) != 0);
|
||||
|
||||
/* Disable pull-up after the check has completed */
|
||||
PORTC &= ~(1 << 7);
|
||||
#elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
|
||||
/* Disable JTAG debugging */
|
||||
JTAG_DISABLE();
|
||||
|
||||
@@ -117,21 +127,41 @@ void Application_Jump_Check(void)
|
||||
Delay_MS(10);
|
||||
|
||||
/* If the TCK pin is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication |= ((PINF & (1 << 4)) != 0);
|
||||
JumpToApplication = ((PINF & (1 << 4)) != 0);
|
||||
|
||||
/* Re-enable JTAG debugging */
|
||||
JTAG_ENABLE();
|
||||
#else
|
||||
/* Check if the device's BOOTRST fuse is set */
|
||||
if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST)
|
||||
{
|
||||
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
|
||||
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << EXTRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application;
|
||||
* this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication |= true;
|
||||
/* Don't run the user application if the reset vector is blank (no app loaded) */
|
||||
bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF);
|
||||
|
||||
/* If a request has been made to jump to the user application, honor it */
|
||||
if (JumpToApplication)
|
||||
if (JumpToApplication && ApplicationValid)
|
||||
{
|
||||
/* Turn off the watchdog */
|
||||
MCUSR &= ~(1<<WDRF);
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Clear the boot key and jump to the user application */
|
||||
@@ -370,7 +400,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||
}
|
||||
|
||||
/* Read the byte from the USB interface and write to to the EEPROM */
|
||||
eeprom_write_byte((uint8_t*)StartAddr, Endpoint_Read_8());
|
||||
eeprom_update_byte((uint8_t*)StartAddr, Endpoint_Read_8());
|
||||
|
||||
/* Adjust counters */
|
||||
StartAddr++;
|
||||
@@ -751,8 +781,9 @@ static void ProcessWriteCommand(void)
|
||||
}
|
||||
else // Start via jump
|
||||
{
|
||||
/* Set the flag to terminate the bootloader at next opportunity */
|
||||
RunBootloader = false;
|
||||
/* Set the flag to terminate the bootloader at next opportunity if a valid application has been loaded */
|
||||
if (pgm_read_word_near(0) == 0xFFFF)
|
||||
RunBootloader = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -785,13 +816,44 @@ static void ProcessWriteCommand(void)
|
||||
static void ProcessReadCommand(void)
|
||||
{
|
||||
const uint8_t BootloaderInfo[3] = {BOOTLOADER_VERSION, BOOTLOADER_ID_BYTE1, BOOTLOADER_ID_BYTE2};
|
||||
const uint8_t SignatureInfo[3] = {AVR_SIGNATURE_1, AVR_SIGNATURE_2, AVR_SIGNATURE_3};
|
||||
const uint8_t SignatureInfo[4] = {0x58, AVR_SIGNATURE_1, AVR_SIGNATURE_2, AVR_SIGNATURE_3};
|
||||
|
||||
uint8_t DataIndexToRead = SentCommand.Data[1];
|
||||
uint8_t DataIndexToRead = SentCommand.Data[1];
|
||||
bool ReadAddressInvalid = false;
|
||||
|
||||
if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Read bootloader info
|
||||
ResponseByte = BootloaderInfo[DataIndexToRead];
|
||||
if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Read bootloader info
|
||||
{
|
||||
if (DataIndexToRead < 3)
|
||||
ResponseByte = BootloaderInfo[DataIndexToRead];
|
||||
else
|
||||
ReadAddressInvalid = true;
|
||||
}
|
||||
else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte
|
||||
ResponseByte = SignatureInfo[DataIndexToRead - 0x30];
|
||||
}
|
||||
{
|
||||
switch (DataIndexToRead)
|
||||
{
|
||||
case 0x30:
|
||||
ResponseByte = SignatureInfo[0];
|
||||
break;
|
||||
case 0x31:
|
||||
ResponseByte = SignatureInfo[1];
|
||||
break;
|
||||
case 0x60:
|
||||
ResponseByte = SignatureInfo[2];
|
||||
break;
|
||||
case 0x61:
|
||||
ResponseByte = SignatureInfo[3];
|
||||
break;
|
||||
default:
|
||||
ReadAddressInvalid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ReadAddressInvalid)
|
||||
{
|
||||
/* Set the state and status variables to indicate the error */
|
||||
DFU_State = dfuERROR;
|
||||
DFU_Status = errADDRESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -68,7 +68,7 @@
|
||||
#define BOOTLOADER_VERSION_REV 0
|
||||
|
||||
/** Magic bootloader key to unlock forced application start mode. */
|
||||
#define MAGIC_BOOT_KEY 0xDC42
|
||||
#define MAGIC_BOOT_KEY 0xDC42
|
||||
|
||||
/** Complete bootloader version number expressed as a packed byte, constructed from the
|
||||
* two individual bootloader version macros.
|
||||
@@ -170,7 +170,7 @@
|
||||
dfuMANIFEST = 7,
|
||||
dfuMANIFEST_WAIT_RESET = 8,
|
||||
dfuUPLOAD_IDLE = 9,
|
||||
dfuERROR = 10
|
||||
dfuERROR = 10
|
||||
};
|
||||
|
||||
/** DFU command status error codes. Refer to the DFU class specification for information on each error code. */
|
||||
@@ -191,7 +191,7 @@
|
||||
errUSBR = 12,
|
||||
errPOR = 13,
|
||||
errUNKNOWN = 14,
|
||||
errSTALLEDPKT = 15
|
||||
errSTALLEDPKT = 15
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
||||
@@ -55,6 +55,30 @@
|
||||
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
|
||||
* bootloader from the normal user application.
|
||||
*
|
||||
* \section Sec_Running Running the Bootloader
|
||||
*
|
||||
* On the USB AVR8 devices, setting the \c HWBE device fuse will cause the bootloader to run if the \c HWB pin of
|
||||
* the AVR is grounded when the device is reset.
|
||||
*
|
||||
* The are two behaviours of this bootloader, depending on the device's fuses:
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is reset from
|
||||
* the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the
|
||||
* device's external reset pin should be grounded momentarily.
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is not set</b>, the bootloader will run only if initiated via a software
|
||||
* jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set).
|
||||
*
|
||||
* For board specific exceptions to the above, see below.
|
||||
*
|
||||
* \subsection SSec_XPLAIN Atmel Xplain Board
|
||||
* Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the
|
||||
* \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \subsection SSec_Leonardo Arduino Leonardo Board
|
||||
* Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the
|
||||
* \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \section Sec_Installation Driver Installation
|
||||
*
|
||||
* This bootloader is designed to be compatible with Atmel's provided Windows DFU class drivers. You will need to
|
||||
@@ -189,12 +213,6 @@
|
||||
* access.
|
||||
* See <a href=https://groups.google.com/d/msg/lufa-support/CP9cy2bc8yo/kBqsOu-RBeMJ>here</a> for resolution steps.
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section Sec_Options Project Options
|
||||
*
|
||||
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -33,10 +33,10 @@
|
||||
*
|
||||
* This is a header file which is be used to configure some of
|
||||
* the application's compile time options, as an alternative to
|
||||
* specifying the compile time constants supplied through a
|
||||
* specifying the compile time constants supplied through a
|
||||
* makefile or build system.
|
||||
*
|
||||
* For information on what each token does, refer to the
|
||||
* For information on what each token does, refer to the
|
||||
* \ref Sec_Options section of the application documentation.
|
||||
*/
|
||||
|
||||
@@ -45,4 +45,4 @@
|
||||
|
||||
#define SECURE_MODE false
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -46,7 +46,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.USBSpecification = VERSION_BCD(1,1,0),
|
||||
.Class = USB_CSCP_NoDeviceClass,
|
||||
.SubClass = USB_CSCP_NoDeviceSubclass,
|
||||
.Protocol = USB_CSCP_NoDeviceProtocol,
|
||||
@@ -55,7 +55,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = PRODUCT_ID_CODE,
|
||||
.ReleaseNumber = VERSION_BCD(00.00),
|
||||
.ReleaseNumber = VERSION_BCD(0,0,0),
|
||||
|
||||
.ManufacturerStrIndex = STRING_ID_Manufacturer,
|
||||
.ProductStrIndex = STRING_ID_Product,
|
||||
@@ -90,7 +90,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_DFU,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 0,
|
||||
@@ -111,7 +111,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
.DetachTimeout = 0x0000,
|
||||
.TransferSize = 0x0C00,
|
||||
|
||||
.DFUSpecification = VERSION_BCD(01.10)
|
||||
.DFUSpecification = VERSION_BCD(1,1,0)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,34 +119,19 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
|
||||
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
|
||||
*/
|
||||
const USB_Descriptor_String_t LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {LANGUAGE_ID_ENG}
|
||||
};
|
||||
const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
|
||||
|
||||
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
|
||||
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Dean Camera"
|
||||
};
|
||||
const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
|
||||
|
||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
|
||||
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(8), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA DFU"
|
||||
};
|
||||
const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA DFU");
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
@@ -155,7 +140,7 @@ const USB_Descriptor_String_t ProductString =
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -118,7 +118,7 @@
|
||||
#elif defined(__AVR_AT90USB82__)
|
||||
#define PRODUCT_ID_CODE 0x2FF7
|
||||
#define AVR_SIGNATURE_1 0x1E
|
||||
#define AVR_SIGNATURE_2 0x94
|
||||
#define AVR_SIGNATURE_2 0x93
|
||||
#define AVR_SIGNATURE_3 0x82
|
||||
#else
|
||||
#error The selected AVR part is not currently supported by this bootloader.
|
||||
@@ -164,20 +164,29 @@
|
||||
USB_Descriptor_DFU_Functional_t DFU_Functional;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
|
||||
* should have a unique ID index associated with it, which can be used to refer to the
|
||||
* interface from other descriptors.
|
||||
*/
|
||||
enum InterfaceDescriptors_t
|
||||
{
|
||||
INTERFACE_ID_DFU = 0, /**< DFU interface descriptor ID */
|
||||
};
|
||||
|
||||
/** Enum for the device string descriptor IDs within the device. Each string descriptor should
|
||||
* have a unique ID index associated with it, which can be used to refer to the string from
|
||||
* other descriptors.
|
||||
*/
|
||||
enum StringDescriptors_t
|
||||
{
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -144,6 +144,7 @@
|
||||
<build type="header-file" value="Config/LUFAConfig.h"/>
|
||||
<build type="header-file" value="Config/AppConfig.h"/>
|
||||
|
||||
<build type="distribute" subtype="user-file" value="doxyfile"/>
|
||||
<build type="distribute" subtype="user-file" value="BootloaderDFU.txt"/>
|
||||
|
||||
<require idref="lufa.common"/>
|
||||
|
||||
2396
Bootloaders/DFU/doxyfile
Normal file
2396
Bootloaders/DFU/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -45,11 +45,18 @@ BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, Boot
|
||||
# Default target
|
||||
all:
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
include $(LUFA_PATH)/Build/lufa_doxygen.mk
|
||||
include $(LUFA_PATH)/Build/lufa_avrdude.mk
|
||||
include $(LUFA_PATH)/Build/lufa_atprogram.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
include $(DMBS_PATH)/doxygen.mk
|
||||
include $(DMBS_PATH)/dfu.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
include $(DMBS_PATH)/hid.mk
|
||||
include $(DMBS_PATH)/avrdude.mk
|
||||
include $(DMBS_PATH)/atprogram.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -58,8 +58,13 @@ void Application_Jump_Check(void)
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
{
|
||||
/* Turn off the watchdog */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Clear the boot key and jump to the user application */
|
||||
MagicBootKey = 0;
|
||||
|
||||
|
||||
// cppcheck-suppress constStatement
|
||||
((void (*)(void))0x0000)();
|
||||
}
|
||||
@@ -98,6 +103,9 @@ static void SetupHardware(void)
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Disable clock division */
|
||||
clock_prescale_set(clock_div_1);
|
||||
|
||||
/* Relocate the interrupt vector table to the bootloader section */
|
||||
MCUCR = (1 << IVCE);
|
||||
MCUCR = (1 << IVSEL);
|
||||
@@ -153,7 +161,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||
{
|
||||
RunBootloader = false;
|
||||
}
|
||||
else
|
||||
else if (PageAddress < BOOT_START_ADDR)
|
||||
{
|
||||
/* Erase the given FLASH page, ready to be programmed */
|
||||
boot_page_erase(PageAddress);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -67,7 +67,5 @@
|
||||
void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
|
||||
|
||||
void EVENT_USB_Device_ConfigurationChanged(void);
|
||||
void EVENT_USB_Device_UnhandledControlRequest(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* This bootloader enumerates to the host as a HID Class device, allowing for device FLASH programming through
|
||||
* the supplied command line software, which is a modified version of Paul's TeensyHID Command Line loader code
|
||||
* from PJRC (used with permission). This bootloader is deliberatley non-compatible with the properietary PJRC
|
||||
* from PJRC (used with permission). This bootloader is deliberately non-compatible with the proprietary PJRC
|
||||
* HalfKay bootloader GUI; only the command line interface software accompanying this bootloader will work with it.
|
||||
*
|
||||
* Out of the box this bootloader builds for the AT90USB1287 with an 8KB bootloader section size, and will fit
|
||||
@@ -56,6 +56,15 @@
|
||||
* all other models. If you wish to alter this size and/or change the AVR model, you will need to edit the MCU,
|
||||
* FLASH_SIZE_KB and BOOT_SECTION_SIZE_KB values in the accompanying makefile.
|
||||
*
|
||||
* \warning <b>THIS BOOTLOADER IS NOT SECURE.</b> Malicious entities can recover written data, even if the device
|
||||
* lockbits are set.
|
||||
*
|
||||
* \section Sec_Running Running the Bootloader
|
||||
*
|
||||
* This bootloader is designed to be started via the \c HWB mechanism of the USB AVRs; ground the \c HWB pin (see device
|
||||
* datasheet) then momentarily ground \c /RESET to start the bootloader. This assumes the \c HWBE fuse is set and the
|
||||
* \c BOOTRST fuse is cleared.
|
||||
*
|
||||
* \section Sec_Installation Driver Installation
|
||||
*
|
||||
* This bootloader uses the HID class driver inbuilt into all modern operating systems, thus no additional drivers
|
||||
@@ -64,7 +73,7 @@
|
||||
* \section Sec_HostApp Host Controller Application
|
||||
*
|
||||
* Due to licensing issues, the supplied bootloader is compatible with the HalfKay bootloader protocol designed
|
||||
* by PJRC, but is non-compatible with the cross-platform loader GUI. A modified version of the open source
|
||||
* by PJRC, but is <b>not compatible with the cross-platform loader GUI</b>. A modified version of the open source
|
||||
* cross-platform TeensyLoader application is supplied, which can be compiled under most operating systems. The
|
||||
* command-line loader application should remain compatible with genuine Teensy boards in addition to boards using
|
||||
* this custom bootloader.
|
||||
@@ -77,9 +86,9 @@
|
||||
* \section Sec_KnownIssues Known Issues:
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* Some USB AVR boards ship with the \c BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. This booloader requires the
|
||||
* \c BOOTRST be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section SSec_Options Project Options
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -48,12 +48,12 @@ const USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
|
||||
HID_RI_USAGE_PAGE(16, 0xFFDC), /* Vendor Page 0xDC */
|
||||
HID_RI_USAGE(8, 0xFB), /* Vendor Usage 0xFB */
|
||||
HID_RI_COLLECTION(8, 0x01), /* Vendor Usage 1 */
|
||||
HID_RI_USAGE(8, 0x02), /* Vendor Usage 2 */
|
||||
HID_RI_LOGICAL_MINIMUM(8, 0x00),
|
||||
HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
|
||||
HID_RI_REPORT_SIZE(8, 0x08),
|
||||
HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),
|
||||
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
|
||||
HID_RI_USAGE(8, 0x02), /* Vendor Usage 2 */
|
||||
HID_RI_LOGICAL_MINIMUM(8, 0x00),
|
||||
HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
|
||||
HID_RI_REPORT_SIZE(8, 0x08),
|
||||
HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),
|
||||
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
|
||||
HID_RI_END_COLLECTION(0),
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.USBSpecification = VERSION_BCD(1,1,0),
|
||||
.Class = USB_CSCP_NoDeviceClass,
|
||||
.SubClass = USB_CSCP_NoDeviceSubclass,
|
||||
.Protocol = USB_CSCP_NoDeviceProtocol,
|
||||
@@ -75,7 +75,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x2067,
|
||||
.ReleaseNumber = VERSION_BCD(00.01),
|
||||
.ReleaseNumber = VERSION_BCD(0,0,1),
|
||||
|
||||
.ManufacturerStrIndex = NO_DESCRIPTOR,
|
||||
.ProductStrIndex = NO_DESCRIPTOR,
|
||||
@@ -110,7 +110,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0x00,
|
||||
.InterfaceNumber = INTERFACE_ID_GenericHID,
|
||||
.AlternateSetting = 0x00,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
@@ -126,7 +126,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
|
||||
|
||||
.HIDSpec = VERSION_BCD(01.11),
|
||||
.HIDSpec = VERSION_BCD(1,1,1),
|
||||
.CountryCode = 0x00,
|
||||
.TotalReportDescriptors = 1,
|
||||
.HIDReportType = HID_DTYPE_Report,
|
||||
@@ -151,7 +151,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
@@ -175,7 +175,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
Address = &ConfigurationDescriptor.HID_VendorHID;
|
||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||
}
|
||||
else
|
||||
else if (DescriptorType == HID_DTYPE_Report)
|
||||
{
|
||||
Address = &HIDReport;
|
||||
Size = sizeof(HIDReport);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -51,9 +51,18 @@
|
||||
// Generic HID Interface
|
||||
USB_Descriptor_Interface_t HID_Interface;
|
||||
USB_HID_Descriptor_HID_t HID_VendorHID;
|
||||
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
|
||||
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
|
||||
* should have a unique ID index associated with it, which can be used to refer to the
|
||||
* interface from other descriptors.
|
||||
*/
|
||||
enum InterfaceDescriptors_t
|
||||
{
|
||||
INTERFACE_ID_GenericHID = 0, /**< GenericHID interface descriptor ID */
|
||||
};
|
||||
|
||||
/* Macros: */
|
||||
/** Endpoint address of the HID data IN endpoint. */
|
||||
#define HID_IN_EPADDR (ENDPOINT_DIR_IN | 1)
|
||||
@@ -63,7 +72,7 @@
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1
Bootloaders/HID/HostLoaderApp/.gitignore
vendored
Normal file
1
Bootloaders/HID/HostLoaderApp/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
hid_bootloader_cli
|
||||
@@ -13,8 +13,9 @@ hid_bootloader_cli: hid_bootloader_cli.c
|
||||
else ifeq ($(OS), WINDOWS)
|
||||
CC = i586-mingw32msvc-gcc
|
||||
CFLAGS ?= -O2 -Wall
|
||||
LDLIB = -lsetupapi -lhid
|
||||
hid_bootloader_cli.exe: hid_bootloader_cli.c
|
||||
$(CC) $(CFLAGS) -s -DUSE_WIN32 -o hid_bootloader_cli.exe hid_bootloader_cli.c -lhid -lsetupapi
|
||||
$(CC) $(CFLAGS) -s -DUSE_WIN32 -o hid_bootloader_cli.exe hid_bootloader_cli.c $(LDLIB)
|
||||
|
||||
|
||||
else ifeq ($(OS), MACOSX)
|
||||
|
||||
@@ -921,21 +921,22 @@ void ihex_get_data(int addr, int len, unsigned char *bytes)
|
||||
int printf_verbose(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
int r = 0;
|
||||
|
||||
va_start(ap, format);
|
||||
if (verbose) {
|
||||
r = vprintf(format, ap);
|
||||
fflush(stdout);
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
va_end(ap);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void delay(double seconds)
|
||||
{
|
||||
#ifdef WIN32
|
||||
Sleep(seconds * 1000.0);
|
||||
#ifdef USE_WIN32
|
||||
sleep(seconds * 1000.0);
|
||||
#else
|
||||
usleep(seconds * 1000000.0);
|
||||
#endif
|
||||
@@ -948,10 +949,12 @@ void die(const char *str, ...)
|
||||
va_start(ap, str);
|
||||
vfprintf(stderr, str, ap);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(ap);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined USE_WIN32
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
@@ -16,7 +16,7 @@
|
||||
python hid_bootloader_loader.py at90usb1287 Mouse.hex
|
||||
|
||||
Requires the pywinusb (https://pypi.python.org/pypi/pywinusb/) and
|
||||
IntelHex (http://bialix.com/intelhex/) libraries.
|
||||
IntelHex (https://pypi.python.org/pypi/IntelHex/) libraries.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
<build type="module-config" subtype="path" value="Config"/>
|
||||
<build type="header-file" value="Config/LUFAConfig.h"/>
|
||||
|
||||
<build type="distribute" subtype="user-file" value="doxyfile"/>
|
||||
<build type="distribute" subtype="user-file" value="BootloaderHID.txt"/>
|
||||
<build type="distribute" subtype="directory" value="HostLoaderApp"/>
|
||||
<build type="distribute" subtype="directory" value="HostLoaderApp_Python"/>
|
||||
|
||||
2398
Bootloaders/HID/doxyfile
Normal file
2398
Bootloaders/HID/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -20,7 +20,7 @@ OPTIMIZATION = s
|
||||
TARGET = BootloaderHID
|
||||
SRC = $(TARGET).c Descriptors.c $(LUFA_SRC_USB)
|
||||
LUFA_PATH = ../../LUFA
|
||||
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/
|
||||
CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -DBOOT_START_ADDR=$(BOOT_START_OFFSET) -IConfig/
|
||||
LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET)
|
||||
|
||||
# Flash size and bootloader section sizes of the target, in KB. These must
|
||||
@@ -38,11 +38,18 @@ BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) -
|
||||
# Default target
|
||||
all:
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
include $(LUFA_PATH)/Build/lufa_doxygen.mk
|
||||
include $(LUFA_PATH)/Build/lufa_avrdude.mk
|
||||
include $(LUFA_PATH)/Build/lufa_atprogram.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
include $(DMBS_PATH)/doxygen.mk
|
||||
include $(DMBS_PATH)/dfu.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
include $(DMBS_PATH)/hid.mk
|
||||
include $(DMBS_PATH)/avrdude.mk
|
||||
include $(DMBS_PATH)/atprogram.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -44,7 +44,7 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_MassStorage,
|
||||
.DataINEndpoint =
|
||||
{
|
||||
.Address = MASS_STORAGE_IN_EPADDR,
|
||||
@@ -91,11 +91,11 @@ void Application_Jump_Check(void)
|
||||
|
||||
#if (BOARD == BOARD_LEONARDO)
|
||||
/* Enable pull-up on the IO13 pin so we can use it to select the mode */
|
||||
PORTC |= (1 << 7);
|
||||
PORTC |= (1 << 7);
|
||||
Delay_MS(10);
|
||||
|
||||
/* If IO13 is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication |= ((PINC & (1 << 7)) != 0);
|
||||
JumpToApplication = ((PINC & (1 << 7)) != 0);
|
||||
|
||||
/* Disable pull-up after the check has completed */
|
||||
PORTC &= ~(1 << 7);
|
||||
@@ -108,21 +108,46 @@ void Application_Jump_Check(void)
|
||||
Delay_MS(10);
|
||||
|
||||
/* If the TCK pin is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication |= ((PINF & (1 << 4)) != 0);
|
||||
JumpToApplication = ((PINF & (1 << 4)) != 0);
|
||||
|
||||
/* Re-enable JTAG debugging */
|
||||
JTAG_ENABLE();
|
||||
#else
|
||||
/* Check if the device's BOOTRST fuse is set */
|
||||
if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST)
|
||||
{
|
||||
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
|
||||
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << EXTRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application;
|
||||
* this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
{
|
||||
MagicBootKey = 0;
|
||||
JumpToApplication = true;
|
||||
}
|
||||
/* Don't run the user application if the reset vector is blank (no app loaded) */
|
||||
bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF);
|
||||
|
||||
if (JumpToApplication)
|
||||
/* If a request has been made to jump to the user application, honor it */
|
||||
if (JumpToApplication && ApplicationValid)
|
||||
{
|
||||
/* Turn off the watchdog */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Clear the boot key and jump to the user application */
|
||||
MagicBootKey = 0;
|
||||
|
||||
// cppcheck-suppress constStatement
|
||||
((void (*)(void))0x0000)();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -57,6 +57,33 @@
|
||||
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
|
||||
* bootloader from the normal user application.
|
||||
*
|
||||
* \warning <b>THIS BOOTLOADER IS NOT SECURE.</b> Malicious entities can recover written data, even if the device
|
||||
* lockbits are set.
|
||||
*
|
||||
* \section Sec_Running Running the Bootloader
|
||||
*
|
||||
* On the USB AVR8 devices, setting the \c HWBE device fuse will cause the bootloader to run if the \c HWB pin of
|
||||
* the AVR is grounded when the device is reset.
|
||||
*
|
||||
* The are two behaviours of this bootloader, depending on the device's fuses:
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is reset from
|
||||
* the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the
|
||||
* device's external reset pin should be grounded momentarily.
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is not set</b>, the bootloader will run only if initiated via a software
|
||||
* jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set).
|
||||
*
|
||||
* For board specific exceptions to the above, see below.
|
||||
*
|
||||
* \subsection SSec_XPLAIN Atmel Xplain Board
|
||||
* Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the
|
||||
* \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \subsection SSec_Leonardo Arduino Leonardo Board
|
||||
* Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the
|
||||
* \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \section Sec_Installation Driver Installation
|
||||
*
|
||||
* This bootloader uses the Mass Storage drivers inbuilt into all modern operating systems, thus no additional
|
||||
@@ -69,7 +96,20 @@
|
||||
* remove your device from the host using the host OS's ejection APIs, to ensure all data is correctly flushed to the
|
||||
* bootloader's virtual filesystem and not cached in the OS's file system driver.
|
||||
*
|
||||
* The current device firmware can be read from the device by reading a file from the virtual FAT filesystem.
|
||||
* The current device firmware can be read from the device by reading a file from the virtual FAT filesystem. Two files will
|
||||
* be present:
|
||||
* - <b>FLASH.BIN</b>, representing the AVR's internal flash memory
|
||||
* - <b>EEPROM.BIN</b>, representing the AVR's internal EEPROM memory
|
||||
*
|
||||
* To convert an existing Intel HEX (.HEX) program file to a binary (.BIN) file suitable for this bootloader, run:
|
||||
* \code
|
||||
* avr-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature input.hex output.bin
|
||||
* \endcode
|
||||
* From a terminal, replacing <tt>input.hex</tt> and <tt>output.bin</tt> with the respective input and output filenames.
|
||||
* AVR EEPROM data files in Intel HEX format (.EEP) uses a similar technique:
|
||||
* \code
|
||||
* avr-objcopy -O binary input.eep output.bin
|
||||
* \endcode
|
||||
*
|
||||
* \warning This bootloader is currently <b>incompatible with the Apple MacOS X OS Finder GUI</b>, due to the
|
||||
* large amount of meta files this OS attempts to write to the disk along with the new binaries. On
|
||||
@@ -179,12 +219,6 @@
|
||||
* Mass Storage bootloader, or the file system synced via an appropriate command
|
||||
* (such as the OS's normal disk ejection command) before disconnecting the device.
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section Sec_Options Project Options
|
||||
*
|
||||
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -47,7 +47,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.USBSpecification = VERSION_BCD(1,1,0),
|
||||
.Class = USB_CSCP_NoDeviceClass,
|
||||
.SubClass = USB_CSCP_NoDeviceSubclass,
|
||||
.Protocol = USB_CSCP_NoDeviceProtocol,
|
||||
@@ -56,7 +56,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x2045,
|
||||
.ReleaseNumber = VERSION_BCD(00.01),
|
||||
.ReleaseNumber = VERSION_BCD(0,0,1),
|
||||
|
||||
.ManufacturerStrIndex = NO_DESCRIPTOR,
|
||||
.ProductStrIndex = NO_DESCRIPTOR,
|
||||
@@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_MassStorage,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
@@ -131,7 +131,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -68,9 +68,19 @@
|
||||
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
|
||||
/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
|
||||
* should have a unique ID index associated with it, which can be used to refer to the
|
||||
* interface from other descriptors.
|
||||
*/
|
||||
enum InterfaceDescriptors_t
|
||||
{
|
||||
INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) AUX_BOOT_SECTION;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -55,9 +55,9 @@
|
||||
* \param[in] Acode New SCSI additional sense key to set the additional sense code to
|
||||
* \param[in] Aqual New SCSI additional sense key qualifier to set the additional sense qualifier code to
|
||||
*/
|
||||
#define SCSI_SET_SENSE(Key, Acode, Aqual) MACROS{ SenseData.SenseKey = (Key); \
|
||||
SenseData.AdditionalSenseCode = (Acode); \
|
||||
SenseData.AdditionalSenseQualifier = (Aqual); }MACROE
|
||||
#define SCSI_SET_SENSE(Key, Acode, Aqual) do { SenseData.SenseKey = (Key); \
|
||||
SenseData.AdditionalSenseCode = (Acode); \
|
||||
SenseData.AdditionalSenseQualifier = (Aqual); } while (0)
|
||||
|
||||
/** Macro for the \ref SCSI_Command_ReadWrite_10() function, to indicate that data is to be read from the storage medium. */
|
||||
#define DATA_READ true
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -99,31 +99,31 @@
|
||||
|
||||
/** Bit-rotates a given 8-bit value once to the right.
|
||||
*
|
||||
* \param x Value to rotate right once
|
||||
* \param[in] x Value to rotate right once
|
||||
*
|
||||
* \return Bit-rotated input value, rotated once to the right.
|
||||
*/
|
||||
#define _ROT8(x) ((((x) & 0xFE) >> 1) | (((x) & 1) ? 0x80 : 0x00))
|
||||
#define ROT8(x) ((((x) & 0xFE) >> 1) | (((x) & 1) ? 0x80 : 0x00))
|
||||
|
||||
/** Computes the LFN entry checksum of a MSDOS 8.3 format file entry,
|
||||
* to associate a LFN entry with its short file entry.
|
||||
*
|
||||
* \param n0 MSDOS Filename character 1
|
||||
* \param n1 MSDOS Filename character 2
|
||||
* \param n2 MSDOS Filename character 3
|
||||
* \param n3 MSDOS Filename character 4
|
||||
* \param n4 MSDOS Filename character 5
|
||||
* \param n5 MSDOS Filename character 6
|
||||
* \param n6 MSDOS Filename character 7
|
||||
* \param n7 MSDOS Filename character 8
|
||||
* \param e0 MSDOS Extension character 1
|
||||
* \param e1 MSDOS Extension character 2
|
||||
* \param e2 MSDOS Extension character 3
|
||||
* \param[in] n0 MSDOS Filename character 1
|
||||
* \param[in] n1 MSDOS Filename character 2
|
||||
* \param[in] n2 MSDOS Filename character 3
|
||||
* \param[in] n3 MSDOS Filename character 4
|
||||
* \param[in] n4 MSDOS Filename character 5
|
||||
* \param[in] n5 MSDOS Filename character 6
|
||||
* \param[in] n6 MSDOS Filename character 7
|
||||
* \param[in] n7 MSDOS Filename character 8
|
||||
* \param[in] e0 MSDOS Extension character 1
|
||||
* \param[in] e1 MSDOS Extension character 2
|
||||
* \param[in] e2 MSDOS Extension character 3
|
||||
*
|
||||
* \return LFN checksum of the given MSDOS 8.3 filename.
|
||||
*/
|
||||
#define FAT_CHECKSUM(n0, n1, n2, n3, n4, n5, n6, n7, e0, e1, e2) \
|
||||
(uint8_t)(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(_ROT8(n0)+n1)+n2)+n3)+n4)+n5)+n6)+n7)+e0)+e1)+e2)
|
||||
(uint8_t)(ROT8(ROT8(ROT8(ROT8(ROT8(ROT8(ROT8(ROT8(ROT8(ROT8(n0)+n1)+n2)+n3)+n4)+n5)+n6)+n7)+e0)+e1)+e2)
|
||||
|
||||
/** \name FAT Filesystem Flags */
|
||||
//@{
|
||||
@@ -274,10 +274,10 @@
|
||||
|
||||
/* Function Prototypes: */
|
||||
#if defined(INCLUDE_FROM_VIRTUAL_FAT_C)
|
||||
static uint8_t ReadEEPROMByte(const uint8_t* const Address) ATTR_NEVER_INLINE;
|
||||
static uint8_t ReadEEPROMByte(const uint8_t* const Address) ATTR_NO_INLINE;
|
||||
|
||||
static void WriteEEPROMByte(uint8_t* const Address,
|
||||
const uint8_t Data) ATTR_NEVER_INLINE;
|
||||
const uint8_t Data) ATTR_NO_INLINE;
|
||||
|
||||
static void UpdateFAT12ClusterEntry(uint8_t* const FATTable,
|
||||
const uint16_t Index,
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
|
||||
<build type="module-config" subtype="path" value="Config"/>
|
||||
<build type="header-file" value="Config/LUFAConfig.h"/>
|
||||
<build type="header-file" value="Config/AppConfig.h"/>
|
||||
|
||||
<build type="include-path" value="Lib"/>
|
||||
<build type="header-file" value="Lib/VirtualFAT.h"/>
|
||||
@@ -143,6 +144,7 @@
|
||||
<build type="header-file" value="Lib/SCSI.h"/>
|
||||
<build type="c-source" value="Lib/SCSI.c"/>
|
||||
|
||||
<build type="distribute" subtype="user-file" value="doxyfile"/>
|
||||
<build type="distribute" subtype="user-file" value="BootloaderMassStorage.txt"/>
|
||||
|
||||
<require idref="lufa.common"/>
|
||||
|
||||
2396
Bootloaders/MassStorage/doxyfile
Normal file
2396
Bootloaders/MassStorage/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -58,11 +58,18 @@ endif
|
||||
# Default target
|
||||
all:
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
include $(LUFA_PATH)/Build/lufa_doxygen.mk
|
||||
include $(LUFA_PATH)/Build/lufa_avrdude.mk
|
||||
include $(LUFA_PATH)/Build/lufa_atprogram.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
include $(DMBS_PATH)/doxygen.mk
|
||||
include $(DMBS_PATH)/dfu.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
include $(DMBS_PATH)/hid.mk
|
||||
include $(DMBS_PATH)/avrdude.mk
|
||||
include $(DMBS_PATH)/atprogram.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -43,7 +43,7 @@ USB_ClassInfo_PRNT_Device_t TextOnly_Printer_Interface =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_Printer,
|
||||
.DataINEndpoint =
|
||||
{
|
||||
.Address = PRINTER_IN_EPADDR,
|
||||
@@ -119,9 +119,65 @@ uint16_t MagicBootKey ATTR_NO_INIT;
|
||||
*/
|
||||
void Application_Jump_Check(void)
|
||||
{
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
bool JumpToApplication = false;
|
||||
|
||||
#if (BOARD == BOARD_LEONARDO)
|
||||
/* Enable pull-up on the IO13 pin so we can use it to select the mode */
|
||||
PORTC |= (1 << 7);
|
||||
Delay_MS(10);
|
||||
|
||||
/* If IO13 is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication = ((PINC & (1 << 7)) != 0);
|
||||
|
||||
/* Disable pull-up after the check has completed */
|
||||
PORTC &= ~(1 << 7);
|
||||
#elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
|
||||
/* Disable JTAG debugging */
|
||||
JTAG_DISABLE();
|
||||
|
||||
/* Enable pull-up on the JTAG TCK pin so we can use it to select the mode */
|
||||
PORTF |= (1 << 4);
|
||||
Delay_MS(10);
|
||||
|
||||
/* If the TCK pin is not jumpered to ground, start the user application instead */
|
||||
JumpToApplication = ((PINF & (1 << 4)) != 0);
|
||||
|
||||
/* Re-enable JTAG debugging */
|
||||
JTAG_ENABLE();
|
||||
#else
|
||||
/* Check if the device's BOOTRST fuse is set */
|
||||
if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST)
|
||||
{
|
||||
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
|
||||
if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << EXTRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application;
|
||||
* this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */
|
||||
if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
|
||||
JumpToApplication = true;
|
||||
|
||||
/* Clear reset source */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't run the user application if the reset vector is blank (no app loaded) */
|
||||
bool ApplicationValid = (pgm_read_word_near(0) != 0xFFFF);
|
||||
|
||||
/* If a request has been made to jump to the user application, honor it */
|
||||
if (JumpToApplication && ApplicationValid)
|
||||
{
|
||||
/* Turn off the watchdog */
|
||||
MCUSR &= ~(1 << WDRF);
|
||||
wdt_disable();
|
||||
|
||||
/* Clear the boot key and jump to the user application */
|
||||
MagicBootKey = 0;
|
||||
|
||||
// cppcheck-suppress constStatement
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -54,6 +54,30 @@
|
||||
* When the bootloader is running, the board's LED(s) will flash at regular intervals to distinguish the
|
||||
* bootloader from the normal user application.
|
||||
*
|
||||
* \section Sec_Running Running the Bootloader
|
||||
*
|
||||
* On the USB AVR8 devices, setting the \c HWBE device fuse will cause the bootloader to run if the \c HWB pin of
|
||||
* the AVR is grounded when the device is reset.
|
||||
*
|
||||
* The are two behaviours of this bootloader, depending on the device's fuses:
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is set</b>, the bootloader will run any time the system is reset from
|
||||
* the external reset pin, unless no valid user application has been loaded. To initiate the bootloader, the
|
||||
* device's external reset pin should be grounded momentarily.
|
||||
*
|
||||
* <b>If the device's BOOTRST fuse is not set</b>, the bootloader will run only if initiated via a software
|
||||
* jump, or if the \c HWB pin was low during the last device reset (if the \c HWBE fuse is set).
|
||||
*
|
||||
* For board specific exceptions to the above, see below.
|
||||
*
|
||||
* \subsection SSec_XPLAIN Atmel Xplain Board
|
||||
* Ground the USB AVR JTAG's \c TCK pin to ground when powering on the board to start the bootloader. This assumes the
|
||||
* \c HWBE fuse is cleared and the \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \subsection SSec_Leonardo Arduino Leonardo Board
|
||||
* Ground \c IO13 when powering the board to start the bootloader. This assumes the \c HWBE fuse is cleared and the
|
||||
* \c BOOTRST fuse is set as the HWBE pin is not user accessible on this board.
|
||||
*
|
||||
* \section Sec_Installation Driver Installation
|
||||
*
|
||||
* This bootloader uses the Generic Text-Only printer drivers inbuilt into all modern operating systems, thus no
|
||||
@@ -163,12 +187,6 @@
|
||||
* are unable to handle true plain-text printing. For best results, the low
|
||||
* level \c lpr command should be used to print new firmware to the bootloader.
|
||||
*
|
||||
* \par After loading an application, it is not run automatically on startup.
|
||||
* Some USB AVR boards ship with the BOOTRST fuse set, causing the bootloader
|
||||
* to run automatically when the device is reset. In most cases, the BOOTRST
|
||||
* fuse should be disabled and the HWBE fuse used instead to run the bootloader
|
||||
* when needed.
|
||||
*
|
||||
* \section Sec_Options Project Options
|
||||
*
|
||||
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -47,7 +47,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.USBSpecification = VERSION_BCD(1,1,0),
|
||||
.Class = USB_CSCP_NoDeviceClass,
|
||||
.SubClass = USB_CSCP_NoDeviceSubclass,
|
||||
.Protocol = USB_CSCP_NoDeviceProtocol,
|
||||
@@ -56,7 +56,7 @@ const USB_Descriptor_Device_t DeviceDescriptor =
|
||||
|
||||
.VendorID = 0x03EB,
|
||||
.ProductID = 0x206B,
|
||||
.ReleaseNumber = VERSION_BCD(00.01),
|
||||
.ReleaseNumber = VERSION_BCD(0,0,1),
|
||||
|
||||
.ManufacturerStrIndex = STRING_ID_Manufacturer,
|
||||
.ProductStrIndex = STRING_ID_Product,
|
||||
@@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.InterfaceNumber = INTERFACE_ID_Printer,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
@@ -128,34 +128,19 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor =
|
||||
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
|
||||
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
|
||||
*/
|
||||
const USB_Descriptor_String_t LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {LANGUAGE_ID_ENG}
|
||||
};
|
||||
const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
|
||||
|
||||
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
|
||||
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Dean Camera"
|
||||
};
|
||||
const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
|
||||
|
||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
|
||||
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"LUFA Printer Bootloader"
|
||||
};
|
||||
const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA Printer Bootloader");
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
@@ -164,7 +149,7 @@ const USB_Descriptor_String_t ProductString =
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -66,20 +66,29 @@
|
||||
USB_Descriptor_Endpoint_t Printer_DataOutEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/** Enum for the device interface descriptor IDs within the device. Each string descriptor
|
||||
* should have a unique ID index associated with it, which can be used to refer to the
|
||||
* interface from other descriptors.
|
||||
*/
|
||||
enum InterfaceDescriptors_t
|
||||
{
|
||||
INTERFACE_ID_Printer = 0, /**< Printer interface descriptor ID */
|
||||
};
|
||||
|
||||
/** Enum for the device string descriptor IDs within the device. Each string descriptor should
|
||||
* have a unique ID index associated with it, which can be used to refer to the string from
|
||||
* other descriptors.
|
||||
*/
|
||||
enum StringDescriptors_t
|
||||
{
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
|
||||
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
|
||||
STRING_ID_Product = 2, /**< Product string ID */
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const uint16_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -147,6 +147,7 @@
|
||||
<build type="module-config" subtype="path" value="Config"/>
|
||||
<build type="header-file" value="Config/LUFAConfig.h"/>
|
||||
|
||||
<build type="distribute" subtype="user-file" value="doxyfile"/>
|
||||
<build type="distribute" subtype="user-file" value="BootloaderPrinter.txt"/>
|
||||
|
||||
<require idref="lufa.common"/>
|
||||
|
||||
2396
Bootloaders/Printer/doxyfile
Normal file
2396
Bootloaders/Printer/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -45,11 +45,18 @@ BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, Boot
|
||||
# Default target
|
||||
all:
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
include $(LUFA_PATH)/Build/lufa_doxygen.mk
|
||||
include $(LUFA_PATH)/Build/lufa_avrdude.mk
|
||||
include $(LUFA_PATH)/Build/lufa_atprogram.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
include $(DMBS_PATH)/doxygen.mk
|
||||
include $(DMBS_PATH)/dfu.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
include $(DMBS_PATH)/hid.mk
|
||||
include $(DMBS_PATH)/avrdude.mk
|
||||
include $(DMBS_PATH)/atprogram.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -24,13 +24,13 @@ endif
|
||||
|
||||
# Need to special-case building without a per-project object directory
|
||||
ifeq ($(OBJDIR),)
|
||||
# If no target specified, force "clean all" and disallow parallel build
|
||||
# If no target specified, force "clean all" and disallow parallel build
|
||||
ifeq ($(MAKECMDGOALS),)
|
||||
MAKECMDGOALS := clean all
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
|
||||
# If one of the targets is to build, force "clean" beforehand and disallow parallel build
|
||||
# If one of the targets is to build, force "clean" beforehand and disallow parallel build
|
||||
ifneq ($(findstring all, $(MAKECMDGOALS)),)
|
||||
MAKECMDGOALS := clean $(MAKECMDGOALS)
|
||||
.NOTPARALLEL:
|
||||
@@ -42,5 +42,5 @@ endif
|
||||
|
||||
$(PROJECT_DIRECTORIES):
|
||||
@$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
||||
|
||||
.PHONY: $(PROJECT_DIRECTORIES)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -71,6 +71,10 @@ BOARD_XPLAIN = AVR8 : at90usb1287 :
|
||||
BOARD_XPLAIN_REV1 = AVR8 : at90usb1287 :
|
||||
BOARD_STANGE_ISP = AVR8 : at90usb162 :
|
||||
BOARD_U2S = AVR8 : atmega32u2 :
|
||||
BOARD_YUN = AVR8 : atmega32u4 :
|
||||
BOARD_MICRO = AVR8 : atmega32u4 :
|
||||
BOARD_POLOLUMICRO = AVR8 : atmega32u4 :
|
||||
BOARD_XPLAINED_MINI = AVR8 : atmega32u4 :
|
||||
#
|
||||
# ----------------- XMEGA Boards -----------------
|
||||
BOARD_A3BU_XPLAINED = XMEGA : atxmega256a3bu :
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -29,10 +29,10 @@ end:
|
||||
|
||||
makeboardlist:
|
||||
@grep "BOARD_" $(patsubst %/,%,$(LUFA_PATH))/Common/BoardTypes.h | cut -d'#' -f2 | cut -d' ' -f2 | grep "BOARD_" > BoardList.txt
|
||||
|
||||
|
||||
testboards:
|
||||
@echo "buildtest:" > BuildMakefile
|
||||
|
||||
|
||||
@while read line; \
|
||||
do \
|
||||
build_cfg=`grep "$$line " BoardDeviceMap.cfg | grep -v "#" | cut -d'=' -f2- | sed 's/ //g'`; \
|
||||
@@ -50,7 +50,7 @@ testboards:
|
||||
printf "\t$(MAKE) -f makefile.test clean elf MCU=%s ARCH=%s BOARD=%s\n\n" $$build_mcu $$build_arch $$build_board >> BuildMakefile; \
|
||||
fi; \
|
||||
done < BoardList.txt
|
||||
|
||||
|
||||
$(MAKE) -f BuildMakefile buildtest
|
||||
|
||||
clean:
|
||||
@@ -64,5 +64,6 @@ clean:
|
||||
|
||||
.PHONY: all begin end makeboardlist testboards clean
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
# Run "make help" for target help.
|
||||
|
||||
MCU =
|
||||
ARCH =
|
||||
BOARD =
|
||||
MCU =
|
||||
ARCH =
|
||||
BOARD =
|
||||
F_CPU = $(F_USB)
|
||||
F_USB = 8000000
|
||||
OPTIMIZATION = 1
|
||||
@@ -23,5 +23,13 @@ LUFA_PATH = ../../LUFA
|
||||
CC_FLAGS = -Werror
|
||||
DEBUG_LEVEL = 0
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -25,10 +25,10 @@ begin:
|
||||
end:
|
||||
@echo Build test "BootloaderTest" complete.
|
||||
@echo
|
||||
|
||||
|
||||
testbootloaders:
|
||||
@echo "buildtest:" > BuildMakefile
|
||||
|
||||
|
||||
@while read line; \
|
||||
do \
|
||||
build_cfg=`echo $$line | grep -v "#" | sed 's/ //g'`; \
|
||||
@@ -50,7 +50,7 @@ testbootloaders:
|
||||
printf "\t$(MAKE) -C $(patsubst %/,%,$(LUFA_PATH))/../Bootloaders/%s/ clean elf ARCH=%s MCU=%s BOARD=%s FLASH_SIZE_KB=%s BOOT_SECTION_SIZE_KB=%s F_USB=%s000000 DEBUG_LEVEL=0\n\n" $$build_bootloader $$build_arch $$build_mcu $$build_board $$build_flashsize $$build_bootsize $$build_fusb >> BuildMakefile; \
|
||||
fi; \
|
||||
done < BootloaderDeviceMap.cfg
|
||||
|
||||
|
||||
$(MAKE) -f BuildMakefile buildtest
|
||||
|
||||
clean:
|
||||
@@ -60,5 +60,6 @@ clean:
|
||||
|
||||
.PHONY: all begin end testbootloaders clean
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -35,7 +35,7 @@
|
||||
.global main
|
||||
main:
|
||||
|
||||
|
||||
|
||||
# Mandatory callback needed for base compile of the USB driver
|
||||
.global CALLBACK_USB_GetDescriptor
|
||||
CALLBACK_USB_GetDescriptor:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -37,20 +37,20 @@
|
||||
#include <LUFA/Drivers/Misc/TerminalCodes.h>
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
#if defined(TWCR)
|
||||
#include <LUFA/Drivers/Peripheral/TWI.h>
|
||||
#endif
|
||||
|
||||
#if defined(ADC)
|
||||
#include <LUFA/Drivers/Peripheral/ADC.h>
|
||||
#endif
|
||||
|
||||
#include <LUFA/Drivers/Peripheral/Serial.h>
|
||||
#include <LUFA/Drivers/Peripheral/SPI.h>
|
||||
#include <LUFA/Drivers/Peripheral/SerialSPI.h>
|
||||
#include <LUFA/Drivers/Peripheral/SPI.h>
|
||||
|
||||
#if defined(TWCR)
|
||||
#include <LUFA/Drivers/Peripheral/TWI.h>
|
||||
#endif
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
#include <LUFA/Drivers/Peripheral/TWI.h>
|
||||
#include <LUFA/Drivers/Peripheral/Serial.h>
|
||||
#include <LUFA/Drivers/Peripheral/SPI.h>
|
||||
#include <LUFA/Drivers/Peripheral/SerialSPI.h>
|
||||
#include <LUFA/Drivers/Peripheral/SPI.h>
|
||||
#include <LUFA/Drivers/Peripheral/TWI.h>
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -28,4 +28,4 @@
|
||||
this software.
|
||||
*/
|
||||
|
||||
#include "Modules.h"
|
||||
#include "Modules.h"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -28,4 +28,4 @@
|
||||
this software.
|
||||
*/
|
||||
|
||||
#include "Modules.h"
|
||||
#include "Modules.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -62,5 +62,6 @@ clean:
|
||||
|
||||
.PHONY: all arch_avr8 arch_xmega arch_uc3 begin end
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -75,7 +75,7 @@ ifneq ($(ARCH), UC3)
|
||||
endif
|
||||
|
||||
# Only check C++ compatibility on the build files, to ensure headers are C++ compatible
|
||||
Test_C.c Test_CPP.c: CC_FLAGS += -Wc++-compat
|
||||
Test_C.c Test_CPP.cpp: CC_FLAGS += -Wc++-compat
|
||||
|
||||
# Potential additional warnings to enable in the future (FIXME)
|
||||
#CC_FLAGS += -Wcast-qual
|
||||
@@ -83,6 +83,12 @@ Test_C.c Test_CPP.c: CC_FLAGS += -Wc++-compat
|
||||
#CC_FLAGS += -Wsign-conversion
|
||||
#CC_FLAGS += -pedantic
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -36,7 +36,7 @@
|
||||
main:
|
||||
# Force code generation of the base USB stack
|
||||
call USB_Init
|
||||
|
||||
|
||||
# Mandatory callback needed for base compile of the USB driver
|
||||
.global CALLBACK_USB_GetDescriptor
|
||||
CALLBACK_USB_GetDescriptor:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -36,7 +36,7 @@ compile:
|
||||
|
||||
@echo Building SingleUSBModeTest for ARCH=XMEGA in device only mode...
|
||||
$(MAKE) -f makefile.test clean elf ARCH=XMEGA MCU=atxmega128a1u CC_FLAGS='-D USB_DEVICE_ONLY'
|
||||
|
||||
|
||||
@echo Building SingleUSBModeTest for ARCH=UC3 in device only mode...
|
||||
$(MAKE) -f makefile.test clean elf ARCH=UC3 MCU=uc3a0256 CC_FLAGS='-D USB_DEVICE_ONLY'
|
||||
|
||||
@@ -52,5 +52,6 @@ clean:
|
||||
|
||||
.PHONY: begin end compile clean
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
# Run "make help" for target help.
|
||||
|
||||
MCU =
|
||||
ARCH =
|
||||
MCU =
|
||||
ARCH =
|
||||
BOARD = NONE
|
||||
F_CPU = $(F_USB)
|
||||
DEBUG_LEVEL = 0
|
||||
@@ -64,6 +64,12 @@ C_FLAGS += -Wnested-externs
|
||||
#CC_FLAGS += -Wjump-misses-init
|
||||
#CC_FLAGS += -pedantic
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
include $(LUFA_PATH)/Build/lufa_build.mk
|
||||
# Include LUFA-specific DMBS extension modules
|
||||
DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
|
||||
include $(DMBS_LUFA_PATH)/lufa-sources.mk
|
||||
include $(DMBS_LUFA_PATH)/lufa-gcc.mk
|
||||
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/gcc.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -38,10 +38,10 @@ end:
|
||||
@echo
|
||||
|
||||
%:
|
||||
|
||||
|
||||
.PHONY: all begin end
|
||||
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
|
||||
# Include common DMBS build system modules
|
||||
DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
|
||||
include $(DMBS_PATH)/core.mk
|
||||
include $(DMBS_PATH)/cppcheck.mk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# LUFA Library
|
||||
# Copyright (C) Dean Camera, 2013.
|
||||
# Copyright (C) Dean Camera, 2017.
|
||||
#
|
||||
# dean [at] fourwalledcubicle [dot] com
|
||||
# www.lufa-lib.org
|
||||
@@ -21,4 +21,4 @@ all:
|
||||
$(MAKE) -C SingleUSBModeTest $@
|
||||
$(MAKE) -C StaticAnalysisTest $@
|
||||
@echo
|
||||
@echo LUFA build test \"make $@\" operation complete.
|
||||
@echo LUFA build test \"make $@\" operation complete.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2013.
|
||||
Copyright (C) Dean Camera, 2017.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2013 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
@@ -44,8 +44,8 @@ USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.ControlInterfaceNumber = 0,
|
||||
.StreamingInterfaceNumber = 1,
|
||||
.ControlInterfaceNumber = INTERFACE_ID_AudioControl,
|
||||
.StreamingInterfaceNumber = INTERFACE_ID_AudioStream,
|
||||
.DataINEndpoint =
|
||||
{
|
||||
.Address = AUDIO_STREAM_EPADDR,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user