Firmware won't run when using embedded_graphics

I'm trying to get into embedded programming. I got myself ESP32-C3-DevKit-RUST-1, and completed a couple of tutorials, the board is working fine.
However, when I tried using embedded-graphics, the firmware didn't even start execution. Here's the MRE:

use std::{thread, time::Duration};

use embedded_graphics::{
    primitives::{Line, PrimitiveStyle, StyledDrawable},
use epd_waveshare::{color::Color, epd7in5_v2::Display7in5};

use log::info;

fn main() -> anyhow::Result<()> {
    info!("Init complete");
    let mut display = Display7in5::default();
    Line::new(Point::new(0, 0), Point::new(1, 1))
        .draw_styled(&PrimitiveStyle::with_stroke(Color::Black, 3), &mut display)?;
    loop {

If I just comment out the .draw_styled() call, it runs! Otherwise, I don't even see the Init complete message. The issue happens with any draw calls.

In the terminal, I get:

I (314) main_task: Calling app_main()
Build:Feb  7 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40380000
0x40380000 - _vector_table
    at ??:??
mode:DIO, clock div:2
0x3fcd5820 - _ZN12_GLOBAL__N_12mxE
    at ??:??
0x403cc710 - spi_flash_chip_winbond_page_program
    at ??:??
0x403ce710 - spi_flash_chip_winbond_page_program
    at ??:??
SHA-256 comparison failed:
Calculated: 1d06b938c0222bf626e0bdf46178b1b37ab24d03f0360fc8fcf7153c2571deaf
Expected: 68d7bdf643ba446b8ed7ae8423241d442fd052b2bc77091100ba06fd65dcf8d5
Attempting to boot anyway...
entry 0x403cc710
0x403cc710 - spi_flash_chip_winbond_page_program
    at ??:??

I'm not sure what's happening, since to my understanding, the call should just fill the buffer, there are no side effects, since I'm not even sending the buffer to a display.

Any help is greatly appreciated :pray:

If you're still needing help you may want to try the #embedded channel in the Rust community discord server. Here is an invite link to the server.

The solution was to allocate the display buffer on heap, not on stack.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.