aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/avr/bootloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/avr/bootloader.c')
-rw-r--r--tmk_core/common/avr/bootloader.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index 5f9ecc510..ca9746f32 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -59,11 +59,6 @@
59uint16_t bootloader_start; 59uint16_t bootloader_start;
60#endif 60#endif
61 61
62#define BOOT_SIZE_256 0b110
63#define BOOT_SIZE_512 0b100
64#define BOOT_SIZE_1024 0b010
65#define BOOT_SIZE_2048 0b000
66
67// compatibility between ATMega8 and ATMega88 62// compatibility between ATMega8 and ATMega88
68#if !defined(MCUCSR) 63#if !defined(MCUCSR)
69# if defined(MCUSR) 64# if defined(MCUSR)
@@ -86,11 +81,11 @@ void bootloader_jump(void) {
86#if !defined(BOOTLOADER_SIZE) 81#if !defined(BOOTLOADER_SIZE)
87 uint8_t high_fuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS); 82 uint8_t high_fuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
88 83
89 if (high_fuse & BOOT_SIZE_256) { 84 if (high_fuse & ~(FUSE_BOOTSZ0 & FUSE_BOOTSZ1)) {
90 bootloader_start = (FLASH_SIZE - 512) >> 1; 85 bootloader_start = (FLASH_SIZE - 512) >> 1;
91 } else if (high_fuse & BOOT_SIZE_512) { 86 } else if (high_fuse & ~(FUSE_BOOTSZ1)) {
92 bootloader_start = (FLASH_SIZE - 1024) >> 1; 87 bootloader_start = (FLASH_SIZE - 1024) >> 1;
93 } else if (high_fuse & BOOT_SIZE_1024) { 88 } else if (high_fuse & ~(FUSE_BOOTSZ0)) {
94 bootloader_start = (FLASH_SIZE - 2048) >> 1; 89 bootloader_start = (FLASH_SIZE - 2048) >> 1;
95 } else { 90 } else {
96 bootloader_start = (FLASH_SIZE - 4096) >> 1; 91 bootloader_start = (FLASH_SIZE - 4096) >> 1;