HeapCrash / Challenges / LVGL flush callback with DMA2D

LVGL flush callback with DMA2D

LVGL v9 on a Cortex-M7 with D-cache. The flush callback copies a rendered area into the framebuffer using DMA2D, which completes in about 2 ms. The UI freezes after the first frame.

The code

Embedded C for Cortex-M. It compiles. There are 3 real bugs in it: the kind that pass a bench test and fail in the field.

void my_flush_cb(lv_display_t *disp, const lv_area_t *area,
                 uint8_t *px)
{
    int32_t w = area->x2 - area->x1;
    int32_t h = area->y2 - area->y1;
    dma2d_copy(px, fb, area->x1, area->y1, w, h);
}

What an interviewer expects

The bugs, reference fixes and the follow-up question are in the practice app, after you've tried it.

Companies that test this

Matched on the skills each company's embedded roles emphasise.

Related challenges

Flag the lines, say what breaks, then fix it and build it with clang in your browser.

Find the bugs