Convert usermods to static libraries

Redesign the usermod system so that usermods are implemented as
PlatformIO libraries instead of headers.  This permits them to call for
dependencies, and eliminates the compiler flags for enabling each one,
allowing the build cache to behave better.

The usermod list is built using some linker magic to construct a static
list in ROM memory.  This eliminates the need for wasting SRAM on
something fixed at build time.
This commit is contained in:
Will Miles
2024-09-14 15:09:47 -04:00
parent c4e697d797
commit b8685f2c39
11 changed files with 100 additions and 562 deletions

View File

@@ -0,0 +1,9 @@
Import('env')
usermods = env.GetProjectOption("custom_usermods","")
if usermods:
proj = env.GetProjectConfig()
deps = env.GetProjectOption('lib_deps')
src_dir = proj.get("platformio", "src_dir")
src_dir = src_dir.replace('\\','/')
usermods = [f"{mod} = symlink://{src_dir}/../usermods/{mod}" for mod in usermods.split(" ")]
proj.set("env:" + env['PIOENV'], 'lib_deps', deps + usermods)