Skip to content

Commit 7c3004b

Browse files
authored
Fix freeze bug in FlashKeyValue.ino
The old version contained code like this: Serial.println("FlashIAP block device size: " + blockDevice.size()); This adds a large number (the block device size) to the address of the string literal before the + sign. It becomes an illegal address, which triggers a BusFault exception, and the sketch freezes after printing "FlashIAPBlockDevice + TDBStore Test."
1 parent 8c3aebe commit 7c3004b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: examples/Creating a Flash-Optimised Key-Value Store/FlashKeyValue/FlashKeyValue.ino

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ void setup()
3535

3636
// Initialize the flash IAP block device and print the memory layout
3737
blockDevice.init();
38-
Serial.println("FlashIAP block device size: " + blockDevice.size());
39-
Serial.println("FlashIAP block device read size: " + blockDevice.get_read_size());
40-
Serial.println("FlashIAP block device program size: " + blockDevice.get_program_size());
41-
Serial.println("FlashIAP block device erase size: " + blockDevice.get_erase_size());
38+
Serial.print("FlashIAP block device size: ");
39+
Serial.println(blockDevice.size());
40+
Serial.print("FlashIAP block device read size: ");
41+
Serial.println(blockDevice.get_read_size());
42+
Serial.print("FlashIAP block device program size: ");
43+
Serial.println(blockDevice.get_program_size());
44+
Serial.print("FlashIAP block device erase size: ");
45+
Serial.println(blockDevice.get_erase_size());
4246
// Deinitialize the device
4347
blockDevice.deinit();
4448

0 commit comments

Comments
 (0)