Makefiles and library modified to add a new F_CLOCK constant to give the unprescaled...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 26 Feb 2009 05:48:47 +0000 (05:48 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 26 Feb 2009 05:48:47 +0000 (05:48 +0000)
Started to clean up the AVRISP Programmer project code, donated by Opendous Inc.

40 files changed:
Bootloaders/CDC/BootloaderCDC.c
Bootloaders/CDC/BootloaderCDC.h
Bootloaders/CDC/makefile
Bootloaders/DFU/makefile
Bootloaders/TeensyHID/makefile
Demos/AudioInput/makefile
Demos/AudioOutput/makefile
Demos/BluetoothHost/makefile
Demos/CDC/makefile
Demos/CDCHost/makefile
Demos/DualCDC/makefile
Demos/Joystick/makefile
Demos/Keyboard/makefile
Demos/KeyboardFullInt/makefile
Demos/KeyboardHost/makefile
Demos/KeyboardHostViaInt/makefile
Demos/KeyboardHostWithParser/makefile
Demos/KeyboardMouse/makefile
Demos/KeyboardViaInt/makefile
Demos/MIDI/makefile
Demos/MassStorage/makefile
Demos/MassStorageHost/makefile
Demos/Mouse/makefile
Demos/MouseFullInt/makefile
Demos/MouseHost/makefile
Demos/MouseHostViaInt/makefile
Demos/MouseHostWithParser/makefile
Demos/MouseViaInt/makefile
Demos/RNDISEthernet/makefile
Demos/StillImageHost/makefile
Demos/TestApp/makefile
Demos/USBtoSerial/makefile
LUFA/ChangeLog.txt
LUFA/Drivers/USB/LowLevel/LowLevel.h
LUFA/GettingStarted.txt
LUFA/MigrationInformation.txt
Projects/AVRISP_Programmer/AVRISP_Programmer.c
Projects/AVRISP_Programmer/AVRISP_Programmer.h
Projects/AVRISP_Programmer/makefile
Projects/Magstripe/makefile

index 654eabd..54c7b7e 100644 (file)
@@ -207,7 +207,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
  *\r
  *  \param Command  Single character AVR910 protocol command indicating what memory operation to perform\r
  */\r
-static void ProgramReadWriteMemoryBlock(const uint8_t Command)\r
+static void ReadWriteMemoryBlock(const uint8_t Command)\r
 {\r
        uint16_t BlockSize;\r
        char     MemoryType;\r
@@ -503,7 +503,7 @@ TASK(CDC_Task)
                else if ((Command == 'B') || (Command == 'g'))\r
                {\r
                        /* Delegate the block write/read to a seperate function for clarity */\r
-                       ProgramReadWriteMemoryBlock(Command);\r
+                       ReadWriteMemoryBlock(Command);\r
                }\r
                else if (Command == 'R')\r
                {\r
index 0d8f1e3..a6e7755 100644 (file)
 \r
        /* Function Prototypes: */\r
                #if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)\r
-                       static void ProgramReadWriteMemoryBlock(const uint8_t Command);\r
+                       static void    ReadWriteMemoryBlock(const uint8_t Command);\r
                        static uint8_t FetchNextCommandByte(void);\r
-                       static void WriteNextResponseByte(const uint8_t Response);\r
+                       static void    WriteNextResponseByte(const uint8_t Response);\r
                #endif\r
 \r
 #endif\r
index 3fa8ad4..5045cc6 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,9 +176,11 @@ BOOT_START = 0x1E000
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=8\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 5a8e4ee..5a26b7e 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,10 +176,12 @@ BOOT_START = 0x1E000
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=32 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
-CDEFS += -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=32\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+\r
 \r
 # Place -D or -U options here for ASM sources\r
 ADEFS = -DF_CPU=$(F_CPU)\r
index 92dd8b9..a815e01 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,10 +176,12 @@ BOOT_START = 0xC000
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
-CDEFS += -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUES\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=8\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+\r
 \r
 # Place -D or -U options here for ASM sources\r
 ADEFS = -DF_CPU=$(F_CPU)\r
index 5906650..51f6cc5 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 46d7100..6c2ee32 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index b82a8ac..189c84e 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -166,9 +180,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DNO_STREAM_CALLBACKS\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 # Place -D or -U options here for ASM sources\r
 ADEFS = -DF_CPU=$(F_CPU)\r
index b2bc1e2..9b0e5bd 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 1152a89..d1e4cb9 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 50d8efe..01ab609 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 0802e2d..a29a2d3 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index b2a3bee..681f729 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 20fcc13..b1f7f89 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -158,8 +172,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 5140e7d..7ff737e 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 9cd332e..a8b3f23 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 3082b8e..ea768b4 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -164,8 +178,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index ceae7dc..7c26d2c 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index f1cb7a5..ff225b3 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 63f0513..c5cc048 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
@@ -464,7 +479,7 @@ end:
 \r
 # Display size of file.\r
 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex\r
-EELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf\r
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf\r
 MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )\r
 FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )\r
 \r
index 82e1090..2f17228 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -161,8 +175,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 2379c38..fb04798 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -163,8 +177,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 329423f..0f20dca 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 317fc31..fe85516 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index b387efe..6e8688f 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 0f8cae3..f2b86e1 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index d9fcb1b..3eec44b 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -164,8 +178,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 0316b91..571d1f6 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -159,8 +173,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 840b9d8..ba1588a 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -171,8 +185,10 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+\r
 CDEFS += -DNO_DECODE_ETHERNET -DNO_DECODE_ARP -DNO_DECODE_ICMP -DNO_DECODE_IP -DNO_DECODE_TCP -DNO_DECODE_UDP -DNO_DECODE_DHCP\r
 \r
 \r
index f2aee82..63e328a 100644 (file)
@@ -89,6 +89,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -162,8 +176,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 9d9b5fd..befc0e6 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -167,7 +181,8 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
 CDEFS += -DNUM_BLOCKS=100 -DBLOCK_SIZE=8 -DNUM_HANDLES=20\r
 \r
 \r
index 58c12b9..6703102 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -161,8 +175,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index fd21b3f..af15a96 100644 (file)
@@ -21,6 +21,8 @@
   *  - Fixed KeyboardMouse demo discarding the wIndex value in the REQ_GetReport request\r
   *  - USBtoSerial demo now discards all Rx data when not connected to a USB host, rather than buffering characters for transmission\r
   *    next time the device is attached to a host.\r
+  *  - Added new F_CLOCK compile time constant to the library and makefiles, to give the raw input clock (used to feed the PLL before any\r
+  *    clock prescaling is performed) frequency, so that the PLL prescale mask can be determined\r
   *\r
   *  \section Sec_ChangeLog090209 Version 090209\r
   *\r
index faafbd7..9721bac 100644 (file)
                #endif\r
 \r
        /* Preprocessor Checks and Defines: */\r
-               #if (F_CPU == 8000000)\r
+               #if !defined(F_CLOCK)\r
+                       #error F_CLOCK is not defined. You must device F_CLOCK to the frequency of the unprescaled input clock in your project makefile.\r
+                       #define F_CLOCK 0\r
+               #endif\r
+       \r
+               #if (F_CLOCK == 8000000)\r
                        #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))\r
                                #define USB_PLL_PSC                0\r
                        #elif (defined(__AVR_AT90USB646__)  || defined(__AVR_AT90USB647__)  || \\r
@@ -76,7 +81,7 @@
                        #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))\r
                                #define USB_PLL_PSC                0\r
                        #endif\r
-               #elif (F_CPU == 16000000)\r
+               #elif (F_CLOCK == 16000000)\r
                        #if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))\r
                                #define USB_PLL_PSC                ((1 << PLLP2) | (1 << PLLP1))\r
                        #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))\r
index 0fe3f50..a88a825 100644 (file)
  *  directory into a /Board/ folder inside the application directory, and the stub driver completed with the appropriate code to drive the\r
  *  custom board's hardware.\r
  *\r
- *  \subsection SSec_F_CPU The F_CPU Parameter\r
- *  This parameter indicates the target AVR's master clock frequency, in Hz. Consult your AVR model's datasheet for allowable clock frequencies\r
- *  if the USB interface is to be operational.\r
+ *  \subsection SSec_F_CLOCK The F_CLOCK Parameter\r
+ *  This parameter indicates the target AVR's input clock frequency, in Hz. This is the actual clock input, before any prescaling is performed. In the\r
+ *  USB AVR architecture, the input clock before any prescaling is fed directly to the PLL subsystem, and thus the PLL is derived directly from the\r
+ *  clock input. The PLL then feeds the USB and other sections of the AVR with the correct upscaled frequencies required for those sections to function.\r
  *\r
- *  <b>Note that this value does not actually *alter* the AVR's clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
+ *  <b>Note that this value does not actually *alter* the AVR's input clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
  *  of the AVR as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more\r
  *  library components will ocurr.\r
  *\r
+ *  \subsection SSec_F_CPU The F_CPU Parameter\r
+ *  This parameter indicates the target AVR's master CPU clock frequency, in Hz.\r
+ *\r
+ *  <b>Note that this value does not actually *alter* the AVR's CPU clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
+ *  of the AVR core as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more\r
+ *  library components will ocurr.\r
+ *\r
  *  \subsection SSec_CDEFS The CDEFS Parameter\r
  *  Most applications will actually have multiple CDEF lines, which are concatenated together with the "+=" operator. This ensures that large\r
  *  numbers of configuration options remain readable by splitting up groups of options into seperate lines.\r
index 1cdb55a..cd23da3 100644 (file)
  *\r
  * \section Sec_MigrationXXXXXX Migrating from 090209 to XXXXXX\r
  *\r
+ *  <b>All</b>\r
+ *    - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant "F_CLOCK",\r
+ *      defined in the project makefile and passed to the compiler via the -D switch.\r
+ *    - The makefile EEPROM programming targets for FLIP and dfu-programmer no longer program in the FLASH data in addition to the\r
+ *      EEPROM data into the device. If both are to be programmed, both the EEPROM and FLASH programming targets must be called.\r
+ *\r
+ *  <b>Library Demos</b>\r
+ *    - The USBtoSerial demo now discards all data when not connected to a host, rather than buffering it for later transmission.\r
  *\r
  * \section Sec_Migration090209 Migrating from 081217 to 090209\r
  *\r
index 4dc18cd..9ba3c0e 100644 (file)
@@ -116,7 +116,7 @@ BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);
 #define AVRDEVCODE02   0x56 /* ATtiny15 */\r
 #define AVRDEVCODE03   0x5E /* ATtiny261 */\r
 #define AVRDEVCODE04   0x76 /* ATmega8 */\r
