Fix bootloader size read-out
This commit is contained in:
parent
3ce9c60448
commit
f307eb1340
@ -340,15 +340,15 @@ static inline void performChipErase()
|
||||
};
|
||||
|
||||
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 BOOTSZ1 = 2;
|
||||
|
||||
if (extendedFuse & (1 << BOOTSZ1 | 1 << BOOTSZ0))
|
||||
if (highFuse & (1 << BOOTSZ1) && highFuse & (1 << BOOTSZ0))
|
||||
return 256 * 2;
|
||||
else if (extendedFuse & (1 << BOOTSZ1))
|
||||
else if (highFuse & (1 << BOOTSZ1))
|
||||
return 512 * 2;
|
||||
else if (extendedFuse & (1 << BOOTSZ0))
|
||||
else if (highFuse & (1 << BOOTSZ0))
|
||||
return 1024 * 2;
|
||||
return 2048 * 2;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user