summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2014-03-06 12:43:22 +0100
committercpldcpu <cpldcpu@gmail.com>2014-03-06 12:43:22 +0100
commit9f444ad4f78c772dd10ed1eedec3f817a297c71c (patch)
tree0f0b8002dbb3dd667bdd5560f52a64e7a5681706 /firmware
parent340b130a1e8d560aa12f38264722cfaeb977b89c (diff)
downloadmicronucleus-9f444ad4f78c772dd10ed1eedec3f817a297c71c.tar.gz
micronucleus-9f444ad4f78c772dd10ed1eedec3f817a297c71c.tar.bz2
micronucleus-9f444ad4f78c772dd10ed1eedec3f817a297c71c.zip
firmware: move device configureation to header file
Diffstat (limited to 'firmware')
-rw-r--r--firmware/bootloaderconfig.h12
-rw-r--r--firmware/main.c5
2 files changed, 11 insertions, 6 deletions
diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h
index 3c1fba5..15f3dcf 100644
--- a/firmware/bootloaderconfig.h
+++ b/firmware/bootloaderconfig.h
@@ -59,6 +59,14 @@
#define USB_INTR_VECTOR PCINT0_vect
/* ------------------------------------------------------------------------- */
+/* Configuration relevant to the CPU the bootloader is running on */
+/* ------------------------------------------------------------------------- */
+
+// 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 MICRONUCLEUS_WRITE_SLEEP 5
+
+
/* ---------------------- feature / code size options ---------------------- */
/* Configure the behavior of the bootloader here */
/* ------------------------------------------------------------------------- */
@@ -175,8 +183,8 @@
* comes with its own OSCCAL calibration or an external clock source is used.
*/
-#define OSCCAL_RESTORE 0
-#define OSCCAL_16_5MHz 1
+#define OSCCAL_RESTORE 1
+#define OSCCAL_16_5MHz 0
#define OSCCAL_HAVE_XTAL 0
/*
diff --git a/firmware/main.c b/firmware/main.c
index 1c265c7..2b9e359 100644
--- a/firmware/main.c
+++ b/firmware/main.c
@@ -23,10 +23,6 @@
#include "bootloaderconfig.h"
#include "usbdrv/usbdrv.c"
-// 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 MICRONUCLEUS_WRITE_SLEEP 5
-
// verify the bootloader address aligns with page size
#if BOOTLOADER_ADDRESS % SPM_PAGESIZE != 0
#error "BOOTLOADER_ADDRESS in makefile must be a multiple of chip's pagesize"
@@ -148,6 +144,7 @@ static void writeWordToPageBuffer(uint16_t data) {
// the device can not be bricked.
// Saving user-reset-vector is done in the host tool, starting with
// firmware V2
+
#if BOOTLOADER_ADDRESS < 8192
// rjmp
if (currentAddress.w == RESET_VECTOR_OFFSET * 2) {