-#define AVRDEVCODE05   0x74 /*ATmega16 */\r
+#define AVRDEVCODE05   0x74 /* ATmega16 */\r
 #define AVRDEVCODE06   0x72 /* ATmega32 */\r
 #define AVRDEVCODE07   0x45 /* ATmega64 */\r
 #define AVRDEVCODE08   0x74 /* ATmega644 */\r
@@ -155,20 +155,8 @@ RingBuff_t Tx_Buffer;
 /** Flag to indicate if the USART is currently transmitting data from the Rx_Buffer circular buffer. */\r
 volatile bool Transmitting = false;\r
 \r
-\r
 /* some global variables used throughout */\r
-uint8_t tempIOreg = 0;\r
-uint8_t tempIOreg2 = 0;\r
-uint8_t tempIOreg3 = 0;\r
-uint8_t tempIOreg4 = 0;\r
-uint8_t dataWidth = 0;\r
-uint8_t firstRun = 1;\r
-uint8_t deviceCode = 0;\r
-uint8_t tempByte = 0;\r
 uint16_t currAddress = 0;\r
-uint16_t timerval = 0;\r
-\r
-\r
 \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
     starts the scheduler to run the application tasks.\r
@@ -185,9 +173,7 @@ int main(void)
        /* Hardware Initialization */\r
        LEDs_Init();\r
        ReconfigureSPI();\r
