}
}
+#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.
*
/* Increment the address counter after use */
CurrAddress += 2;
-
- HighByte = false;
}
else
{
LowByte = FetchNextCommandByte();
-
- HighByte = true;
}
+
+ HighByte = !HighByte;
}
else
{
WriteNextResponseByte('\r');
}
}
+#endif
/** Retrieves the next byte from the host in the CDC data OUT endpoint, and clears the endpoint bank if needed
* to allow reception of the next data packet from the host.
WriteNextResponseByte(AVR_SIGNATURE_2);
WriteNextResponseByte(AVR_SIGNATURE_1);
}
- else if (Command == 'b')
- {
- WriteNextResponseByte('Y');
-
- /* Send block size to the host */
- WriteNextResponseByte(SPM_PAGESIZE >> 8);
- WriteNextResponseByte(SPM_PAGESIZE & 0xFF);
- }
else if (Command == 'e')
{
/* Clear the application section of flash */
/* Send confirmation byte back to the host */
WriteNextResponseByte('\r');
}
+ #if !defined(NO_LOCK_BYTE_SUPPORT)
else if (Command == 'l')
{
/* Set the lock bits to those given by the host */
/* Send confirmation byte back to the host */
WriteNextResponseByte('\r');
}
+ #endif
else if (Command == 'r')
{
WriteNextResponseByte(boot_lock_fuse_bits_get(GET_LOCK_BITS));
{
WriteNextResponseByte(boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS));
}
+ #if !defined(NO_BLOCK_SUPPORT)
+ else if (Command == 'b')
+ {
+ WriteNextResponseByte('Y');
+
+ /* Send block size to the host */
+ WriteNextResponseByte(SPM_PAGESIZE >> 8);
+ WriteNextResponseByte(SPM_PAGESIZE & 0xFF);
+ }
+ else if ((Command == 'B') || (Command == 'g'))
+ {
+ /* Delegate the block write/read to a separate function for clarity */
+ ReadWriteMemoryBlock(Command);
+ }
+ #endif
+ #if !defined(NO_FLASH_BYTE_SUPPORT)
else if (Command == 'C')
{
/* Write the high byte to the current flash page */
else if (Command == 'c')
{
/* Write the low byte to the current flash page */
- boot_page_fill(CurrAddress | 1, FetchNextCommandByte());
+ boot_page_fill(CurrAddress | 0x01, FetchNextCommandByte());
/* Increment the address */
CurrAddress += 2;
/* Send confirmation byte back to the host */
WriteNextResponseByte('\r');
}
- else if ((Command == 'B') || (Command == 'g'))
- {
- /* Delegate the block write/read to a separate function for clarity */
- ReadWriteMemoryBlock(Command);
- }
else if (Command == 'R')
{
#if (FLASHEND > 0xFFFF)
WriteNextResponseByte(ProgramWord >> 8);
WriteNextResponseByte(ProgramWord & 0xFF);
}
+ #endif
+ #if !defined(NO_EEPROM_BYTE_SUPPORT)
else if (Command == 'D')
{
/* Read the byte from the endpoint and write it to the EEPROM */
/* Increment the address after use */
CurrAddress += 2;
}
- else if (Command == 27)
- {
- /* Escape is sync, ignore */
- }
- else
+ #endif
+ else if (Command != 27)
{
- /* Unknown command, return fail code */
+ /* Unknown (non-sync) command, return fail code */
WriteNextResponseByte('?');
}
void EVENT_USB_Device_ConfigurationChanged(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)
+ #if !defined(NO_BLOCK_SUPPORT)
static void ReadWriteMemoryBlock(const uint8_t Command);
+ #endif
static uint8_t FetchNextCommandByte(void);
static void WriteNextResponseByte(const uint8_t Response);
#endif
*
* <table>
* <tr>
- * <td>
- * None
- * </td>
+ * <td>NO_BLOCK_SUPPORT</td>
+ * <td>Makefile LUFA_OPTS</td>
+ * <td>Define to disable memory block read/write support in the bootloader, requiring all reads and writes to be made
+ * using the byte-level commands.
+ * </tr>
+ * <tr>
+ * <td>NO_EEPROM_BYTE_SUPPORT</td>
+ * <td>Makefile LUFA_OPTS</td>
+ * <td>Define to disable EEPROM memory byte read/write support in the bootloader, requiring all EEPROM reads and writes
+ * to be made using the block-level commands.
+ * </tr>
+ * <tr>
+ * <td>NO_FLASH_BYTE_SUPPORT</td>
+ * <td>Makefile LUFA_OPTS</td>
+ * <td>Define to disable FLASH memory byte read/write support in the bootloader, requiring all FLASH reads and writes
+ * to be made using the block-level commands.
+ * </tr>
+ * <tr>
+ * <td>NO_LOCK_BYTE_SUPPORT</td>
+ * <td>Makefile LUFA_OPTS</td>
+ * <td>Define to disable lock byte write support in the bootloader, preventing the lock bits from being set progmatically.
* </tr>
* </table>
*/
LUFA_OPTS += -D NO_STREAM_CALLBACKS
LUFA_OPTS += -D NO_SOF_EVENTS
+#LUFA_OPTS += -D NO_BLOCK_SUPPORT
+#LUFA_OPTS += -D NO_EEPROM_BYTE_SUPPORT
+#LUFA_OPTS += -D NO_FLASH_BYTE_SUPPORT
+#LUFA_OPTS += -D NO_LOCK_BYTE_SUPPORT
+
# Create the LUFA source path variables by including the LUFA root makefile
include $(LUFA_PATH)/LUFA/makefile
#include "Descriptors.h"
-/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
+/** Device descriptor structure. This descriptor, located in SRAM memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
-/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
+/** Configuration descriptor structure. This descriptor, located in SRAM memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
}
};
-/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
+/** Language descriptor structure. This descriptor, located in SRAM memory, is returned when the host requests
* 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.
*/
* tasks for each driver is called
* - Added standard keyboard HID report scancode defines (thanks to László Monda)
* - Added new Pipe_GetBusyBanks(), Endpoint_GetBusyBanks() and Endpoint_AbortPendingIN() functions
+ * - Added new NO_BLOCK_SUPPORT, NO_EEPROM_BYTE_SUPPORT, NO_FLASH_BYTE_SUPPORT and NO_LOCK_BYTE_SUPPORT compile time options to the
+ * CDC class bootloader
*
* <b>Changed:</b>
* - Removed complicated logic for the Endpoint_ConfigureEndpoint() function to use inlined or function called versions