From f427529a30487de45ebfbe6fbba9c290738878ab Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 30 Jun 2012 11:19:07 +0900 Subject: Fix bootloader.c --- common/bootloader.c | 68 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'common/bootloader.c') diff --git a/common/bootloader.c b/common/bootloader.c index 5cbfc72e5..cb971c704 100644 --- a/common/bootloader.c +++ b/common/bootloader.c @@ -1,22 +1,56 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. +#include +#include +#include +#include "bootloader.h" -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +/* Start Bootloader from Application + * See + * http://www.pjrc.com/teensy/jump_to_bootloader.html + * http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/_page__software_bootloader_start.html + */ -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ +/* Boot Section Size in bytes + * Teensy halfKay 512 + * Atmel DFU loader 4096 + * LUFA bootloader 4096 + */ +#ifndef BOOT_SIZE +#define BOOT_SIZE 512 +#endif -#include "bootloader.h" +#define FLASH_SIZE (FLASHEND + 1) +#define BOOTLOADER_START (FLASHEND - BOOT_SIZE) +void bootloader_jump(void) { + cli(); + // disable watchdog, if enabled + // disable all peripherals + UDCON = 1; + USBCON = (1< Date: Sat, 30 Jun 2012 13:26:09 +0900 Subject: Add Makefile.lufa to keyboard/hhkb and hbkb. --- common/bootloader.c | 1 + 1 file changed, 1 insertion(+) (limited to 'common/bootloader.c') diff --git a/common/bootloader.c b/common/bootloader.c index cb971c704..e45295cd5 100644 --- a/common/bootloader.c +++ b/common/bootloader.c @@ -9,6 +9,7 @@ * http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/_page__software_bootloader_start.html */ +// TODO: support usbasp /* Boot Section Size in bytes * Teensy halfKay 512 * Atmel DFU loader 4096 -- cgit v1.2.3 From 6d79e6579f1b769f3547856b8af56bd357580adf Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 30 Jun 2012 14:44:14 +0900 Subject: Add support of USBasp bootloader. --- common/bootloader.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'common/bootloader.c') diff --git a/common/bootloader.c b/common/bootloader.c index e45295cd5..612b94964 100644 --- a/common/bootloader.c +++ b/common/bootloader.c @@ -24,12 +24,22 @@ void bootloader_jump(void) { cli(); + + // + //Teensy + // +#if defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) // disable watchdog, if enabled // disable all peripherals UDCON = 1; USBCON = (1<