[core] Allow using "arduino" as framework
This commit is contained in:
14
builder/frameworks/arduino.py
Normal file
14
builder/frameworks/arduino.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-05-16.
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
board = env.BoardConfig()
|
||||
platform = env.PioPlatform()
|
||||
|
||||
# support passing "arduino" as framework
|
||||
frameworks = board.get("frameworks")
|
||||
framework = next(fw for fw in frameworks if "arduino" in fw)
|
||||
builder = platform.frameworks[framework]["script"]
|
||||
builder = builder.rpartition("/")[2]
|
||||
env.SConscript(builder, exports="env")
|
||||
@@ -8,6 +8,10 @@
|
||||
},
|
||||
"version": "0.3.0",
|
||||
"frameworks": {
|
||||
"arduino": {
|
||||
"title": "Generic Arduino framework",
|
||||
"script": "builder/frameworks/arduino.py"
|
||||
},
|
||||
"realtek-ambz-sdk": {
|
||||
"tilte": "Realtek AmebaZ - SDK",
|
||||
"package": "framework-realtek-amb1",
|
||||
|
||||
12
platform.py
12
platform.py
@@ -83,6 +83,13 @@ class LibretuyaPlatform(PlatformBase):
|
||||
BasePackageManager._load_manifest = BasePackageManager.load_manifest
|
||||
BasePackageManager.load_manifest = load_manifest
|
||||
|
||||
# allow using "arduino" as framework
|
||||
if framework == "arduino":
|
||||
board = self.get_boards(options.get("board"))
|
||||
frameworks = board.get("frameworks")
|
||||
framework = next(fw for fw in frameworks if framework in fw)
|
||||
options.get("pioframework")[0] = framework
|
||||
|
||||
# set specific compiler versions
|
||||
if framework.startswith("realtek-ambz"):
|
||||
self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.50401.0"
|
||||
@@ -131,6 +138,11 @@ class LibretuyaPlatform(PlatformBase):
|
||||
util.merge_dicts(result, board._manifest)
|
||||
board._manifest = result
|
||||
|
||||
# add "arduino" framework
|
||||
has_arduino = any("arduino" in fw for fw in board.manifest["frameworks"])
|
||||
if has_arduino:
|
||||
board.manifest["frameworks"].append("arduino")
|
||||
|
||||
# inspired by platform-ststm32/platform.py
|
||||
debug = board.manifest.get("debug", {})
|
||||
if not debug:
|
||||
|
||||
Reference in New Issue
Block a user