Skip to content

Commit

Permalink
Add bootloader present check
Browse files Browse the repository at this point in the history
  • Loading branch information
MCUdude committed Apr 6, 2021
1 parent 5b3bec6 commit 48b9f82
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ void setup()
delay(2000);
Serial.begin(9600);

if(!flash.check_writable())
{
Serial.println(F("Incompatible or no bootloader present! Please burn correct bootloader"));
while(1);
}

// If the allocated flash space is above 64kiB, a 16-bit pointer won't be enough anymore.
// As a workaround, you can set the address to the allocated space like this, and the
// library will handle the rest. You'll also have to allocate your flash space in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ void setup()
delay(2000);
Serial.begin(9600);

if(!flash.check_writable())
{
Serial.println(F("Incompatible or no bootloader present! Please burn correct bootloader"));
while(1);
}

// If the allocated flash space is above 64kiB, a 16-bit pointer won't be enough anymore.
// As a workaround, you can set the address to the allocated space like this, and the
// library will handle the rest. You'll also have to allocate your flash space in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ void setup()
delay(2000);
Serial.begin(9600);

if(!optiboot_check_writable())
{
Serial.println(F("Incompatible or no bootloader present! Please burn correct bootloader"));
while(1);
}

static uint16_t addr = 0;

Serial.print(F("Filling up flash page 0 with 16-bit values...\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ void setup()
{
// Initialize serial
Serial.begin(9600);

if(!optiboot_check_writable())
{
Serial.println(F("Incompatible or no bootloader present! Please burn correct bootloader"));
while(1);
}
}


Expand Down
1 change: 1 addition & 0 deletions avr/libraries/Optiboot_flasher/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ put KEYWORD2

# Optiboot
do_spm_cli KEYWORD2
optiboot_check_writable KEYWORD2
optiboot_page_erase KEYWORD2
optiboot_page_fill KEYWORD2
optiboot_page_write KEYWORD2
Expand Down

0 comments on commit 48b9f82

Please sign in to comment.