Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embedding Arancino platform into platformio #141

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions boards/arancino.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"build": {
"arduino": {
"ldscript": "flash_with_bootloader.ld"
},
"core": "arancino",
"cpu": "cortex-m0plus",
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"hwids": [
[
"0x04D8",
"0xECDA"
]
],
"mcu": "samd21g18a",
"usb_product": "Arancino",
"variant": "arancino"
},
"bootloader": {
"tool": "openocd",
"file": "arancino/samd21_sam_ba_arancino.bin"
},
"connectivity": [
"ethernet",
"wifi"
],
"debug": {
"jlink_device": "ATSAMD21G18",
"openocd_chipname": "at91samd21g18",
"openocd_target": "at91samdXX",
"svd_path": "ATSAMD21G18A.svd"
},
"frameworks": ["arduino"],
"name": "Arancino",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"native_usb": true,
"offset_address": "0x2000",
"protocol": "arancino-ota",
"protocols": [
"sam-ba",
"arancino-ota",
"arancino-ota-no-gui",
"blackmagic",
"jlink",
"atmel-ice"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": true
},
"url": "http://smartme.io/it/projects/arancino-cc-2/",
"vendor": "smartme.io"
}
57 changes: 57 additions & 0 deletions boards/arancinoMignon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"build": {
"arduino": {
"ldscript": "flash_with_bootloader.ld"
},
"core": "arancino",
"cpu": "cortex-m0plus",
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"hwids": [
[
"0x04D8",
"0xECD9"
]
],
"mcu": "samd21g18a",
"usb_product": "Arancino Mignon",
"variant": "arancino"
},
"bootloader": {
"tool": "openocd",
"file": "arancino/samd21_sam_ba_arancino_mignon.bin"
},
"connectivity": [
"ethernet",
"wifi"
],
"debug": {
"jlink_device": "ATSAMD21G18",
"openocd_chipname": "at91samd21g18",
"openocd_target": "at91samdXX",
"svd_path": "ATSAMD21G18A.svd"
},
"frameworks": ["arduino"],
"name": "Arancino Mignon",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"native_usb": true,
"offset_address": "0x2000",
"protocol": "sam-ba",
"protocols": [
"sam-ba",
"arancino-ota",
"arancino-ota-no-gui",
"blackmagic",
"jlink",
"atmel-ice"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "http://smartme.io/it/projects/arancino-cc-2/",
"vendor": "smartme.io"
}
2 changes: 2 additions & 0 deletions builder/frameworks/arduino/arduino-samd.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
BUILD_CORE = "arduino"
if VENDOR_CORE == "sparkfun" and board.get("build.mcu", "").startswith("samd51"):
BUILD_CORE = "arduino51"
elif VENDOR_CORE == "arancino":
BUILD_CORE = "arancino"

env.Append(
CPPDEFINES=[
Expand Down
32 changes: 32 additions & 0 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,38 @@ def _jlink_cmd_script(env, source):
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
]

elif upload_protocol == "arancino-ota":
env.Replace(
UPLOADER=join(
platform.get_package_dir("tool-arancino-ota") or "", "ArancinoOTA"),
UPLOADERFLAGS=[
"--ip", '"$UPLOAD_PORT"',
"--path", "$SOURCES",
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
)
upload_actions = [
env.VerboseAction(env.AutodetectUploadPort,
"Looking for upload port..."),
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
]

elif upload_protocol == "arancino-ota-no-gui":
env.Replace(
UPLOADER=join(
platform.get_package_dir("tool-arancino-ota-no-gui") or "", "arancino-ota-no-gui.py"),
UPLOADERFLAGS=[
"--arancino_ip_address", '"$UPLOAD_PORT"',
"--arancino_firmware", "$SOURCES",
],
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS'
)
upload_actions = [
env.VerboseAction(env.AutodetectUploadPort,
"Looking for upload port..."),
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE via REST APIs")
]

elif upload_protocol in debug_tools:
openocd_args = [
"-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)
Expand Down
16 changes: 16 additions & 0 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
"owner": "platformio",
"version": "~1.8.11"
},
"framework-arduino-samd-arancino": {
"type": "framework",
"optional": true,
"owner": "smartmeio",
"version": "~1.2.1"
},
"framework-arduino-samd-adafruit": {
"type": "framework",
"optional": true,
Expand Down Expand Up @@ -252,6 +258,16 @@
"owner": "meteca",
"version": ">=2.0.0"
},
"tool-arancino-ota": {
"optional": false,
"owner": "smartmeio",
"version": "~1.0.8"
},
"tool-arancino-ota-no-gui": {
"optional": false,
"owner": "smartmeio",
"version": "~1.0.2"
},
"tool-openocd": {
"type": "uploader",
"optional": true,
Expand Down
2 changes: 2 additions & 0 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def configure_default_packages(self, variables, targets):
upload_tool = "tool-jlink"
elif upload_protocol == "mbctool":
upload_tool = "tool-mbctool"
elif upload_protocol == "arancino-ota":
upload_tool = "tool-arancino-ota"

if upload_tool:
for name, opts in self.packages.items():
Expand Down