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

Add support for programming the SAM3X on the Udoo Quad #119

Open
wants to merge 2 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
49 changes: 49 additions & 0 deletions boards/udoo_quad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"build": {
"arduino": {
"ldscript": "flash.ld"
},
"core": "arduino",
"cpu": "cortex-m3",
"extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE",
"f_cpu": "84000000L",
"hwids": [
[
"0x10C4",
"0xEA60"
]
],
"mcu": "at91sam3x8e",
"usb_product": "Arduino Due",
"variant": "arduino_due_x"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "ATSAM3X8E",
"openocd_chipname": "at91sam3X8E",
"openocd_target": "at91sam3ax_8x",
"svd_path": "ATSAM3X8E.svd"
},
"frameworks": [
"arduino"
],
"name": "Udoo Quad",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 98304,
"maximum_size": 524288,
"native_usb": false,
"protocol": "sam-ba",
"protocols": [
"sam-ba"
],
"internal": false,
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.udoo.org/",
"vendor": "Udoo"
}
49 changes: 49 additions & 0 deletions boards/udoo_quad_internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"build": {
"arduino": {
"ldscript": "flash.ld"
},
"core": "arduino",
"cpu": "cortex-m3",
"extra_flags": "-D__SAM3X8E__ -DARDUINO_SAM_DUE",
"f_cpu": "84000000L",
"hwids": [
[
"0x10C4",
"0xEA60"
]
],
"mcu": "at91sam3x8e",
"usb_product": "Arduino Due",
"variant": "arduino_due_x"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "ATSAM3X8E",
"openocd_chipname": "at91sam3X8E",
"openocd_target": "at91sam3ax_8x",
"svd_path": "ATSAM3X8E.svd"
},
"frameworks": [
"arduino"
],
"name": "Udoo Quad",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 98304,
"maximum_size": 524288,
"native_usb": false,
"protocol": "sam-ba",
"protocols": [
"sam-ba"
],
"internal": true,
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.udoo.org/",
"vendor": "Udoo"
}
12 changes: 9 additions & 3 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,19 @@ def _jlink_cmd_script(env, source):
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS $SOURCES"
)

# use patched bossac for Udoo Quad
if board.get("name") in ("Udoo Quad", "Udoo Dual"):
env.Replace(UPLOADER="bossac-udoo")
if env.BoardConfig().get("upload.internal", False):
env.Replace(UPLOADER="bossac-udoo-internal")

if board.get("build.core") in ("adafruit", "seeed") and board.get(
"build.mcu").startswith("samd51"):
# special flags for the latest bossac tool
env.Append(
UPLOADERFLAGS=[
"-U", "--offset", board.get("upload.offset_address")])

else:
env.Append(UPLOADERFLAGS=[
"--erase",
Expand Down Expand Up @@ -267,9 +273,9 @@ def _jlink_cmd_script(env, source):
"--device", "samd",
"--speed", "1500000",
"--port", '"$UPLOAD_PORT"',
"--upload", "$SOURCES",
"--upload", "$SOURCES",
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
)
upload_actions = [
env.VerboseAction(env.AutodetectUploadPort,
Expand Down
8 changes: 7 additions & 1 deletion platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json",
"https://raw.githubusercontent.com/eerimoq/simba/master/make/platformio/manifest.json"
"https://raw.githubusercontent.com/eerimoq/simba/master/make/platformio/manifest.json",
"https://raw.githubusercontent.com/ArkadiuszMichalRys/bossac-udoo/master/platformio/manifest.json"
],
"frameworks": {
"arduino": {
Expand Down Expand Up @@ -201,6 +202,11 @@
"optional": true,
"version": "~1.10700.0"
},
"tool-bossac-udoo": {
"type": "uploader",
"optional": true,
"version": "~0.0.1"
},
"tool-mbctool": {
"optional": true,
"version": ">=2.0.0"
Expand Down
2 changes: 2 additions & 0 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def configure_default_packages(self, variables, targets):
upload_tool = "tool-openocd"
if upload_protocol == "sam-ba":
upload_tool = "tool-bossac"
if board.get("name") in ("Udoo Quad", "Udoo Dual"):
upload_tool = "tool-bossac-udoo"
elif upload_protocol == "stk500v2":
upload_tool = "tool-avrdude"
elif upload_protocol == "jlink":
Expand Down