mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Refactor $PLATFORMFW_DIR logic in SCons env
This commit is contained in:
@ -6,7 +6,7 @@ Release History
|
||||
|
||||
* Added support for *ARM*-based credit-card computers: `Raspberry Pi <http://www.raspberrypi.org>`_,
|
||||
`BeagleBoard <http://beagleboard.org>`_ and `CubieBoard <http://cubieboard.org>`_
|
||||
* Added new boards to `atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`_
|
||||
* Added new boards to `atmelavr <http://docs.platformio.org/en/latest/platforms/atmelavr.html#boards>`__
|
||||
platform: *Arduino NG, Arduino BT, Arduino Esplora, Arduino Ethernet,
|
||||
Arduino Robot Control, Arduino Robot Motor and Arduino Yun*
|
||||
* Refactored *Library Dependency Finder* (issues
|
||||
|
@ -28,7 +28,6 @@ commonvars.AddVariables(
|
||||
# package aliases
|
||||
("PIOPACKAGE_TOOLCHAIN",),
|
||||
("PIOPACKAGE_UPLOADER",),
|
||||
("PIOPACKAGE_FRAMEWORK",),
|
||||
|
||||
# options
|
||||
("FRAMEWORK",),
|
||||
@ -58,7 +57,6 @@ DefaultEnvironment(
|
||||
|
||||
PIOBUILDER_DIR=join(util.get_source_dir(), "builder"),
|
||||
PIOPACKAGES_DIR=join("$PIOHOME_DIR", "packages"),
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_FRAMEWORK"),
|
||||
|
||||
BUILD_DIR=join("$PIOENVS_DIR", "$PIOENV"),
|
||||
LIBSOURCE_DIRS=[
|
||||
|
@ -12,6 +12,13 @@ from SCons.Script import Import, Return
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join(
|
||||
"$PIOPACKAGES_DIR",
|
||||
"framework-arduino${PLATFORM.replace('atmel', '')}")
|
||||
)
|
||||
|
||||
BOARD_BUILDOPTS = env.get("BOARD_OPTIONS", {}).get("build", {})
|
||||
|
||||
|
||||
|
@ -12,10 +12,13 @@ from SCons.Script import Import, Return
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-cmsis")
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
join("$BUILD_DIR", "FrameworkCMSIS"),
|
||||
join("$PIOPACKAGES_DIR", "framework-cmsis",
|
||||
"cores", "${BOARD_OPTIONS['build']['core']}")
|
||||
join("$PLATFORMFW_DIR", "cores", "${BOARD_OPTIONS['build']['core']}")
|
||||
)
|
||||
|
||||
env.Append(
|
||||
@ -34,8 +37,7 @@ envsafe = env.Clone()
|
||||
libs = []
|
||||
libs.append(envsafe.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkCMSISVariant"),
|
||||
join("$PIOPACKAGES_DIR", "framework-cmsis", "variants",
|
||||
"${BOARD_OPTIONS['build']['variant']}")
|
||||
join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}")
|
||||
))
|
||||
|
||||
Return("env libs")
|
||||
|
@ -12,6 +12,10 @@ from SCons.Script import Import, Return
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-energia${PLATFORM[2:]}")
|
||||
)
|
||||
|
||||
ENERGIA_VERSION = int(
|
||||
open(join(env.subst("$PLATFORMFW_DIR"),
|
||||
"version.txt")).read().replace(".", "").strip())
|
||||
|
@ -15,6 +15,11 @@ from platformio.util import exec_command
|
||||
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-opencm3")
|
||||
)
|
||||
|
||||
BOARD_BUILDOPTS = env.get("BOARD_OPTIONS", {}).get("build", {})
|
||||
|
||||
|
||||
@ -37,8 +42,7 @@ def find_ldscript(src_dir):
|
||||
|
||||
|
||||
def generate_nvic_files():
|
||||
fw_dir = join(env.get("PIOHOME_DIR"), "packages", "framework-opencm3")
|
||||
|
||||
fw_dir = env.subst("$PLATFORMFW_DIR")
|
||||
for root, _, files in walk(join(fw_dir, "include", "libopencm3")):
|
||||
if "irq.json" not in files or isfile(join(root, "nvic.h")):
|
||||
continue
|
||||
@ -87,8 +91,7 @@ def get_source_files(src_dir):
|
||||
mkdata[key].append(v)
|
||||
|
||||
sources = []
|
||||
lib_root = env.subst(
|
||||
join(env.get("PIOHOME_DIR"), "packages", "framework-opencm3"))
|
||||
lib_root = env.subst("$PLATFORMFW_DIR")
|
||||
for obj_file in mkdata['objs']:
|
||||
src_file = obj_file[:-1] + "c"
|
||||
for search_path in mkdata['vpath']:
|
||||
@ -105,15 +108,11 @@ def merge_ld_scripts(main_ld_file):
|
||||
def _include_callback(match):
|
||||
included_ld_file = match.group(1)
|
||||
# search included ld file in lib directories
|
||||
for root, _, files in walk(join(
|
||||
env.get("PIOHOME_DIR"), "packages",
|
||||
"framework-opencm3", "lib")):
|
||||
|
||||
for root, _, files in walk(env.subst(join("$PLATFORMFW_DIR", "lib"))):
|
||||
if included_ld_file not in files:
|
||||
continue
|
||||
with open(join(root, included_ld_file)) as fp:
|
||||
return fp.read()
|
||||
|
||||
return match.group(0)
|
||||
|
||||
content = ""
|
||||
@ -135,7 +134,7 @@ if BOARD_BUILDOPTS.get("core") == "lm4f":
|
||||
|
||||
env.VariantDir(
|
||||
join("$BUILD_DIR", "FrameworkOpenCM3Variant"),
|
||||
join("$PIOPACKAGES_DIR", "framework-opencm3", "include")
|
||||
join("$PLATFORMFW_DIR", "include")
|
||||
)
|
||||
|
||||
env.Append(
|
||||
@ -145,8 +144,8 @@ env.Append(
|
||||
]
|
||||
)
|
||||
|
||||
root_dir = join(env.get("PIOHOME_DIR"), "packages", "framework-opencm3", "lib",
|
||||
BOARD_BUILDOPTS.get("core"))
|
||||
root_dir = env.subst(
|
||||
join("$PLATFORMFW_DIR", "lib", BOARD_BUILDOPTS.get("core")))
|
||||
if BOARD_BUILDOPTS.get("core") == "stm32":
|
||||
root_dir = join(root_dir, BOARD_BUILDOPTS.get("variant")[-2:])
|
||||
|
||||
@ -161,7 +160,7 @@ env['LINKFLAGS'][env['LINKFLAGS'].index("-T") + 1] = ldscript_path
|
||||
libs = []
|
||||
env.VariantDir(
|
||||
join("$BUILD_DIR", "FrameworkOpenCM3"),
|
||||
join(env.get("PIOHOME_DIR"), "packages", "framework-opencm3")
|
||||
"$PLATFORMFW_DIR"
|
||||
)
|
||||
libs.append(env.Library(
|
||||
join("$BUILD_DIR", "FrameworkOpenCM3"),
|
||||
|
@ -12,10 +12,13 @@ from SCons.Script import Import, Return
|
||||
env = None
|
||||
Import("env")
|
||||
|
||||
env.Replace(
|
||||
PLATFORMFW_DIR=join("$PIOPACKAGES_DIR", "framework-spl")
|
||||
)
|
||||
|
||||
env.VariantDir(
|
||||
join("$BUILD_DIR", "FrameworkSPLInc"),
|
||||
join("$PIOPACKAGES_DIR", "framework-spl",
|
||||
"${BOARD_OPTIONS['build']['core']}",
|
||||
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}",
|
||||
"variants", "${BOARD_OPTIONS['build']['variant']}", "inc")
|
||||
)
|
||||
|
||||
@ -54,8 +57,7 @@ elif "STM32L1XX_MD" in extra_flags:
|
||||
libs = []
|
||||
libs.append(envsafe.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkSPL"),
|
||||
join("$PIOPACKAGES_DIR", "framework-spl",
|
||||
"${BOARD_OPTIONS['build']['core']}", "variants",
|
||||
join("$PLATFORMFW_DIR", "${BOARD_OPTIONS['build']['core']}", "variants",
|
||||
"${BOARD_OPTIONS['build']['variant']}", "src"),
|
||||
ignore_files
|
||||
))
|
||||
|
@ -23,7 +23,6 @@ class AtmelavrPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"framework-arduinoavr": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ class AtmelsamPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"framework-arduinosam": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
},
|
||||
|
||||
|
@ -27,7 +27,6 @@ class TeensyPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"framework-arduinoteensy": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ class Timsp430Platform(BasePlatform):
|
||||
},
|
||||
|
||||
"framework-energiamsp430": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,10 @@ class TitivaPlatform(BasePlatform):
|
||||
},
|
||||
|
||||
"framework-energiativa": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
},
|
||||
|
||||
"framework-opencm3": {
|
||||
"alias": "framework",
|
||||
"default": True
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user