-    // prepare PortB\r
-       DDRB = 0;\r
-       PORTB = 0;\r
+\r
        DDRC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2\r
        // PC2 is also used for RESET, so set it HIGH initially - note 'P' command sets it to LOW (Active)\r
        PORTC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2\r
@@ -198,15 +184,7 @@ int main(void)
        PORTB |= (1 << PB0);\r
     // make sure DataFlash devices to not interfere - deselect them by setting PE0 and PE1 HIGH:\r
     PORTE = 0xFF;\r
-    DDRE = 0xFF;\r
-\r
-       // initialize Timer1 for use in delay function\r
-       TCCR1A = 0;\r
-       //TCCR1B = (1 << CS10); // no prescaling, use CLK\r
-       TCCR1B = ((1 << CS12) | (1 << CS10)); // prescale by CLK/1024\r
-       // 8MHz/1024 = 7813 ticks per second --> ~8 ticks per millisecond (ms)\r
-       timerval = TCNT1; // start timer1\r
-\r
+    DDRE  = 0xFF;\r
 \r
        /* Ringbuffer Initialization */\r
        Buffer_Initialize(&Rx_Buffer);\r
@@ -320,17 +298,6 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
                case REQ_SetControlLineState:\r
                        if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-#if 0\r
-                               /* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake\r
-                                        lines. The mask is read in from the wValue parameter, and can be masked against the CONTROL_LINE_OUT_* masks\r
-                                        to determine the RTS and DTR line states using the following code:\r
-                               */\r
-\r
-                               uint16_t wIndex = Endpoint_Read_Word_LE();\r
-                                       \r
-                               // Do something with the given line states in wIndex\r
-#endif\r
-                               \r
                                /* Acknowedge the SETUP packet, ready for data transfer */\r
                                Endpoint_ClearSetupReceived();\r
                                \r
