From 8323bafd4c82c568c6a09ba10ecfec801f80c872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Sun, 5 Mar 2023 14:34:02 +0100 Subject: [PATCH] [beken-72xx] Fix include path and delay() alias --- builder/family/beken-72xx.py | 7 +++++++ builder/utils/libs-queue.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/builder/family/beken-72xx.py b/builder/family/beken-72xx.py index b72d797..32d2f33 100644 --- a/builder/family/beken-72xx.py +++ b/builder/family/beken-72xx.py @@ -525,6 +525,13 @@ env.Replace(FLASH_RBL_OFFSET=f"0x{app_offs + rbl_offs:06X}") # Build all libraries queue.BuildLibraries() +# Rename Arduino's delay() to delayMilliseconds() +env.Append( + CPPDEFINES=[ + ("delay", "delayMilliseconds"), + ], +) + # Main firmware outputs and actions env.Replace( # linker command (encryption + packaging) diff --git a/builder/utils/libs-queue.py b/builder/utils/libs-queue.py index 94b7078..3d554b9 100644 --- a/builder/utils/libs-queue.py +++ b/builder/utils/libs-queue.py @@ -10,6 +10,7 @@ from ltchiptool.util.dict import merge_dicts from SCons.Script import DefaultEnvironment, Environment env: Environment = DefaultEnvironment() +ENV_PUBLIC_ONLY = ["CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"] def add_base_dir( @@ -118,6 +119,12 @@ class LibraryQueue: self.includes.insert(0, item) else: self.includes.append(item) + # move public-only options to the global env + for key in ENV_PUBLIC_ONLY: + if key not in lib.options: + continue + option = lib.options.pop(key) + self.options_public = merge_dicts(self.options_public, {key: option}) self.queue.append(lib) def AddExternalLibrary(self, name: str, port: Optional[str] = None): @@ -130,8 +137,7 @@ class LibraryQueue: self.options_public = merge_dicts(self.options_public, kwargs) def AppendPrivate(self, **kwargs): - public_only = ["CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"] - if any(key in public_only for key in kwargs.keys()): + if any(key in ENV_PUBLIC_ONLY for key in kwargs.keys()): raise ValueError("Cannot set these as private options") self.options_private = merge_dicts(self.options_private, kwargs)