From 1242755e52da799231d7e55f0b96745bb327ce81 Mon Sep 17 00:00:00 2001 From: Jenna Fox Date: Sun, 30 Sep 2012 11:10:39 +1000 Subject: =?UTF-8?q?Cleaning=20up=20some=20comments=20and=20old=20reference?= =?UTF-8?q?s=20to=20previous=20=C2=B5Boot=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firmware/Makefile | 7 +++---- firmware/main.c | 26 ++++++++++++++------------ firmware/usbconfig.h | 6 +++--- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/firmware/Makefile b/firmware/Makefile index 403786a..d1e42c2 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -1,11 +1,10 @@ # Name: Makefile -# Project: USBaspLoader -# Author: Christian Starkjohann +# Project: Micronucleus +# Author: Jenna Fox; portions by Christian Starkjohann, Louis Beaudoin # Creation Date: 2007-12-10 # Tabsize: 4 # Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH # License: GNU GPL v2 (see License.txt) -# This Revision: $Id: Makefile 798 2010-07-27 17:29:28Z cs $ ############################################################################### # Configure the following variables according to your AVR. @@ -25,7 +24,7 @@ LOCKOPT = -U lock:w:0x2f:m # - for the size of your device (8kb = 1024 * 8 = 8192) subtract above value 2124... = 6068 # - How many pages in is that? 6068 / 64 (tiny85 page size in bytes) = 94.8125 # - round that down to 94 - our new bootloader address is 94 * 64 = 6016, in hex = 1780 -BOOTLOADER_ADDRESS = 1780 +BOOTLOADER_ADDRESS = 17c0 PROGRAMMER = -c USBasp # PROGRAMMER contains AVRDUDE options to address your programmer diff --git a/firmware/main.c b/firmware/main.c index e7a39fe..675fdbe 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -1,18 +1,19 @@ /* Name: main.c - * Project: USBaspLoader - * Author: Christian Starkjohann + * Project: Micronucleus + * Author: Jenna Fox * Creation Date: 2007-12-08 * Tabsize: 4 - * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH - * Portions Copyright: (c) 2012 Louis Beaudoin + * Copyright: (c) 2012 Jenna Fox + * Portions Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH (USBaspLoader) + * Portions Copyright: (c) 2012 Louis Beaudoin (USBaspLoader-tiny85) * License: GNU GPL v2 (see License.txt) - * This Revision: $Id: main.c 786 2010-05-30 20:41:40Z cs $ */ -#define UBOOT_VERSION 2 +#define MICRONUCLEUS_VERSION_MAJOR 1 +#define MICRONUCLEUS_VERSION_MINOR 3 // how many milliseconds should host wait till it sends another erase or write? // needs to be above 4.5 (and a whole integer) as avr freezes for 4.5ms -#define UBOOT_WRITE_SLEEP 8 +#define MICRONUCLEUS_WRITE_SLEEP 8 #include @@ -69,7 +70,7 @@ static void leaveBootloader() __attribute__((__noreturn__)); //////// Stuff Bluebie Added // postscript are the few bytes at the end of programmable memory which store tinyVectors // and used to in USBaspLoader-tiny85 store the checksum iirc -#define POSTSCRIPT_SIZE 6 /* maybe it could be 4 now we do not have checksums? */ +#define POSTSCRIPT_SIZE 4 #define PROGMEM_SIZE (BOOTLOADER_ADDRESS - POSTSCRIPT_SIZE) /* max size of user program */ // verify the bootloader address aligns with page size @@ -225,7 +226,7 @@ static uchar usbFunctionSetup(uchar data[8]) { (((uint)PROGMEM_SIZE) >> 8) & 0xff, ((uint)PROGMEM_SIZE) & 0xff, SPM_PAGESIZE, - UBOOT_WRITE_SLEEP + MICRONUCLEUS_WRITE_SLEEP }; if (rq->bRequest == 0) { // get device info @@ -267,8 +268,8 @@ static uchar usbFunctionWrite(uchar *data, uchar length) { } // make sure we don't write over the bootloader! - if (currentAddress >= PROGMEM_SIZE) { - __boot_page_fill_clear(); + if (currentAddress >= BOOTLOADER_ADDRESS) { + //__boot_page_fill_clear(); break; } @@ -348,6 +349,8 @@ static inline void tiny85FlashWrites(void) { // reset system to a normal state and launch user program static inline __attribute__((noreturn)) void leaveBootloader(void) { + _delay_ms(10); // removing delay causes USB errors + //DBG1(0x01, 0, 0); bootLoaderExit(); cli(); @@ -388,7 +391,6 @@ int __attribute__((noreturn)) main(void) { # if BOOTLOADER_CAN_EXIT if (isEvent(EVENT_EXECUTE)) { // when host requests device run uploaded program - _delay_ms(10); // removing delay causes USB errors break; } # endif diff --git a/firmware/usbconfig.h b/firmware/usbconfig.h index f093a28..55707cb 100644 --- a/firmware/usbconfig.h +++ b/firmware/usbconfig.h @@ -177,19 +177,19 @@ /* -------------------------- Device Description --------------------------- */ -#define USB_CFG_VENDOR_ID 0xD0, 0x16 /* = 0x16d0 */ +#define USB_CFG_VENDOR_ID 0xD0, 0x16 /* = 0x16d0 */ /* USB vendor ID for the device, low byte first. If you have registered your * own Vendor ID, define it here. Otherwise you may use one of obdev's free * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! */ -#define USB_CFG_DEVICE_ID 0x53, 0x07 /* = 0x0753 = Digistump */ +#define USB_CFG_DEVICE_ID 0x53, 0x07 /* = 0x0753 = Digistump */ /* This is the ID of the product, low byte first. It is interpreted in the * scope of the vendor ID. If you have registered your own VID with usb.org * or if you have licensed a PID from somebody else, define it here. Otherwise * you may use one of obdev's free shared VID/PID pairs. See the file * USB-IDs-for-free.txt for details! */ -#define USB_CFG_DEVICE_VERSION UBOOT_VERSION, 0x01 +#define USB_CFG_DEVICE_VERSION MICRONUCLEUS_VERSION_MINOR, MICRONUCLEUS_VERSION_MAJOR /* Version number of the device: Minor number first, then major number. */ // electric arrow - not compliant with obdev's rules but we'll have our own vid-pid soon -- cgit v1.2.3