@@ -347,30 +314,6 @@ TASK(CDC_Task)
 {\r
        if (USB_IsConnected)\r
        {\r
-#if 0\r
-               /* NOTE: Here you can use the notification endpoint to send back line state changes to the host, for the special RS-232\r
-                                handshake signal lines (and some error states), via the CONTROL_LINE_IN_* masks and the following code:\r
-               */\r
-\r
-               USB_Notification_Header_t Notification = (USB_Notification_Header_t)\r
-                       {\r
-                               NotificationType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),\r
-                               Notification:     NOTIF_SerialState,\r
-                               wValue:           0,\r
-                               wIndex:           0,\r
-                               wLength:          sizeof(uint16_t),\r
-                       };\r
-                       \r
-               uint16_t LineStateMask;\r
-               \r
-               // Set LineStateMask here to a mask of CONTROL_LINE_IN_* masks to set the input handshake line states to send to the host\r
-               \r
-               Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);\r
-               Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));\r
-               Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));\r
-               Endpoint_ClearCurrentBank();\r
-#endif\r
-\r
                /* Select the Serial Rx Endpoint */\r
                Endpoint_SelectEndpoint(CDC_RX_EPNUM);\r
                \r
@@ -385,72 +328,41 @@ TASK(CDC_Task)
                                /* Store each character from the endpoint */\r
                                Buffer_StoreElement(&Rx_Buffer, Endpoint_Read_Byte());\r
 \r
