Version 0.85 (20081203)
This commit is contained in:
parent
751dfff780
commit
1509afc016
19
main.c
19
main.c
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* AVRPROG compatible boot-loader
|
||||
* Version : 0.83 (Apr. 2008)
|
||||
* Version : 0.85 (Dec. 2008)
|
||||
* Compiler : avr-gcc 4.1.2 / avr-libc 1.4.6
|
||||
* size : depends on features and startup ( minmal features < 512 words)
|
||||
* by : Martin Thomas, Kaiserslautern, Germany
|
||||
@ -149,6 +149,15 @@
|
||||
#define GET_EXTENDED_FUSE_BITS 0x0002
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
// #define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate) *8UL) +5)/10 -1)
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 4UL)) / ((uint32_t)(baudRate) * 8UL) - 1)
|
||||
#else
|
||||
// #define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate)*16UL) +5)/10 -1)
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)((F_CPU) + ((uint32_t)baudRate * 8UL)) / ((uint32_t)(baudRate) * 16UL) - 1)
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
@ -367,6 +376,9 @@ int main(void)
|
||||
if ((BLPIN & (1<<BLPNUM))) {
|
||||
// jump to main app if pin is not grounded
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
#ifdef UART_DOUBLESPEED
|
||||
UART_STATUS &= ~( 1<<UART_DOUBLE );
|
||||
#endif
|
||||
jump_to_app(); // Jump to application sector
|
||||
|
||||
} else {
|
||||
@ -392,7 +404,10 @@ int main(void)
|
||||
|
||||
if ((BLPIN & (1<<BLPNUM))) {
|
||||
// jump to main app if pin is not grounded
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
BLPORT &= ~(1<<BLPNUM); // set to default
|
||||
#ifdef UART_DOUBLESPEED
|
||||
UART_STATUS &= ~( 1<<UART_DOUBLE );
|
||||
#endif
|
||||
jump_to_app(); // Jump to application sector
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,6 @@
|
||||
#define SIG_BYTE2 0x97
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
|
@ -13,12 +13,6 @@
|
||||
#define SIG_BYTE3 0x81
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
|
7
mega16.h
7
mega16.h
@ -10,13 +10,6 @@
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE3 0x03
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
|
@ -16,13 +16,6 @@
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE3 0x04
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
|
@ -8,13 +8,6 @@
|
||||
#define SIG_BYTE2 0x94
|
||||
#define SIG_BYTE1 0x05
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
|
7
mega32.h
7
mega32.h
@ -10,13 +10,6 @@
|
||||
#define SIG_BYTE2 0x95
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
|
7
mega64.h
7
mega64.h
@ -10,13 +10,6 @@
|
||||
#define SIG_BYTE2 0x96
|
||||
#define SIG_BYTE3 0x02
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate) *8UL) +5)/10 -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) (((F_CPU*10UL) / ((baudRate)*16UL) +5)/10 -1)
|
||||
#endif
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
|
@ -12,13 +12,6 @@
|
||||
#define SIG_BYTE2 0x96
|
||||
#define SIG_BYTE3 0x09
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
#define UART_BAUD_LOW UBRR0L
|
||||
#define UART_STATUS UCSR0A
|
||||
|
7
mega8.h
7
mega8.h
@ -10,13 +10,6 @@
|
||||
#define SIG_BYTE2 0x93
|
||||
#define SIG_BYTE3 0x07
|
||||
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#define UART_BAUD_HIGH UBRRH
|
||||
#define UART_BAUD_LOW UBRRL
|
||||
#define UART_STATUS UCSRA
|
||||
|
@ -1,12 +1,6 @@
|
||||
#ifndef _MEGAxx4_H_
|
||||
#define _MEGAxx4_H_
|
||||
|
||||
#ifdef UART_DOUBLESPEED
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate) *8) -1)
|
||||
#else
|
||||
#define UART_CALC_BAUDRATE(baudRate) ((uint32_t)(F_CPU) / ((uint32_t)(baudRate)*16) -1)
|
||||
#endif
|
||||
|
||||
#ifndef UART_USE_SECOND
|
||||
/* UART 0 */
|
||||
#define UART_BAUD_HIGH UBRR0H
|
||||
|
@ -30,6 +30,12 @@ Programming-Software (on the "PC-Side"):
|
||||
* Installation instructions at the end of this file.
|
||||
|
||||
|
||||
3. Dec. 2008 - Version 0.85
|
||||
|
||||
* disable U2X before jump to app as suggested be Alexander Döller
|
||||
* moved UBRR-macros to main.c and changed them. Inspired by code from avr-libc setbaud.
|
||||
(macros which are commented out (//) are from Pavel Fertser)
|
||||
|
||||
6. Nov. 2008 - Version 0.84
|
||||
|
||||
* Added definitions for ATmega64 provided by Pavel Fertser - Thanks.
|
||||
|
Loading…
Reference in New Issue
Block a user