Skip to content

Commit

Permalink
Add pacakge definitions, skeletons for builder script
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Jul 13, 2021
1 parent 3c6cc84 commit 9920da0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions builder/frameworks/arduino/arduino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ToDo: readout core and call correct builder script (e.g., mbed-core/arduino-core-mbed.py)
8 changes: 7 additions & 1 deletion platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import copy
import platform

Expand All @@ -24,6 +25,24 @@ def is_embedded(self):
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, "")
Expand Down

0 comments on commit 9920da0

Please sign in to comment.