From 9a2fffa1921093ae381d648234396e0833be7e48 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 14 Jul 2026 12:53:34 +1000 Subject: [PATCH] (feat) Add mimxrt PXP support. Enable NXP's PXP 2D accelerator for the mimxrt port by setting LV_USE_PXP, LV_USE_DRAW_PXP, LV_USE_GPU_NXP_PXP and LV_USE_GPU_NXP_PXP_AUTO_INIT via CFLAGS_USERMOD, since the mimxrt port has no board-level makefile of its own to provide them. Silence known PXP driver warnings that would otherwise fail a -Werror build. Guard LV_USE_PXP, LV_USE_DRAW_PXP, LV_USE_ROTATE_PXP and LV_DRAW_BUF_ALIGN with #ifndef so a board can override any of these from its own build flags without a macro redefinition warning. --- lv_conf.h | 8 ++++++++ micropython.mk | 22 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lv_conf.h b/lv_conf.h index e37f8426f..406faead4 100644 --- a/lv_conf.h +++ b/lv_conf.h @@ -114,7 +114,9 @@ #define LV_DRAW_BUF_STRIDE_ALIGN 1 /** Align start address of draw_buf addresses to this bytes*/ +#ifndef LV_DRAW_BUF_ALIGN #define LV_DRAW_BUF_ALIGN 4 +#endif /** Using matrix for transformations. * Requirements: @@ -249,14 +251,20 @@ #endif /** Use NXP's PXP on iMX RTxxx platforms. */ +#ifndef LV_USE_PXP #define LV_USE_PXP 0 +#endif #if LV_USE_PXP /** Use PXP for drawing.*/ + #ifndef LV_USE_DRAW_PXP #define LV_USE_DRAW_PXP 1 + #endif /** Use PXP to rotate display.*/ + #ifndef LV_USE_ROTATE_PXP #define LV_USE_ROTATE_PXP 0 + #endif #if LV_USE_DRAW_PXP && LV_USE_OS /** Use additional draw thread for PXP processing.*/ diff --git a/micropython.mk b/micropython.mk index a884a4466..519cb5314 100644 --- a/micropython.mk +++ b/micropython.mk @@ -1,9 +1,13 @@ +################################################################################ +# LVGL port Support +MICROPY_PORT = $(notdir $(CURDIR)) + +ifeq ($(MICROPY_PORT),unix) ################################################################################ # LVGL unix optional libraries # Update CFLAGS_USERMOD and LDFLAGS_USERMOD for LVGL extenral library, # but do that only on the unix port, for unix specific dependencies -ifeq ($(notdir $(CURDIR)),unix) ifneq ($(UNAME_S),Darwin) CFLAGS_USERMOD += -DMICROPY_FB=1 endif @@ -43,7 +47,21 @@ endif # LDFLAGS_USERMOD += $(FFMPEG_LDFLAGS_USERMOD) # endif -endif +endif # unix support + +ifeq ($(MICROPY_PORT),mimxrt) +CFLAGS_USERMOD += -DLV_USE_PXP=1 -DLV_USE_DRAW_PXP=1 -DLV_USE_GPU_NXP_PXP=1 -DLV_USE_GPU_NXP_PXP_AUTO_INIT=1 + +# Depending on how the USER_C_MODULE is declared the object files inside build can be based on +# absolute or relative paths under this directory. +MOD_ABSPATH := $(abspath $(USERMOD_DIR)) +MOD_DIRNAME := $(notdir $(MOD_ABSPATH)) +$(BUILD)/$(MOD_ABSPATH)/lvgl/src/draw/nxp/pxp/lv_draw_pxp.o: CFLAGS_USERMOD += -Wno-error=unused-variable +$(BUILD)/$(MOD_DIRNAME)/lvgl/src/draw/nxp/pxp/lv_draw_pxp.o: CFLAGS_USERMOD += -Wno-error=unused-variable +$(BUILD)/$(MOD_ABSPATH)/lvgl/src/draw/nxp/pxp/lv_draw_pxp_img.o: CFLAGS_USERMOD += -Wno-error=float-conversion +$(BUILD)/$(MOD_DIRNAME)/lvgl/src/draw/nxp/pxp/lv_draw_pxp_img.o: CFLAGS_USERMOD += -Wno-error=float-conversion + +endif # mimxrt support ################################################################################