summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2013-10-09 08:41:20 +0200
committercpldcpu <cpldcpu@gmail.com>2013-10-09 08:41:20 +0200
commitd2853848057e708ac8c5d824f87020bfa3d8ae69 (patch)
tree7608d9aed9737139dc1cd49216dc45819cd3fad9
parentbced3d4297215c0bc6c8df4c75f2d1044cd0fdaa (diff)
downloadmicronucleus-d2853848057e708ac8c5d824f87020bfa3d8ae69.tar.gz
micronucleus-d2853848057e708ac8c5d824f87020bfa3d8ae69.tar.bz2
micronucleus-d2853848057e708ac8c5d824f87020bfa3d8ae69.zip
tiny85FlashInit(); only checks on byte now
20 bytes less
-rw-r--r--firmware/main.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/firmware/main.c b/firmware/main.c
index c24e8be..d0c7722 100644
--- a/firmware/main.c
+++ b/firmware/main.c
@@ -345,12 +345,9 @@ static inline void tiny85FlashInit(void) {
// check for erased first page (no bootloader interrupt vectors), add vectors if missing
// this needs to happen for usb communication to work later - essential to first run after bootloader
// being installed
- if(pgm_read_word(RESET_VECTOR_OFFSET * 2) != 0xC000 + (BOOTLOADER_ADDRESS/2) - 1 ||
- pgm_read_word(USBPLUS_VECTOR_OFFSET * 2) != 0xC000 + (BOOTLOADER_ADDRESS/2) - 1) {
-
- fillFlashWithVectors();
- }
+ if(pgm_read_byte(RESET_VECTOR_OFFSET * 2+1) == 0xff) fillFlashWithVectors(); // write vectors if flash is empty
+
// TODO: necessary to reset currentAddress?
currentAddress = 0;
}