summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2013-12-29 20:53:45 +0100
committercpldcpu <cpldcpu@gmail.com>2013-12-29 20:53:45 +0100
commit7f1acb2ebd7cb8c309680af437ea8bb1ca48e4d8 (patch)
treef3973fbfcac6ac6f59b7743750643114b464a93c
parentb024f8aa4d9247dfaebe41f9f7b8716a2b31df68 (diff)
downloadmicronucleus-7f1acb2ebd7cb8c309680af437ea8bb1ca48e4d8.tar.gz
micronucleus-7f1acb2ebd7cb8c309680af437ea8bb1ca48e4d8.tar.bz2
micronucleus-7f1acb2ebd7cb8c309680af437ea8bb1ca48e4d8.zip
firmware: switch saves 2 bytes
-rw-r--r--firmware/bootloaderconfig.h7
-rw-r--r--firmware/main.c8
2 files changed, 11 insertions, 4 deletions
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);
diff --git a/firmware/main.c b/firmware/main.c
index 828ea8f..447ff20 100644
--- a/firmware/main.c
+++ b/firmware/main.c
@@ -299,9 +299,11 @@ int main(void) {
// All events will render the MCU unresponsive to USB traffic for a while.
if (command!=cmd_nop) _delay_ms(2);
- if (command==cmd_erase_application) eraseApplication();
- if (command==cmd_write_page) writeFlashPage();
-
+ if (command==cmd_erase_application)
+ eraseApplication();
+ else if (command==cmd_write_page)
+ writeFlashPage();
+
/* main event loop runs as long as no problem is uploaded or existing program is not executed */
} while((command!=cmd_exit)||(pgm_read_byte(BOOTLOADER_ADDRESS - TINYVECTOR_RESET_OFFSET + 1)==0xff));