[beken-72xx] Fix include path and delay() alias

This commit is contained in:
Kuba Szczodrzyński
2023-03-05 14:34:02 +01:00
parent 6b92aac1da
commit 8323bafd4c
2 changed files with 15 additions and 2 deletions

View File

@@ -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)

View File

@@ -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)