-\r
-\r
-\r
-                /* Each time there is an element, check which comand should be\r
-                       run and if enough data is available to run that command.\r
-                       There are 1-byte, 2-byte, 3-byte, 4-byte commands, and 5-byte commands\r
-                       Remember that the "which command" byte counts as 1 */\r
-                if (Rx_Buffer.Elements == 0) {\r
-                       // do nothing, wait for data\r
-                } else {\r
-                       tempByte = Buffer_PeekElement(&Rx_Buffer); // peek at first element\r
-\r
-                               /* make sure the issued command and associated data are all ready */\r
-                       if (Rx_Buffer.Elements == 1) { // zero data byte command\r
-                               if ((tempByte == 'P') | (tempByte == 'a') | (tempByte == 'm') |\r
-                               (tempByte == 'R') | (tempByte == 'd') | (tempByte == 'e') |\r
-                               (tempByte == 'L') | (tempByte == 's') | (tempByte == 't') | \r
-                               (tempByte == 'S') | (tempByte == 'V') | (tempByte == 'v') |\r
-                               (tempByte == 'p') | (tempByte == 'F')) {\r
-                       processHostSPIRequest(); // command has enough data, process it\r
-                               }\r
-                       } else if (Rx_Buffer.Elements == 2) { // one data byte command\r
-                               if ((tempByte == 'T') | (tempByte == 'c') | (tempByte == 'C') |\r
-                                       (tempByte == 'D') | (tempByte == 'l') | (tempByte == 'f') |\r
-                                       (tempByte == 'x') | (tempByte == 'y')) {\r
-                                       processHostSPIRequest(); // command has enough data, process it\r
-                               }\r
-                       } else if (Rx_Buffer.Elements == 3) { // two data byte command\r
-                               if ((tempByte == 'A') | (tempByte == 'Z')) {\r
-                                       processHostSPIRequest(); // command has enough data, process it\r
-                               }\r
-                       } else if (Rx_Buffer.Elements == 4) { // three data byte command\r
-                               if ((tempByte == ':')) {\r
-                       processHostSPIRequest(); // command has enough data, process it\r
-                               }\r
-                       } else if (Rx_Buffer.Elements == 5) { // four data byte command\r
-                               if ((tempByte == '.')) {\r
-                                       processHostSPIRequest(); // command has enough data, process it\r
-                               }\r
-                       } else {\r
-                               // do nothing\r
-                       }\r
+                /* Run the given command once enough data is available. */\r
+                if (Rx_Buffer.Elements)\r
+                               {\r
+                                       const uint8_t ZeroDataByteCommands[]  = {'P', 'a', 'm', 'R', 'd', 'e', 'L', 's', 't', 'S', 'V', 'v', 'p', 'F'};\r
+                                       const uint8_t OneDataByteCommands[]   = {'T', 'c', 'C', 'D', 'l', 'f', 'x', 'y'};\r
+                                       const uint8_t TwoDataByteCommands[]   = {'A', 'Z'};\r
+                                       const uint8_t ThreeDataByteCommands[] = {':'};\r
+                                       const uint8_t FourDataByteCommands[]  = {'.'};\r
+                                       \r
+                                       const struct\r
+                                       {\r
+                                               const uint8_t  TotalCommands;\r
+                                               const uint8_t* CommandBytes;\r
+                                       } AVR910Commands[] = {{sizeof(ZeroDataByteCommands),  ZeroDataByteCommands},\r
+                                                             {sizeof(OneDataByteCommands),   OneDataByteCommands},\r
+                                                             {sizeof(TwoDataByteCommands),   TwoDataByteCommands},\r
+                                                             {sizeof(ThreeDataByteCommands), ThreeDataByteCommands},\r
+                                                             {sizeof(FourDataByteCommands),  FourDataByteCommands}};\r
+                                       \r
+                                       /* Determine the data length of the issued command */\r
+                                       uint8_t CommandDataLength = (Rx_Buffer.Elements - 1);\r
+                                       \r
+                                       /* Loop through each of the possible command bytes allowable from the given command data length */\r
+                                       for (uint8_t CurrentCommand = 0; CurrentCommand < AVR910Commands[CommandDataLength].TotalCommands; CurrentCommand++)\r
+                                       {\r
+                                               /* If issues command matches an allowable command, process it */\r
+                                               if (Buffer_PeekElement(&Rx_Buffer) == AVR910Commands[CommandDataLength].CommandBytes[CurrentCommand])\r
+                                                 processHostSPIRequest();\r
+                                       }\r
                 }\r
-\r
-\r
-\r
                        }\r
                        \r
                        /* Clear the endpoint buffer */\r
                        Endpoint_ClearCurrentBank();\r
                }\r
-               \r
-               /* Check if Rx buffer contains data */\r
-               if (Rx_Buffer.Elements)\r
-               {\r
-                       /* Initiate the transmission of the buffer contents if USART idle */\r
-                       if (!(Transmitting))\r
-                       {\r
-                               Transmitting = true;\r
-                               /* The following flushes the receive buffer to prepare for new data and commands */\r
-                               /* Need to flush the buffer as the command byte which is peeked above needs to be */\r
-                               /*  dealt with, otherwise the command bytes will overflow the buffer eventually */\r
-                               //Buffer_GetElement(&Rx_Buffer); // works also\r
-                               Buffer_Initialize(&Rx_Buffer);\r
-                       }\r
-               }\r
 \r
                /* Select the Serial Tx Endpoint */\r
                Endpoint_SelectEndpoint(CDC_TX_EPNUM);\r
@@ -484,12 +396,10 @@ TASK(CDC_Task)
        }\r
 }\r
 \r
