From e952f681dbda9e8568206281bf588f3455924a20 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 20:57:36 +1100 Subject: [PATCH 1/8] Use different jump key than the bootloaders in the documentation. --- LUFA/DoxygenPages/SoftwareBootloaderJump.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/DoxygenPages/SoftwareBootloaderJump.txt b/LUFA/DoxygenPages/SoftwareBootloaderJump.txt index 0b69612b689..f8c2523d7b5 100644 --- a/LUFA/DoxygenPages/SoftwareBootloaderJump.txt +++ b/LUFA/DoxygenPages/SoftwareBootloaderJump.txt @@ -31,7 +31,7 @@ * * uint32_t Boot_Key ATTR_NO_INIT; * - * #define MAGIC_BOOT_KEY 0xDC42ACCA + * #define MAGIC_BOOT_KEY 0xBADCAFE5 * #define BOOTLOADER_START_ADDRESS ((FLASH_SIZE_BYTES - BOOTLOADER_SEC_SIZE_BYTES) >> 1) * * void Bootloader_Jump_Check(void) ATTR_INIT_SECTION(3); From 593dd3dd550806fd68470513d4ee224d717c90e2 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:20:54 +1100 Subject: [PATCH 2/8] Fix HID bootloader CLI app missing va_end() calls. --- Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c index cdee1c30cdb..4c327764985 100644 --- a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c +++ b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c @@ -929,6 +929,8 @@ int printf_verbose(const char *format, ...) fflush(stdout); return r; } + va_end(ap); + return 0; } @@ -948,6 +950,8 @@ void die(const char *str, ...) va_start(ap, str); vfprintf(stderr, str, ap); fprintf(stderr, "\n"); + va_end(ap); + exit(1); } From dd09a833d9e7be1713efda71a4eeb825aab1696a Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:28:09 +1100 Subject: [PATCH 3/8] Fix additional missing va_end() in the HID bootloader CLI utility. --- Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c index 4c327764985..b54f943b1c9 100644 --- a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c +++ b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c @@ -921,17 +921,16 @@ 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; } va_end(ap); - return 0; + return r; } void delay(double seconds) From 59b9cf8d0f5c8238d17d5a31a6835938a8e739ad Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:29:27 +1100 Subject: [PATCH 4/8] Update changelog. --- LUFA/DoxygenPages/ChangeLog.txt | 1 + LUFA/DoxygenPages/MigrationInformation.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index eac7d429c5d..b6bd54a118c 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -13,6 +13,7 @@ * parameter, instead of uint16_t (thanks to Matlo) * - Fixed broken USE_RAM_DESCRIPTORS compile time option when the FIXED_NUM_CONFIGURATIONS compile time option is not enabled * in a user application (thanks to Matlo) + * - Fixed missing \c va_end() calls in the HID bootloader CLI app which could cause portability issues * * \section Sec_ChangeLog151115 Version 151115 * New: diff --git a/LUFA/DoxygenPages/MigrationInformation.txt b/LUFA/DoxygenPages/MigrationInformation.txt index b98bfc1700f..b9ed3a33537 100644 --- a/LUFA/DoxygenPages/MigrationInformation.txt +++ b/LUFA/DoxygenPages/MigrationInformation.txt @@ -17,7 +17,7 @@ * \section Sec_Migration151115 Migrating from 140928 to 151115 * Non-USB Library Components * - The ATPROGRAM LUFA build system module now defaults to the Atmel ICE debugger tool, instead of the Atmel JTAG ICE3. - * - The \x Serial_CreateStream() and \c Serial_CreateBlockingStream() functions now require a USART base pointer for XMEGA devices as the first parameter. + * - The \c Serial_CreateStream() and \c Serial_CreateBlockingStream() functions now require a USART base pointer for XMEGA devices as the first parameter. * * \section Sec_Migration140928 Migrating from 140302 to 140928 * Device Mode From 0b69eeaf5db2f675c398a982329b6a2bbffc799e Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:31:54 +1100 Subject: [PATCH 5/8] Fix void pointer arithmetic in the Serial peripheral drivers. --- LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c | 4 +++- LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c index 3df39814e76..6680a6ba608 100644 --- a/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c +++ b/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c @@ -88,8 +88,10 @@ void Serial_SendString(const char* StringPtr) void Serial_SendData(const void* Buffer, uint16_t Length) { + uint8_t* CurrByte = (uint8_t*)Buffer; + while (Length--) - Serial_SendByte(*((uint8_t*)Buffer++)); + Serial_SendByte(*(CurrByte++)); } void Serial_CreateStream(FILE* Stream) diff --git a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c index f86bd9789a6..b7a39d3c2da 100644 --- a/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c +++ b/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c @@ -91,8 +91,10 @@ void Serial_SendData(USART_t* const USART, const void* Buffer, uint16_t Length) { + uint8_t* CurrByte = (uint8_t*)Buffer; + while (Length--) - Serial_SendByte(USART, *((uint8_t*)Buffer++)); + Serial_SendByte(USART, *(CurrByte++)); } void Serial_CreateStream(USART_t* USART, FILE* Stream) From dfdf4de8fa798a5d66267a1d11107cbe8f76bcc8 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:32:24 +1100 Subject: [PATCH 6/8] Fix void pointer arithmetic in the low level RNDIS demo. --- Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c index cc4e96132d7..e1d41ebdeed 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c @@ -244,7 +244,7 @@ void DecodeUDPHeader(void* InDataStart) void DecodeDHCPHeader(void* InDataStart) { #if !defined(NO_DECODE_DHCP) - uint8_t* DHCPOptions = (InDataStart + sizeof(DHCP_Header_t)); + uint8_t* DHCPOptions = ((uint8_t*)InDataStart + sizeof(DHCP_Header_t)); printf_P(PSTR(" \\\r\n DHCP\r\n")); From d0161e0a9bbc8d1a059a32e1c21fdd201cce1f3c Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:34:50 +1100 Subject: [PATCH 7/8] Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested. --- Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c | 2 +- LUFA/DoxygenPages/ChangeLog.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c index 08ec74aa98e..be13ce2772e 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c @@ -380,7 +380,7 @@ static bool ProcessNDISSet(uint32_t OId, void* SetData, uint16_t SetSize) CurrPacketFilter = *((uint32_t*)SetData); /* Set the RNDIS state to initialized if the packet filter is non-zero */ - CurrRNDISState = ((CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Data_Initialized); + CurrRNDISState = ((CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Initialized); return true; case OID_802_3_MULTICAST_LIST: diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index b6bd54a118c..36c5bf9c8ed 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -14,6 +14,9 @@ * - Fixed broken USE_RAM_DESCRIPTORS compile time option when the FIXED_NUM_CONFIGURATIONS compile time option is not enabled * in a user application (thanks to Matlo) * - Fixed missing \c va_end() calls in the HID bootloader CLI app which could cause portability issues + * - Fixed void pointer arithmetic in the \c Serial_SendData() functions for AVR8 and XMEGA architectures + * - Fixed void pointer arithmetic in the low level RNDIS demo protocol decoders + * - Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested * * \section Sec_ChangeLog151115 Version 151115 * New: From a86b502294ebda621fa8f3cce20a8238ea15eebc Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Dec 2015 22:36:23 +1100 Subject: [PATCH 8/8] Fix additional void pointer arithmetic in the class driver RNDIS demo. --- Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c | 2 +- LUFA/DoxygenPages/ChangeLog.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c index 57e71cb773b..c9db1f0ee92 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c @@ -244,7 +244,7 @@ void DecodeUDPHeader(void* InDataStart) void DecodeDHCPHeader(void* InDataStart) { #if !defined(NO_DECODE_DHCP) - uint8_t* DHCPOptions = (InDataStart + sizeof(DHCP_Header_t)); + uint8_t* DHCPOptions = ((uint8_t*)InDataStart + sizeof(DHCP_Header_t)); printf_P(PSTR(" \\\r\n DHCP\r\n")); diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index 36c5bf9c8ed..16102fb9581 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -15,7 +15,7 @@ * in a user application (thanks to Matlo) * - Fixed missing \c va_end() calls in the HID bootloader CLI app which could cause portability issues * - Fixed void pointer arithmetic in the \c Serial_SendData() functions for AVR8 and XMEGA architectures - * - Fixed void pointer arithmetic in the low level RNDIS demo protocol decoders + * - Fixed void pointer arithmetic in the low level and class driver RNDIS demo protocol decoders * - Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested * * \section Sec_ChangeLog151115 Version 151115