diff --git a/boards/arancino.json b/boards/arancino.json new file mode 100755 index 0000000..9c77b98 --- /dev/null +++ b/boards/arancino.json @@ -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" +} diff --git a/boards/arancinoMignon.json b/boards/arancinoMignon.json new file mode 100755 index 0000000..37596d7 --- /dev/null +++ b/boards/arancinoMignon.json @@ -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" +} diff --git a/builder/frameworks/arduino/arduino-samd.py b/builder/frameworks/arduino/arduino-samd.py index 9fa36e4..bf170d1 100644 --- a/builder/frameworks/arduino/arduino-samd.py +++ b/builder/frameworks/arduino/arduino-samd.py @@ -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=[ diff --git a/builder/main.py b/builder/main.py index af606d7..8782d7b 100644 --- a/builder/main.py +++ b/builder/main.py @@ -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) diff --git a/platform.json b/platform.json index 4ca99b7..c82dfe7 100644 --- a/platform.json +++ b/platform.json @@ -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, @@ -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, diff --git a/platform.py b/platform.py index e404716..eb5b2d0 100644 --- a/platform.py +++ b/platform.py @@ -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():