Files
wadamesh/scripts/build/perf_lvgl.py
T
Kaj SchittecatandClaude Opus 5.5 9d0301b80a touch: beta_92, faster screens on most boards, Arabic fixes, GitHub fixes
Frame rate: full-width PSRAM draw band (6 bands a frame instead of 14 on the
T-Deck), the still aurora drawn once and copied, LVGL at -O2 with its blend and
label loops in IRAM (scripts/build/perf_lvgl.py, 1 KB more loop stack), circle
and gradient caches, newlib memcpy. Rolled out to the M9, Attaky, RAK, Wio,
CrowPanel and V4-R8; the Pager gets the band only, the V4 the caches only.
Frame benchmark tour (DOC_PERF_BENCH) for measuring it.

Fixes: hop counts read from the packed path length (#621); Arabic shaping
rows patched in LVGL (patch_lvgl_arabic.py), Arabic 101 shift layer, kaf,
symbols, text sent as standard letters (#582); info popup colour runs that
never wrap (#602); keypad nav reaches the chat header (#623); the browser
opens the changelog (#622, gen-changelog.py at every site deploy); the
Theme background colour picker no longer edits the accent; flasher entries
for P4 units with factory ESP-AT Wi-Fi chips (#612, #619).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:53:33 +02:00

54 lines
2.3 KiB
Python

# PlatformIO pre-script: how LVGL itself is compiled, per environment.
#
# custom_lvgl_o2 = yes
# LVGL's sources at -O2 instead of the framework's -Os. The software renderer is
# where a frame's time goes (walking the object tree, styles, glyphs, filling),
# and -Os gives its loops up for size. Everything else keeps -Os, so the flash
# cost stays with the code that earns it. -O2 goes a little deeper into the loop
# task's stack, so such builds also get WADA_LVGL_O2, for which src/main.cpp
# gives that task 1 KB more.
#
# custom_lvgl_iram = lv_draw_sw_blend.c, lv_draw_label.c, ...
# The functions LVGL marks LV_ATTRIBUTE_FAST_MEM in these source files run from
# IRAM instead of through the S3's 16 KB instruction cache, which the rest of
# the frame then has to itself. Costs their size in internal RAM, so only the
# files that carry a frame (the pixel blend, labels, masks), not every marked
# function (lines, arcs, shadows, images barely run in this UI).
#
# Perf benchmark builds override both from PLATFORMIO_BUILD_FLAGS: -DPERF_LVGL_O2 or
# -DBENCH_NO_O2, and -DBENCH_LVGL_IRAM=a.c+b.c (or =none).
import os
import re
Import("env")
flags_env = os.environ.get("PLATFORMIO_BUILD_FLAGS", "")
o2 = str(env.GetProjectOption("custom_lvgl_o2", "")).strip().lower() in ("1", "yes", "true", "on")
if "-DPERF_LVGL_O2" in flags_env:
o2 = True
if "-DBENCH_NO_O2" in flags_env:
o2 = False
iram = [f.strip() for f in str(env.GetProjectOption("custom_lvgl_iram", "")).split(",") if f.strip()]
m = re.search(r"-DBENCH_LVGL_IRAM=(\S+)", flags_env)
if m:
iram = [] if m.group(1) == "none" else m.group(1).split("+")
IRAM_H = os.path.join(env.subst("$PROJECT_DIR"), "scripts", "build", "lvgl_iram.h")
if o2 or iram:
if o2:
env.Append(CPPDEFINES=["WADA_LVGL_O2"]) # src/main.cpp gives the loop task more stack
def lvgl_object(env, node):
flags = list(env["CCFLAGS"])
if o2:
flags = [f for f in flags if f not in ("-Os", "-O1", "-O3")] + ["-O2"]
if node.name in iram:
flags += ["-include", IRAM_H]
return env.Object(node, CCFLAGS=flags)
env.AddBuildMiddleware(lvgl_object, "*lvgl/src/*")
print("perf: LVGL %s%s" % ("at -O2" if o2 else "at -Os",
(", IRAM: " + " ".join(iram)) if iram else ""))