Autogenerate linker script for esp-idf
This commit is contained in:
@@ -25,6 +25,8 @@ from os.path import isdir, join
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
from platformio.util import exec_command
|
||||
|
||||
env = DefaultEnvironment()
|
||||
platform = env.PioPlatform()
|
||||
|
||||
@@ -34,6 +36,18 @@ FRAMEWORK_VERSION = platform.get_package_version(
|
||||
assert isdir(FRAMEWORK_DIR)
|
||||
|
||||
|
||||
def generate_ld_script():
|
||||
exec_command([
|
||||
join(platform.get_package_dir("toolchain-xtensa32")
|
||||
or "", "bin", env.subst("$CC")),
|
||||
"-I", join(env.subst("$ESPIDF_DIR"), "config"),
|
||||
"-C", "-P", "-x", "c", "-E",
|
||||
join(env.subst("$ESPIDF_DIR"), "components",
|
||||
"esp32", "ld", "esp32.ld"),
|
||||
"-o", join(env.subst("$ESPIDF_DIR"), "components",
|
||||
"esp32", "ld", "esp32_out.ld")
|
||||
])
|
||||
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
join(FRAMEWORK_DIR, "config"),
|
||||
@@ -86,6 +100,12 @@ env.Append(
|
||||
],
|
||||
)
|
||||
|
||||
#
|
||||
# Generate a specific linker script
|
||||
#
|
||||
|
||||
generate_ld_script()
|
||||
|
||||
#
|
||||
# Target: Build Core Library
|
||||
#
|
||||
|
||||
+2
-4
@@ -154,7 +154,6 @@ env.Replace(
|
||||
)
|
||||
|
||||
if env.subst("$PIOFRAMEWORK") == "arduino":
|
||||
framework_dir = platform.get_package_dir("framework-arduinoespressif32")
|
||||
env.Append(
|
||||
UPLOADERFLAGS=[
|
||||
"0x1000", join("$FRAMEWORK_ARDUINOESP32_DIR", "tools",
|
||||
@@ -165,7 +164,6 @@ if env.subst("$PIOFRAMEWORK") == "arduino":
|
||||
]
|
||||
)
|
||||
if env.subst("$PIOFRAMEWORK") == "espidf":
|
||||
framework_dir = platform.get_package_dir("framework-espidf")
|
||||
env.Append(
|
||||
UPLOADERFLAGS=[
|
||||
"0x1000", join("$BUILD_DIR", "bootloader.bin"),
|
||||
@@ -229,10 +227,10 @@ if "PIOFRAMEWORK" in env:
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||
|
||||
if "espidf" in env.subst("$PIOFRAMEWORK"):
|
||||
bootloader_bin = env.ElfToBin(
|
||||
target_buildboot = env.ElfToBin(
|
||||
join("$BUILD_DIR", "bootloader"), build_espidf_bootloader())
|
||||
target_buildprog = env.Alias(
|
||||
"buildprog", [target_firm, bootloader_bin], "$PTABLE_CMD")
|
||||
"buildprog", [target_firm, target_buildboot], "$PTABLE_CMD")
|
||||
else:
|
||||
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user