From 7f1b5e11a801b4c6609870f79bbb93edab3292fd Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 15 Dec 2013 20:19:35 +0100 Subject: don't exit bootloader with clean memory --- firmware/bootloaderconfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index e1b2a4c..53c650f 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -282,7 +282,7 @@ these macros are defined, the boot loader uses them. */ #define AUTO_EXIT_NO_USB_MS 0 -#define AUTO_EXIT_MS 6000 +#define AUTO_EXIT_MS 5000 /* * Defines the setting of the RC-oscillator calibration after quitting the bootloader. (OSCCAL) -- cgit v1.2.3 From 4f3b33a40ec800bc29efeb89ec7ae32b9adbbaf5 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 12:10:51 +0100 Subject: firmware: de-clutter bootloaderconfig --- firmware/bootloaderconfig.h | 114 ++++++++++---------------------------------- 1 file changed, 25 insertions(+), 89 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 53c650f..7ad4699 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -115,81 +115,21 @@ these macros are defined, the boot loader uses them. /* ---------------------- feature / code size options ---------------------- */ /* ------------------------------------------------------------------------- */ -//#define HAVE_EEPROM_PAGED_ACCESS 0 -/* If HAVE_EEPROM_PAGED_ACCESS is defined to 1, page mode access to EEPROM is - * compiled in. Whether page mode or byte mode access is used by AVRDUDE - * depends on the target device. Page mode is only used if the device supports - * it, e.g. for the ATMega88, 168 etc. You can save quite a bit of memory by - * disabling page mode EEPROM access. Costs ~ 138 bytes. - */ -//#define HAVE_EEPROM_BYTE_ACCESS 0 -/* If HAVE_EEPROM_BYTE_ACCESS is defined to 1, byte mode access to EEPROM is - * compiled in. Byte mode is only used if the device (as identified by its - * signature) does not support page mode for EEPROM. It is required for - * accessing the EEPROM on the ATMega8. Costs ~54 bytes. - */ #define BOOTLOADER_CAN_EXIT 1 /* If this macro is defined to 1, the boot loader will exit shortly after the * programmer closes the connection to the device. Costs ~36 bytes. * Required for TINY85MODE */ -//#define HAVE_CHIP_ERASE 0 -/* If this macro is defined to 1, the boot loader implements the Chip Erase - * ISP command. Otherwise pages are erased on demand before they are written. - */ -//#define SIGNATURE_BYTES 0x1e, 0x93, 0x0b, 0 /* ATtiny85 */ -/* This macro defines the signature bytes returned by the emulated USBasp to - * the programmer software. They should match the actual device at least in - * memory size and features. If you don't define this, values for ATMega8, - * ATMega88, ATMega168 and ATMega328 are guessed correctly. - */ - -/* The following block guesses feature options so that the resulting code - * should fit into 2k bytes boot block with the given device and clock rate. - * Activate by passing "-DUSE_AUTOCONFIG=1" to the compiler. - * This requires gcc 3.4.6 for small enough code size! - */ -// #if USE_AUTOCONFIG -// # undef HAVE_EEPROM_PAGED_ACCESS -// # define HAVE_EEPROM_PAGED_ACCESS (USB_CFG_CLOCK_KHZ >= 16000) -// # undef HAVE_EEPROM_BYTE_ACCESS -// # define HAVE_EEPROM_BYTE_ACCESS 1 -// # undef BOOTLOADER_CAN_EXIT -// # define BOOTLOADER_CAN_EXIT 1 -// # undef SIGNATURE_BYTES -// #endif /* USE_AUTOCONFIG */ - -/* ------------------------------------------------------------------------- */ - -/* Example configuration: Port D bit 3 is connected to a jumper which ties - * this pin to GND if the boot loader is requested. Initialization allows - * several clock cycles for the input voltage to stabilize before - * bootLoaderCondition() samples the value. - * We use a function for bootLoaderInit() for convenience and a macro for - * bootLoaderCondition() for efficiency. - */ - -#define JUMPER_BIT 0 /* jumper is connected to this bit in port B, active low */ +/* ----------------------- Optional MCU Description ------------------------ */ /* tiny85 Architecture Specifics */ #ifndef __AVR_ATtiny85__ # error "uBoot is only designed for attiny85" #endif - #define TINY85MODE -// number of bytes before the boot loader vectors to store the tiny application vector table -#define TINYVECTOR_RESET_OFFSET 4 -#define TINYVECTOR_USBPLUS_OFFSET 2 -#define TINYVECTOR_OSCCAL_OFFSET 6 - -#define RESET_VECTOR_OFFSET 0 -#define USBPLUS_VECTOR_OFFSET 2 - -//#if BOOTLOADER_CAN_EXIT == 0 -//# define BOOTLOADER_CAN_EXIT 1 -//#endif +/* ------------- Set up interrupt configuration (CPU specific) -------------- */ // setup interrupt for Pin Change for D+ #define USB_INTR_CFG PCMSK @@ -201,12 +141,27 @@ these macros are defined, the boot loader uses them. #define USB_INTR_PENDING_BIT PCIF #define USB_INTR_VECTOR PCINT0_vect - -// uncomment for chips with clkdiv8 enabled in fuses -//#define LOW_POWER_MODE 1 +// Microcontroller Vectortable entries in the flash +#define RESET_VECTOR_OFFSET 0 +#define USBPLUS_VECTOR_OFFSET 2 + + +// number of bytes before the boot loader vectors to store the tiny application vector table +#define TINYVECTOR_RESET_OFFSET 4 +#define TINYVECTOR_USBPLUS_OFFSET 2 +#define TINYVECTOR_OSCCAL_OFFSET 6 -// set clock prescaler to a value before running user program -//#define SET_CLOCK_PRESCALER _BV(CLKPS0) /* divide by 2 for 8mhz */ + + +/* Example configuration: Port D bit 3 is connected to a jumper which ties + * this pin to GND if the boot loader is requested. Initialization allows + * several clock cycles for the input voltage to stabilize before + * bootLoaderCondition() samples the value. + * We use a function for bootLoaderInit() for convenience and a macro for + * bootLoaderCondition() for efficiency. + */ + +#define JUMPER_BIT 0 /* jumper is connected to this bit in port B, active low */ #ifdef BUILD_JUMPER_MODE @@ -241,28 +196,7 @@ these macros are defined, the boot loader uses them. #endif #endif -/* ----------------------- Optional MCU Description ------------------------ */ - -/* The following configurations have working defaults in usbdrv.h. You - * usually don't need to set them explicitly. Only if you want to run - * the driver on a device which is not yet supported or with a compiler - * which is not fully supported (such as IAR C) or if you use a different - * interrupt than INT0, you may have to define some of these. - */ -/* #define USB_INTR_CFG MCUCR */ -/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ -/* #define USB_INTR_CFG_CLR 0 */ -/* #define USB_INTR_ENABLE GIMSK */ -/* #define USB_INTR_ENABLE_BIT INT0 */ -/* #define USB_INTR_PENDING GIFR */ -/* #define USB_INTR_PENDING_BIT INTF0 */ -/* #define USB_INTR_VECTOR INT0_vect */ - -// todo: change to pin 5 -//#define DEUXVIS_JUMPER_PIN 5 -//#define digitalRead(pin) ((PINB >> pin) & 0b00000001) -//#define bootLoaderStartCondition() (!digitalRead(DEUXVIS_JUMPER_PIN)) -//#define bootLoaderCondition() (1) +/* ------------------------------------------------------------------------- */ #ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */ @@ -334,6 +268,8 @@ these macros are defined, the boot loader uses them. #endif /* __ASSEMBLER__ */ + + /* ------------------------------------------------------------------------- */ #endif /* __bootloader_h_included__ */ -- cgit v1.2.3 From cdd64a20189750fcdb5fbdadf131351907f6e712 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 12:13:59 +0100 Subject: firmware: we do not want function definition in a header file anyways --- firmware/bootloaderconfig.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 7ad4699..a3ae665 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -198,7 +198,6 @@ these macros are defined, the boot loader uses them. /* ------------------------------------------------------------------------- */ -#ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */ /* * Define bootloader timeout value. @@ -265,11 +264,6 @@ these macros are defined, the boot loader uses them. #define LED_EXIT(x) LED_DDR &=~_BV(LED_PIN); #define LED_MACRO(x) if ( x & 0xd ) {LED_DDR&=~_BV(LED_PIN);} else {LED_DDR|=_BV(LED_PIN);} -#endif /* __ASSEMBLER__ */ - - - - /* ------------------------------------------------------------------------- */ #endif /* __bootloader_h_included__ */ -- cgit v1.2.3 From 713142dceff2f12ebbb62f2196d8aed348504299 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 12:26:53 +0100 Subject: firmware: move increment idlePolls to main again --- firmware/bootloaderconfig.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index a3ae665..479d268 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -141,18 +141,16 @@ these macros are defined, the boot loader uses them. #define USB_INTR_PENDING_BIT PCIF #define USB_INTR_VECTOR PCINT0_vect -// Microcontroller Vectortable entries in the flash +// Microcontroller vectortable entries in the flash #define RESET_VECTOR_OFFSET 0 #define USBPLUS_VECTOR_OFFSET 2 - // number of bytes before the boot loader vectors to store the tiny application vector table #define TINYVECTOR_RESET_OFFSET 4 #define TINYVECTOR_USBPLUS_OFFSET 2 #define TINYVECTOR_OSCCAL_OFFSET 6 - /* Example configuration: Port D bit 3 is connected to a jumper which ties * this pin to GND if the boot loader is requested. Initialization allows * several clock cycles for the input voltage to stabilize before @@ -185,7 +183,7 @@ these macros are defined, the boot loader uses them. #else #define bootLoaderInit() #define bootLoaderExit() - #define bootLoaderCondition() (++idlePolls < (AUTO_EXIT_MS * 10UL)) + #define bootLoaderCondition() (idlePolls < (AUTO_EXIT_MS * 10UL)) #if LOW_POWER_MODE // only starts bootloader if USB D- is pulled high on startup - by putting your pullup in to an external connector // you can avoid ever entering an out of spec clock speed or waiting on bootloader when that pullup isn't there -- cgit v1.2.3 From 1a38f02b1117442b137a4a210ed250ab8fd3de21 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 12:46:06 +0100 Subject: firmware: clean up LED code --- firmware/bootloaderconfig.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 479d268..a5b1f7d 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -208,6 +208,7 @@ these macros are defined, the boot loader uses them. * (This will wait for an USB SE0 reset from the host) * AUTO_EXIT_MS The bootloader will exit after this delay if no USB communication * from the host tool was received. + * Set to 0 to disable * * All values are approx. in milliseconds */ @@ -258,10 +259,15 @@ these macros are defined, the boot loader uses them. #define LED_PORT PORTB #define LED_PIN PB1 -#define LED_INIT(x) LED_PORT &=~_BV(LED_PIN); -#define LED_EXIT(x) LED_DDR &=~_BV(LED_PIN); -#define LED_MACRO(x) if ( x & 0xd ) {LED_DDR&=~_BV(LED_PIN);} else {LED_DDR|=_BV(LED_PIN);} - +#if LED_PRESENT + #define LED_INIT(x) LED_PORT &=~_BV(LED_PIN); + #define LED_EXIT(x) LED_DDR &=~_BV(LED_PIN); + #define LED_MACRO(x) if ( x & 0xd ) {LED_DDR&=~_BV(LED_PIN);} else {LED_DDR|=_BV(LED_PIN);} +#else + #define LED_INIT(x) + #define LED_EXIT(x) + #define LED_MACRO(x) +#endif /* ------------------------------------------------------------------------- */ #endif /* __bootloader_h_included__ */ -- cgit v1.2.3 From c3de9534f78ff338031516e17f94c44480f25fed Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 13:54:18 +0100 Subject: firmware: clean up entrymode --- firmware/bootloaderconfig.h | 158 +++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 76 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index a5b1f7d..2425e3d 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -12,13 +12,6 @@ #ifndef __bootloaderconfig_h_included__ #define __bootloaderconfig_h_included__ -// uncomment this to enable the 'jumper from d5 to gnd to enable programming' mode -//#define BUILD_JUMPER_MODE 1 - -#ifndef BOOTLOADER_ADDRESS -#define BOOTLOADER_ADDRESS 0 -#endif - /* General Description: This file (together with some settings in Makefile) configures the boot loader @@ -51,46 +44,46 @@ these macros are defined, the boot loader uses them. #define HARDWARE_CONFIG TINY85_HARDWARE_CONFIG_2 #define USB_CFG_IOPORTNAME B -/* This is the port where the USB bus is connected. When you configure it to - * "B", the registers PORTB, PINB and DDRB will be used. - */ + /* This is the port where the USB bus is connected. When you configure it to + * "B", the registers PORTB, PINB and DDRB will be used. + */ #ifndef __AVR_ATtiny85__ -# define USB_CFG_DMINUS_BIT 0 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -# define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port. Please note that D+ must also be connected - * to interrupt pin INT0! - */ + # define USB_CFG_DMINUS_BIT 0 + /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. + * This may be any bit in the port. + */ + #define USB_CFG_DPLUS_BIT 2 + /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. + * This may be any bit in the port. Please note that D+ must also be connected + * to interrupt pin INT0! + */ #endif #if (defined __AVR_ATtiny85__) && (HARDWARE_CONFIG == TINY85_HARDWARE_CONFIG_1) -# define USB_CFG_DMINUS_BIT 0 -/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. - * This may be any bit in the port. - */ -# define USB_CFG_DPLUS_BIT 2 -/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. - * This may be any bit in the port, but must be configured as a pin change interrupt. - */ - #endif + #define USB_CFG_DMINUS_BIT 0 + /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. + * This may be any bit in the port. + */ + #define USB_CFG_DPLUS_BIT 2 + /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. + * This may be any bit in the port, but must be configured as a pin change interrupt. + */ +#endif #if (defined __AVR_ATtiny85__) && (HARDWARE_CONFIG == TINY85_HARDWARE_CONFIG_2) -# define USB_CFG_DMINUS_BIT 3 +#define USB_CFG_DMINUS_BIT 3 /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected. * This may be any bit in the port. */ -# define USB_CFG_DPLUS_BIT 4 +#define USB_CFG_DPLUS_BIT 4 /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected. * This may be any bit in the port, but must be configured as a pin change interrupt. */ - #endif +#endif #define USB_CFG_CLOCK_KHZ (F_CPU/1000) -/* Clock rate of the AVR in MHz. Legal values are 12000, 16000 or 16500. +/* Clock rate of the AVR in kHz. Legal values are 12000, 16000 or 16500. * The 16.5 MHz version of the code requires no crystal, it tolerates +/- 1% * deviation from the nominal frequency. All other rates require a precision * of 2000 ppm and thus a crystal! @@ -114,12 +107,6 @@ these macros are defined, the boot loader uses them. /* ------------------------------------------------------------------------- */ /* ---------------------- feature / code size options ---------------------- */ /* ------------------------------------------------------------------------- */ - -#define BOOTLOADER_CAN_EXIT 1 -/* If this macro is defined to 1, the boot loader will exit shortly after the - * programmer closes the connection to the device. Costs ~36 bytes. - * Required for TINY85MODE - */ /* ----------------------- Optional MCU Description ------------------------ */ @@ -150,53 +137,72 @@ these macros are defined, the boot loader uses them. #define TINYVECTOR_USBPLUS_OFFSET 2 #define TINYVECTOR_OSCCAL_OFFSET 6 +/* ------------------------------------------------------------------------- */ -/* Example configuration: Port D bit 3 is connected to a jumper which ties - * this pin to GND if the boot loader is requested. Initialization allows - * several clock cycles for the input voltage to stabilize before - * bootLoaderCondition() samples the value. - * We use a function for bootLoaderInit() for convenience and a macro for - * bootLoaderCondition() for efficiency. +/* + * Define Bootloader entry condition + * + * If the entry condition is not met, the bootloader will not be activated and the userprogram + * is executed directly after a reset. If no userprogram has been loaded, the bootloader + * is always active. + * + * ENTRY_ALWAYS Always activate the bootloader after reset. Required the least + * amount of code. + * + * ENTRY_WATCHDOG Activate the bootloader after a watchdog reset. This can be used + * to enter the bootloader from the user program. + * Adds 22 bytes. + * + * ENTRY_EXT_RESET Activate the bootloader after an external reset was issues by + * pulling the reset pin low. It may be necessary to add an external + * resistor to the reset pin in case the bootloader is also entered + * after power up. + * Adds 22 bytes. + * + * ENTRY_JUMPER Activate the bootloader when a specific pin is pulled low by an + * external jumper. + * Adds 34 bytes. + * + * JUMPER_PIN Pin the jumper is connected to. (e.g. PB0) + * JUMPER_PORT Port out register for the jumper (e.g. PORTB) + * JUMPER_DDR Port data direction register for the jumper (e.g. DDRB) + * JUMPER_INP Port inout register for the jumper (e.g. PINB) + * */ -#define JUMPER_BIT 0 /* jumper is connected to this bit in port B, active low */ +#define ENTRYMODE ENTRY_EXT_RESET +#define JUMPER_PIN PB0 +#define JUMPER_PORT PORTB +#define JUMPER_DDR DDRB +#define JUMPER_INP PINB + +#define ENTRY_ALWAYS 1 +#define ENTRY_WATCHDOG 2 +#define ENTRY_EXT_RESET 3 +#define ENTRY_JUMPER 4 -#ifdef BUILD_JUMPER_MODE - #define START_JUMPER_PIN 5 - #define digitalRead(pin) (PINB & _BV(pin)) - #define bootLoaderStartCondition() (!digitalRead(START_JUMPER_PIN)) - #define bootLoaderCondition() 1 - - #ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */ - static inline void bootLoaderInit(void) { - // DeuxVis pin-5 pullup - PORTB |= _BV(START_JUMPER_PIN); // has pullup enabled - _delay_ms(10); - } - static inline void bootLoaderExit(void) { - // DeuxVis pin-5 pullup - PORTB = 0; - } - #endif /* __ASSEMBLER__ */ - -#else +#if ENTRYMODE==ENTRY_ALWAYS + #define bootLoaderInit() + #define bootLoaderExit() + #define bootLoaderStartCondition() 1 +#elif ENTRYMODE==ENTRY_WATCHDOG + #define bootLoaderInit() + #define bootLoaderExit() + #define bootLoaderStartCondition() (MCUSR&_BV(WDRF)) +#elif ENTRYMODE==ENTRY_EXT_RESET #define bootLoaderInit() #define bootLoaderExit() - #define bootLoaderCondition() (idlePolls < (AUTO_EXIT_MS * 10UL)) - #if LOW_POWER_MODE - // only starts bootloader if USB D- is pulled high on startup - by putting your pullup in to an external connector - // you can avoid ever entering an out of spec clock speed or waiting on bootloader when that pullup isn't there - #define bootLoaderStartCondition() \ - (PINB & (_BV(USB_CFG_DMINUS_BIT) | _BV(USB_CFG_DMINUS_BIT))) == _BV(USB_CFG_DMINUS_BIT) - #else - #define bootLoaderStartCondition() 1 - #endif + #define bootLoaderStartCondition() (MCUSR&_BV(EXTRF)) +#elif ENTRYMODE==ENTRY_JUMPER + // Enable pull up on jumper pin and delay to stabilize input + #define bootLoaderInit() {JUMPER_DDR&=~_BV(JUMPER_PIN);JUMPER_PORT|=_BV(JUMPER_PIN);_delay_ms(1);} + #define bootLoaderExit() {JUMPER_PORT&=~_BV(JUMPER_PIN);} + #define bootLoaderStartCondition() (!(JUMPER_INP&_BV(JUMPER_PIN))) +#else + #error "No entry mode defined" #endif -/* ------------------------------------------------------------------------- */ - - /* * Define bootloader timeout value. * -- cgit v1.2.3 From 2e10478426a6f0d04099bdb24fc17102a6abde1b Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 13:56:39 +0100 Subject: firmware: default is entry_always, kill warning --- firmware/bootloaderconfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 2425e3d..392b48b 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -170,7 +170,7 @@ these macros are defined, the boot loader uses them. * */ -#define ENTRYMODE ENTRY_EXT_RESET +#define ENTRYMODE ENTRY_ALWAYS #define JUMPER_PIN PB0 #define JUMPER_PORT PORTB -- cgit v1.2.3 From 92c012796d2235e264f6cb3f3082e4a86dd74f59 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 23:06:40 +0100 Subject: firmware: fixed description --- firmware/bootloaderconfig.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 392b48b..137fb9b 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -146,17 +146,17 @@ these macros are defined, the boot loader uses them. * is executed directly after a reset. If no userprogram has been loaded, the bootloader * is always active. * - * ENTRY_ALWAYS Always activate the bootloader after reset. Required the least + * ENTRY_ALWAYS Always activate the bootloader after reset. Requires the least * amount of code. * * ENTRY_WATCHDOG Activate the bootloader after a watchdog reset. This can be used * to enter the bootloader from the user program. * Adds 22 bytes. * - * ENTRY_EXT_RESET Activate the bootloader after an external reset was issues by + * ENTRY_EXT_RESET Activate the bootloader after an external reset was issued by * pulling the reset pin low. It may be necessary to add an external - * resistor to the reset pin in case the bootloader is also entered - * after power up. + * pull-up resistor to the reset pin if this entry method appears to + * behave unreliably. * Adds 22 bytes. * * ENTRY_JUMPER Activate the bootloader when a specific pin is pulled low by an @@ -206,12 +206,13 @@ these macros are defined, the boot loader uses them. /* * Define bootloader timeout value. * - * These will only be used if is bootLoaderCondition() evaluates idlePolls below! + * The bootloader will only time out if a user program was loaded. * * AUTO_EXIT_NO_USB_MS The bootloader will exit after this delay if no USB is connected. * Set to 0 to disable * Adds ~6 bytes. * (This will wait for an USB SE0 reset from the host) + * * AUTO_EXIT_MS The bootloader will exit after this delay if no USB communication * from the host tool was received. * Set to 0 to disable -- cgit v1.2.3 From e7d1d1347cd6c220af783972a064d782047e2c56 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 28 Dec 2013 23:24:23 +0100 Subject: firmware: code clean up, consolidated wait loops to save 4 bytes --- firmware/bootloaderconfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 137fb9b..e6c44da 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -142,8 +142,8 @@ these macros are defined, the boot loader uses them. /* * Define Bootloader entry condition * - * If the entry condition is not met, the bootloader will not be activated and the userprogram - * is executed directly after a reset. If no userprogram has been loaded, the bootloader + * If the entry condition is not met, the bootloader will not be activated and the user program + * is executed directly after a reset. If no user program has been loaded, the bootloader * is always active. * * ENTRY_ALWAYS Always activate the bootloader after reset. Requires the least -- cgit v1.2.3 From 7f1acb2ebd7cb8c309680af437ea8bb1ca48e4d8 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 29 Dec 2013 20:53:45 +0100 Subject: firmware: switch saves 2 bytes --- firmware/bootloaderconfig.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index e6c44da..57f15f2 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -137,6 +137,11 @@ these macros are defined, the boot loader uses them. #define TINYVECTOR_USBPLUS_OFFSET 2 #define TINYVECTOR_OSCCAL_OFFSET 6 +/* ------------------------------------------------------------------------ */ +// postscript are the few bytes at the end of programmable memory which store tinyVectors +#define POSTSCRIPT_SIZE 6 +#define PROGMEM_SIZE (BOOTLOADER_ADDRESS - POSTSCRIPT_SIZE) /* max size of user program */ + /* ------------------------------------------------------------------------- */ /* @@ -264,7 +269,7 @@ these macros are defined, the boot loader uses them. #define LED_DDR DDRB #define LED_PORT PORTB -#define LED_PIN PB1 +#define LED_PIN PB2 #if LED_PRESENT #define LED_INIT(x) LED_PORT &=~_BV(LED_PIN); -- cgit v1.2.3 From 58514cfadd15985ff3ac279679930d372f705687 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Tue, 31 Dec 2013 00:54:19 +0100 Subject: firmware: Directly mapped command register saves 12 btes --- firmware/bootloaderconfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 57f15f2..9c06de3 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -269,7 +269,7 @@ these macros are defined, the boot loader uses them. #define LED_DDR DDRB #define LED_PORT PORTB -#define LED_PIN PB2 +#define LED_PIN PB1 #if LED_PRESENT #define LED_INIT(x) LED_PORT &=~_BV(LED_PIN); -- cgit v1.2.3 From 6d2ac9e09f61d6ff267961ba9ff79b0a07e78e28 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Tue, 31 Dec 2013 15:42:09 +0100 Subject: firmware: more global registers and unions types Saves 70(!) bytes or so.. --- firmware/bootloaderconfig.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'firmware/bootloaderconfig.h') diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 9c06de3..a93e6ff 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -12,6 +12,16 @@ #ifndef __bootloaderconfig_h_included__ #define __bootloaderconfig_h_included__ +/* + * Bootloader defines + */ + +#ifndef __ASSEMBLER__ + typedef union { + uint16_t w; + uint8_t b[2]; + } uint16_union_t; +#endif /* General Description: This file (together with some settings in Makefile) configures the boot loader -- cgit v1.2.3