-\r
-\r
 /** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to\r
   log to a serial port, or anything else that is suitable for status updates.\r
*  log to a serial port, or anything else that is suitable for status updates.\r
  *\r
   \param CurrentStatus  Current status of the system, from the USBtoSerial_StatusCodes_t enum\r
*  \param CurrentStatus  Current status of the system, from the USBtoSerial_StatusCodes_t enum\r
  */\r
 void UpdateStatus(uint8_t CurrentStatus)\r
 {\r
@@ -513,22 +423,12 @@ void UpdateStatus(uint8_t CurrentStatus)
        LEDs_SetAllLEDs(LEDMask);\r
 }\r
 \r
-\r
 /** Reconfigures SPI to match the current serial port settings issued by the host. */\r
 void ReconfigureSPI(void)\r
 {\r
        uint8_t SPCRmask = (1 << SPE) | (1 << MSTR); // always enable SPI as Master\r
        uint8_t SPSRmask = 0;\r
 \r
-       /* Determine data width */\r
-       if (LineCoding.ParityType == Parity_Odd) {\r
-               dataWidth = 16;\r
-       } else if (LineCoding.ParityType == Parity_Even) {\r
-               dataWidth = 32;\r
-       } else if (LineCoding.ParityType == Parity_None) {\r
-               dataWidth = 8;\r
-       }\r
-\r
        /* Determine stop bits - 1.5 stop bits is set as 1 stop bit due to hardware limitations */\r
        /* For SPI, determine whether format is LSB or MSB */\r
        if (LineCoding.CharFormat == TwoStopBits) {     \r
@@ -579,14 +479,6 @@ void ReconfigureSPI(void)
 \r
        SPCR = SPCRmask;\r
        SPSR = SPSRmask;\r
-\r
-       // only read if first run\r
-       if (firstRun) {\r
-               tempIOreg = SPSR; //need to read to initiliaze\r
-               tempIOreg = SPDR; //need to read to initiliaze\r
-               firstRun = 0;\r
-       }\r
-\r
 }\r
 \r
 \r
@@ -642,20 +534,20 @@ void processHostSPIRequest(void) {
                //PORTB = 0; // set clock to zero\r
                RESETPORT = (1 << RESETPIN); // set RESET pin on target to 1\r
                RESETPORT2 = (1 << RESETPIN2);\r
-               delay_ms(DELAY_SHORT);\r
+               _delay_ms(DELAY_SHORT);\r
                //RESETPORT = (RESETPORT & ~(1 << RESETPIN)); // set RESET pin on target to 0 - Active\r
                RESETPORT = 0x00;\r
                RESETPORT2 = 0;\r
-               delay_ms(DELAY_SHORT);\r
+               _delay_ms(DELAY_SHORT);\r
                SPI_SendByte(0xAC);\r
                SPI_SendByte(0x53);\r
                SPI_SendByte(0x00);\r
                SPI_SendByte(0x00);\r
-               delay_ms(DELAY_VERYSHORT);\r
+               _delay_ms(DELAY_VERYSHORT);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'T') { // Select device type\r
-               deviceCode = Buffer_GetElement(&Rx_Buffer); // set device type\r
+               Buffer_GetElement(&Rx_Buffer); // set device type\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'a') { // Report autoincrement address\r
@@ -675,7 +567,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte((currAddress >> 8)); // high byte\r
                SPI_SendByte((currAddress)); // low byte\r
                SPI_SendByte(readByte1); // data\r
-               delay_ms(DELAY_MEDIUM); // certain MCUs require a delay of about 24585 cycles\r
+               _delay_ms(DELAY_MEDIUM); // certain MCUs require a delay of about 24585 cycles\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'C') { // Write program memory, high byte\r
@@ -694,7 +586,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte((currAddress >> 8)); // high byte\r
                SPI_SendByte((currAddress)); // low byte\r
                SPI_SendByte(0x00);\r
-               delay_ms(DELAY_LONG);\r
+               _delay_ms(DELAY_LONG);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'R') { // Read Program Memory\r
@@ -719,7 +611,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte((currAddress >> 8)); // high byte\r
                SPI_SendByte((currAddress)); // low byte\r
                SPI_SendByte(readByte1); // data\r
-               delay_ms(DELAY_MEDIUM);\r
+               _delay_ms(DELAY_MEDIUM);\r
                currAddress++; // increment currAddress\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
@@ -738,7 +630,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte(0x80);\r
                SPI_SendByte(0x04);\r
                SPI_SendByte(0x00);\r
-               delay_ms(DELAY_LONG);\r
+               _delay_ms(DELAY_LONG);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'l') { // write lock bits\r
@@ -748,7 +640,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte(((0x06 & readByte1) | 0xE0)); // TODO - is this correct???\r
                SPI_SendByte(0x00);\r
                SPI_SendByte(0x00);\r
-               delay_ms(DELAY_MEDIUM);\r
+               _delay_ms(DELAY_MEDIUM);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'f') { // write fuse bits\r
@@ -840,7 +732,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte(readByte3);\r
                readByte1 = SPI_TransferByte(0x00);\r
                Buffer_StoreElement(&Tx_Buffer, readByte1);\r
-               delay_ms(DELAY_MEDIUM);\r
+               _delay_ms(DELAY_MEDIUM);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == '.') { // New Universal Command\r
@@ -854,7 +746,7 @@ void processHostSPIRequest(void) {
                SPI_SendByte(readByte3);\r
                readByte1 = SPI_TransferByte(readByte4);\r
                Buffer_StoreElement(&Tx_Buffer, readByte1);\r
-               delay_ms(DELAY_MEDIUM);\r
+               _delay_ms(DELAY_MEDIUM);\r
                Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
 \r
        } else if (firstByte == 'Z') { // Special test command\r
@@ -868,19 +760,3 @@ void processHostSPIRequest(void) {
        }\r
 }\r
 \r
-\r
-void delay_ms(uint8_t dly) {\r
-       uint16_t endtime = 0;\r
-\r
-       endtime = TCNT1;\r
-       if (endtime > 63486) {\r
-               endtime = (dly * DELAY_MULTIPLE);\r
-       } else {\r
-               endtime += (dly * DELAY_MULTIPLE);\r
-       }\r
-\r
-       timerval = TCNT1;\r
-       while (timerval < endtime) {\r
-               timerval = TCNT1;\r
-       }\r
-}\r
index e78ba29..4c98d6b 100644 (file)
@@ -37,6 +37,7 @@
 #define _AVRISP_PROGRAMMER_H_\r
 \r
        /* Includes: */\r
+               #include <util/delay.h>\r
                #include <avr/io.h>\r
                #include <avr/wdt.h>\r
                #include <avr/interrupt.h>\r
                void ReconfigureSPI(void);\r
                void UpdateStatus(uint8_t CurrentStatus);\r
                void processHostSPIRequest(void);\r
-               void delay_ms(uint8_t dly);\r
 \r
 #endif\r
index d6617dc..f8d75b6 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 8000000\r
 \r
 \r
+# Input clock frequency.\r
+#     This will define a symbol, F_CLOCK, in all source code files equal to the \r
+#     input clock frequency (before any prescaling is performed). This value may\r
+#     differ from F_CPU if prescaling is used on the latter, and is required as the\r
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+#     at the end, this will be done automatically to create a 32-bit value in your\r
+#     source code.\r
+#\r
+#     If no clock division is performed on the input clock inside the AVR (via the\r
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
 # Output format. (can be srec, ihex, binary)\r
 FORMAT = ihex\r
 \r
@@ -161,8 +175,9 @@ CSTANDARD = -std=gnu99
 \r
 \r
 # Place -D or -U options here for C sources\r
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
 \r
 \r
 # Place -D or -U options here for ASM sources\r
index 2ea5536..1099760 100644 (file)
@@ -90,6 +90,20 @@ BOARD  = USBKEY
 F_CPU = 16000000
 
 
+# Input clock frequency.
+#     This will define a symbol, F_CLOCK, in all source code files equal to the 
+#     input clock frequency (before any prescaling is performed). This value may
+#     differ from F_CPU if prescaling is used on the latter, and is required as the
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+#     at the end, this will be done automatically to create a 32-bit value in your
+#     source code.
+#
+#     If no clock division is performed on the input clock inside the AVR (via the
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = 8000000
+
+
 # Output format. (can be srec, ihex, binary)
 FORMAT = ihex
 
@@ -160,8 +174,9 @@ CSTANDARD = -std=gnu99
 
 
 # Place -D or -U options here for C sources
-CDEFS  = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
 
 CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
 CDEFS += -DMAG_T1_DATA="(1 << 1)"