diff --git a/builder/frameworks/arduino/arduino.py b/builder/frameworks/arduino/arduino.py new file mode 100644 index 0000000..065e58e --- /dev/null +++ b/builder/frameworks/arduino/arduino.py @@ -0,0 +1 @@ +# ToDo: readout core and call correct builder script (e.g., mbed-core/arduino-core-mbed.py) \ No newline at end of file diff --git a/platform.json b/platform.json index d50178c..11d90ee 100644 --- a/platform.json +++ b/platform.json @@ -22,7 +22,7 @@ "frameworks": { "arduino": { "package": "framework-arduino-mbed", - "script": "builder/frameworks/arduino/mbed-core/arduino-core-mbed.py" + "script": "builder/frameworks/arduino/arduino.py" } }, "packages": { @@ -37,6 +37,12 @@ "owner": "platformio", "version": "~2.1.0" }, + "framework-arduino-pico-earlephilhower": { + "type": "framework", + "optional": true, + "owner": "maxgerhardt", + "version": "~1.10902.0" + }, "tool-rp2040tools": { "type": "uploader", "owner": "platformio", diff --git a/platform.py b/platform.py index c4e29da..03ca245 100644 --- a/platform.py +++ b/platform.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import copy import platform @@ -24,6 +25,24 @@ class RaspberrypiPlatform(PlatformBase): return True def configure_default_packages(self, variables, targets): + # configure arduino core package. + # select the right one based on the build.core, disable other one. + board = variables.get("board") + board_config = self.board_config(board) + build_core = variables.get( + "board_build.core", board_config.get("build.core", "arduino")) + + frameworks = variables.get("pioframework", []) + if "arduino" in frameworks: + if build_core == "arduino": + self.frameworks["arduino"]["package"] = "framework-arduino-mbed" + self.packages["framework-arduino-pico-earlephilhower"]["optional"] = True + elif build_core == "earlephilhower": + self.frameworks["arduino"]["package"] = "framework-arduino-pico-earlephilhower" + self.packages["framework-arduino-mbed"]["optional"] = True + else: + sys.stderr.write("Error! Unknown build.core value '%s'. Don't know which Arduino core package to use." % build_core) + # configure J-LINK tool jlink_conds = [ "jlink" in variables.get(option, "")