Skip to content

Commit

Permalink
examples: uno: Fix EEPROM example
Browse files Browse the repository at this point in the history
The EEPROM example had a stack overflow problem due to reading the
entire EEPROM capacity into SRAM at once.  Fix this by just reading less
data in the example program.
  • Loading branch information
fvilante authored Jun 9, 2023
1 parent 60b24fc commit 9433af7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/arduino-uno/src/bin/uno-eeprom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ fn main() -> ! {
let ep_capacity = ep.capacity();
ufmt::uwriteln!(&mut serial, "eeprom capacity is:{}\r", ep_capacity).void_unwrap();

let mut data = [0_u8; arduino_hal::Eeprom::CAPACITY as usize];
// KNOWN ISSUE: Avoid to read entire eeprom capacity at once
// See: https://github.com/Rahix/avr-hal/issues/410
let mut data = [0_u8; 10];

let _start_address: u16 = 0;

if ep.read(0, &mut data).is_err() {
Expand Down

0 comments on commit 9433af7

Please sign in to comment.