From 79481252081da0bdc4501cf039c060efcdf85c95 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 14 Feb 2012 12:17:30 -0500 Subject: Leonardo now checks whether bootloader should be run after a WDT event. Before the sketch initiates an auto-reset for upload it pokes a magic word into a specific RAM address. On starting the bootloader checks this address. If it finds the magic word it knows the bootloader code should run. If not it jumps straight back to sketch. Test in a sketch by adding to setup(): wdt_enable(WDTO_2S); Sketch should upload, start, run for two seconds, WDT, and sketch should restart (not bootloader). Had to cut out unused descriptor code to make the bootloader still fit in 4k. --- bootloaders/caterina_LUFA/Descriptors.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bootloaders/caterina_LUFA/Descriptors.c') diff --git a/bootloaders/caterina_LUFA/Descriptors.c b/bootloaders/caterina_LUFA/Descriptors.c index b5b1aee..f1756e2 100755 --- a/bootloaders/caterina_LUFA/Descriptors.c +++ b/bootloaders/caterina_LUFA/Descriptors.c @@ -195,14 +195,14 @@ const USB_Descriptor_String_t ProductString = .UnicodeString = L"Arduino Leonardo" }; - +/* const USB_Descriptor_String_t SerialNumString = { .Header = {.Size = USB_STRING_LEN(12), .Type = DTYPE_String}, .UnicodeString = L"000000001452" }; - +*/ const USB_Descriptor_String_t ManufNameString = { .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, @@ -246,10 +246,10 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, { Address = &ProductString; Size = ProductString.Header.Size; - } else if (DescriptorNumber == DeviceDescriptor.SerialNumStrIndex) - { - Address = &SerialNumString; - Size = SerialNumString.Header.Size; +// } else if (DescriptorNumber == DeviceDescriptor.SerialNumStrIndex) +// { +// Address = &SerialNumString; +// Size = SerialNumString.Header.Size; } else if (DescriptorNumber == DeviceDescriptor.ManufacturerStrIndex) { Address = &ManufNameString; -- cgit v1.2.3-18-g5258