-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
2,511 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# hid_bootloader | ||
|
||
USB HID bootloader for Atmel XMEGA devices. Needs an 8k bootloader section because the Atmel ASF USB stack is about 6k on its own. | ||
(C) 2015 Paul Qureshi | ||
Licence: GPL 3.0 | ||
|
||
USB HID bootloader for Atmel XMEGA devices. Needs an 8k bootloader section because the Atmel ASF USB stack is about 6k on its own. The use of HID avoids the need for drivers on most operating systems. | ||
|
||
PC software uses HIDAPI (http://github.com/signal11/hidapi/commits/master). | ||
|
||
Currently supports 128k devices. Modify as required for other memory sizes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Built with Atmel Studio 6.2 and ASF 6.2.1314. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Built with Visual Studio 2013 Express. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Express 2013 for Windows Desktop | ||
VisualStudioVersion = 12.0.31101.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hid_bootloader", "hid_bootloader\hid_bootloader.vcxproj", "{BB669013-CF0A-4984-9E10-4C35D7EFD35B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Win32 = Debug|Win32 | ||
Release|Win32 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{BB669013-CF0A-4984-9E10-4C35D7EFD35B}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{BB669013-CF0A-4984-9E10-4C35D7EFD35B}.Debug|Win32.Build.0 = Debug|Win32 | ||
{BB669013-CF0A-4984-9E10-4C35D7EFD35B}.Release|Win32.ActiveCfg = Release|Win32 | ||
{BB669013-CF0A-4984-9E10-4C35D7EFD35B}.Release|Win32.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// bootloader.h | ||
|
||
#define CMD_NOP 0x00 | ||
#define CMD_WRITE_BUFFER 0x01 | ||
#define CMD_READ_BUFFER 0x02 | ||
#define CMD_ERASE_APP_SECTION 0x03 | ||
#define CMD_READ_FLASH_CRCS 0x04 | ||
#define CMD_READ_MCU_IDS 0x05 | ||
#define CMD_READ_FUSES 0x06 | ||
#define CMD_WRITE_PAGE 0x07 | ||
#define CMD_READ_PAGE 0x08 | ||
#define CMD_ERASE_USER_SIG_ROW 0x09 | ||
#define CMD_WRITE_USER_SIG_ROW 0x0A | ||
#define CMD_READ_USER_SIG_ROW 0x0B | ||
|
||
|
||
#define APP_SECTION_ERASE_TIMEOUT_MS 2000 | ||
#define APP_SECTION_NUM_PAGES 256 | ||
#define APP_SECTION_PAGE_SIZE 512 | ||
#define READ_FLASH_CRCS_TIMEOUT_MS 5000 | ||
|
||
|
||
#define HID_DATA_BYTES 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// crc.cpp | ||
|
||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include "crc.h" | ||
|
||
|
||
/************************************************************************************************** | ||
* Reverse bits in a uint32 | ||
*/ | ||
uint32_t reverse(uint32_t x) | ||
{ | ||
x = ((x & 0x55555555) << 1) | ((x >> 1) & 0x55555555); | ||
x = ((x & 0x33333333) << 2) | ((x >> 2) & 0x33333333); | ||
x = ((x & 0x0F0F0F0F) << 4) | ((x >> 4) & 0x0F0F0F0F); | ||
x = (x << 24) | ((x & 0xFF00) << 8) | | ||
((x >> 8) & 0xFF00) | (x >> 24); | ||
return x; | ||
} | ||
|
||
/************************************************************************************************** | ||
* Slow but correct CRC32 | ||
*/ | ||
uint32_t crc32(uint8_t *buffer, uint32_t buffer_length) | ||
{ | ||
int32_t i, j; | ||
uint32_t byte, crc; | ||
|
||
i = 0; | ||
crc = 0xFFFFFFFF; | ||
|
||
while (buffer_length--) | ||
{ | ||
byte = *buffer++; | ||
byte = reverse(byte); | ||
|
||
for (j = 0; j < 8; j++) | ||
{ | ||
if ((int32_t)(crc ^ byte) < 0) | ||
crc = (crc << 1) ^ 0x04C11DB7; | ||
else | ||
crc <<= 1; | ||
byte <<= 1; | ||
} | ||
i++; | ||
} | ||
|
||
return reverse(~crc); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// crc.h | ||
|
||
extern uint32_t crc32(uint8_t *buffer, uint32_t buffer_length); |
Oops, something went wrong.