[beken-72xx] Update base core to new structure
This commit is contained in:
@@ -14,55 +14,15 @@ board: PlatformBoardConfig = env.BoardConfig()
|
||||
platform: PlatformBase = env.PioPlatform()
|
||||
|
||||
# Environment variables, include paths, etc.
|
||||
env.ConfigureEnvironment(platform, board)
|
||||
family: Family = env["FAMILY_OBJ"]
|
||||
|
||||
family: Family = env.ConfigureEnvironment(platform, board)
|
||||
# Flash layout defines
|
||||
env.AddFlashLayout(board)
|
||||
|
||||
# Configure each family first (add CPP defines, prepend fixups' paths)
|
||||
for f in family.inheritance:
|
||||
path = env.AddFamily(f)
|
||||
env.AddCoreConfig(name=f.code, path=join(path, "base"))
|
||||
if "ARDUINO" in env:
|
||||
env.AddCoreConfig(name=f"{f.code}_arduino", path=join(path, "arduino", "src"))
|
||||
|
||||
# Include SDK builder scripts
|
||||
# The script will call BuildLibraries(safe=True) to secure the include paths
|
||||
found = False
|
||||
for f in family.inheritance:
|
||||
try:
|
||||
env.SConscript(f"../family/{f.name}.py", must_exist=True)
|
||||
found = True
|
||||
except UserError:
|
||||
pass
|
||||
|
||||
# Fail if no SDK builder was found
|
||||
if not found:
|
||||
click.secho(
|
||||
f"Platform '{family.name}' is currently not supported - "
|
||||
"no SDK builder script could be found.",
|
||||
fg="red",
|
||||
)
|
||||
exit(1)
|
||||
|
||||
# Add common sources among all families
|
||||
env.AddCoreSources(
|
||||
name="common",
|
||||
path=join("$COMMON_DIR", "base"),
|
||||
)
|
||||
# Add sources for this family and each parent
|
||||
for f in family.inheritance:
|
||||
path = join("$CORES_DIR", f.name, "base")
|
||||
env.AddCoreSources(name=f.code, path=path)
|
||||
|
||||
# Sources - external libraries
|
||||
env.AddExternalLibrary("ltchiptool") # uf2ota source code
|
||||
env.AddExternalLibrary("flashdb")
|
||||
env.AddExternalLibrary("printf")
|
||||
|
||||
# Flags & linker options
|
||||
env.Append(
|
||||
CFLAGS=[
|
||||
"-Werror=implicit-function-declaration",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
("LIBRETUYA", 1),
|
||||
("LT_VERSION", env.ReadLTVersion(platform.get_dir(), platform.version)),
|
||||
@@ -71,6 +31,9 @@ env.Append(
|
||||
("MCU", "${MCU}"),
|
||||
("FAMILY", "F_${FAMILY}"),
|
||||
],
|
||||
CPPPATH=[
|
||||
"$BOARD_DIR",
|
||||
],
|
||||
LINKFLAGS=[
|
||||
'"-Wl,-Map=' + join("$BUILD_DIR", "${PROGNAME}.map") + '"',
|
||||
],
|
||||
@@ -80,5 +43,46 @@ env.Append(
|
||||
],
|
||||
)
|
||||
|
||||
# Build a core list to add sources, flags, etc.
|
||||
cores = {
|
||||
"common": "$COMMON_DIR",
|
||||
}
|
||||
# Configure each family first (add CPP defines)
|
||||
for f in family.inheritance:
|
||||
cores[f.code] = env.AddFamily(f)
|
||||
|
||||
# Add fixups & config for each core
|
||||
for name, path in cores.items():
|
||||
env.AddCoreConfig(path=join(path, "base"))
|
||||
if "ARDUINO" in env:
|
||||
env.AddCoreConfig(path=join(path, "arduino", "src"))
|
||||
|
||||
# Include SDK builder scripts
|
||||
# The script will call BuildLibraries(safe=True) to secure the include paths
|
||||
found = False
|
||||
for f in family.inheritance:
|
||||
try:
|
||||
env.SConscript(f"../family/{f.name}.py", must_exist=True)
|
||||
found = True
|
||||
except UserError:
|
||||
pass
|
||||
# Fail if no SDK builder was found
|
||||
if not found:
|
||||
click.secho(
|
||||
f"Platform '{family.name}' is currently not supported - "
|
||||
"no SDK builder script could be found.",
|
||||
fg="red",
|
||||
)
|
||||
exit(1)
|
||||
|
||||
# Add sources & include paths for each core
|
||||
for name, path in cores.items():
|
||||
env.AddCoreSources(name=name, path=join(path, "base"))
|
||||
|
||||
# Sources - external libraries
|
||||
env.AddExternalLibrary("ltchiptool") # uf2ota source code
|
||||
env.AddExternalLibrary("flashdb")
|
||||
env.AddExternalLibrary("printf")
|
||||
|
||||
# Build everything from the base core
|
||||
env.BuildLibraries()
|
||||
|
||||
Reference in New Issue
Block a user