One Code for multiple different MCU hardware

I’m completely new to LVGL and was wondering if there could be a way to make the code separate from hardware functions.
With presets for specific MCU’s, and the code relying on them.

So that the code would be possible to run on multiple MCU’s.

I don’t think that exists currently, so I wanted to ask why and if it could be somehow archived in the future.

(or could there be an algorithm that rewrites the code)

LVGL is already platform-independent, you can use the same UI code across different MCUs by only changing the low-level drivers (like display or input).

For an example setup, check out this PlatformIO-based repo: