Add checks to the bootloaders so that they will give a user-friendly compile error if not compiled with size optimizations.

pull/1469/head
Dean Camera 12 years ago
parent 09ae9ad004
commit ace61d757e

@ -52,6 +52,11 @@
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
/* Preprocessor Checks: */
#if !defined(__OPTIMIZE_SIZE__)
#error This bootloader requires that it be compiled for size, not speed for it to fit into the target device.
#endif
/* Macros: */ /* Macros: */
/** Version major of the CDC bootloader. */ /** Version major of the CDC bootloader. */
#define BOOTLOADER_VERSION_MAJOR 0x01 #define BOOTLOADER_VERSION_MAJOR 0x01

@ -54,13 +54,18 @@
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
/* Preprocessor Checks: */
#if !defined(__OPTIMIZE_SIZE__)
#error This bootloader requires that it be compiled for size, not speed for it to fit into the target device.
#endif
/* Macros: */ /* Macros: */
/** Major bootloader version number. */ /** Major bootloader version number. */
#define BOOTLOADER_VERSION_MINOR 2 #define BOOTLOADER_VERSION_MINOR 2
/** Minor bootloader version number. */ /** Minor bootloader version number. */
#define BOOTLOADER_VERSION_REV 0 #define BOOTLOADER_VERSION_REV 0
/** Magic bootloader key to unlock forced application start mode. */ /** Magic bootloader key to unlock forced application start mode. */
#define MAGIC_BOOT_KEY 0xDC42 #define MAGIC_BOOT_KEY 0xDC42
@ -203,7 +208,7 @@
static void ProcessWriteCommand(void); static void ProcessWriteCommand(void);
static void ProcessReadCommand(void); static void ProcessReadCommand(void);
#endif #endif
void Application_Jump_Check(void) ATTR_INIT_SECTION(3); void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
#endif #endif

@ -48,18 +48,23 @@
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
/* Preprocessor Checks: */
#if !defined(__OPTIMIZE_SIZE__)
#error This bootloader requires that it be compiled for size, not speed for it to fit into the target device.
#endif
/* Macros: */ /* Macros: */
/** Bootloader special address to start the user application */ /** Bootloader special address to start the user application */
#define COMMAND_STARTAPPLICATION 0xFFFF #define COMMAND_STARTAPPLICATION 0xFFFF
/** Magic bootloader key to unlock forced application start mode. */ /** Magic bootloader key to unlock forced application start mode. */
#define MAGIC_BOOT_KEY 0xDC42 #define MAGIC_BOOT_KEY 0xDC42
/* Function Prototypes: */ /* Function Prototypes: */
static void SetupHardware(void); static void SetupHardware(void);
void Application_Jump_Check(void) ATTR_INIT_SECTION(3); void Application_Jump_Check(void) ATTR_INIT_SECTION(3);
void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void); void EVENT_USB_Device_UnhandledControlRequest(void);

@ -50,6 +50,11 @@
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
/* Preprocessor Checks: */
#if !defined(__OPTIMIZE_SIZE__)
#error This bootloader requires that it be compiled for size, not speed for it to fit into the target device.
#endif
/* Macros: */ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1

@ -47,6 +47,11 @@
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h> #include <LUFA/Drivers/Board/LEDs.h>
/* Preprocessor Checks: */
#if !defined(__OPTIMIZE_SIZE__)
#error This bootloader requires that it be compiled for size, not speed for it to fit into the target device.
#endif
/* Macros: */ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1 #define LEDMASK_USB_NOTREADY LEDS_LED1

Loading…
Cancel
Save