Fix bootloader size read-out

This commit is contained in:
BlackMark 2020-04-11 23:02:16 +02:00
parent 3ce9c60448
commit f307eb1340

View File

@ -340,15 +340,15 @@ static inline void performChipErase()
}; };
constexpr auto getBootloaderSize = []() -> uint16_t { constexpr auto getBootloaderSize = []() -> uint16_t {
const auto extendedFuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS); const auto highFuse = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
constexpr auto BOOTSZ0 = 1; constexpr auto BOOTSZ0 = 1;
constexpr auto BOOTSZ1 = 2; constexpr auto BOOTSZ1 = 2;
if (extendedFuse & (1 << BOOTSZ1 | 1 << BOOTSZ0)) if (highFuse & (1 << BOOTSZ1) && highFuse & (1 << BOOTSZ0))
return 256 * 2; return 256 * 2;
else if (extendedFuse & (1 << BOOTSZ1)) else if (highFuse & (1 << BOOTSZ1))
return 512 * 2; return 512 * 2;
else if (extendedFuse & (1 << BOOTSZ0)) else if (highFuse & (1 << BOOTSZ0))
return 1024 * 2; return 1024 * 2;
return 2048 * 2; return 2048 * 2;
}; };