Add OpenOCD as an alternative upload method for atmelsam platform // Issue #732

This commit is contained in:
Valeriy Koval
2016-08-02 14:07:12 +03:00
parent df0373c4fa
commit ca2adbac13
3 changed files with 44 additions and 22 deletions

View File

@ -881,6 +881,9 @@
"frameworks": ["arduino"],
"name": "Arduino Zero (Programming Port)",
"platform": "atmelsam",
"debug": {
"openocdcfg": "arduino_zero.cfg"
},
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
@ -888,7 +891,8 @@
"protocol": "openocd",
"require_upload_port" : false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
"wait_for_upload_port": false,
"section_start": "0x2000"
},
"url": "https://www.arduino.cc/en/Main/ArduinoBoardZero",
"vendor": "Arduino"
@ -974,6 +978,9 @@
"frameworks": ["arduino"],
"name": "Arduino M0 Pro (Programming Port)",
"platform": "atmelsam",
"debug": {
"openocdcfg": "arduino_zero_org.cfg"
},
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,

View File

@ -8,7 +8,11 @@
"frameworks": ["mbed"],
"name": "Atmel ATSAMR21-XPRO",
"platform": "atmelsam",
"debug": {
"openocdcfg": "atmel_samr21_xplained_pro.cfg"
},
"upload": {
"protocol": "openocd",
"maximum_ram_size": 32768,
"maximum_size": 262144
},
@ -24,7 +28,11 @@
"frameworks": ["mbed"],
"name": "Atmel SAML21-XPRO-B",
"platform": "atmelsam",
"debug": {
"openocdcfg": "atmel_saml21_xplained_pro.cfg"
},
"upload": {
"protocol": "openocd",
"maximum_ram_size": 32768,
"maximum_size": 262144
},
@ -40,7 +48,11 @@
"frameworks": ["mbed"],
"name": "Atmel SAMD21-XPRO",
"platform": "atmelsam",
"debug": {
"openocdcfg": "atmel_samd21_xplained_pro.cfg"
},
"upload": {
"protocol": "openocd",
"maximum_ram_size": 32768,
"maximum_size": 262144
},

View File

@ -122,32 +122,35 @@ if upload_protocol == "openocd":
UPLOADER=join("$PIOPACKAGES_DIR", "tool-openocd", "bin", "openocd"),
UPLOADERFLAGS=[
"-d2",
"-s", join(
"$PIOPACKAGES_DIR",
"tool-openocd",
"share",
"openocd",
"scripts"
),
"-f", join(
"$PLATFORMFW_DIR",
"variants",
"${BOARD_OPTIONS['build']['variant']}",
"openocd_scripts",
"${BOARD_OPTIONS['build']['variant']}.cfg"
),
"-c", "\"telnet_port", "disabled;",
"program", "{{$SOURCES}}",
"verify", "reset",
"%s;" % user_code_section if user_code_section else "0x2000",
"shutdown\""
"-f", join(BOARD_OPTIONS.get("debug", {}).get("openocdcfg", "")),
"-s", join("$PIOPACKAGES_DIR", "tool-openocd",
"share", "openocd", "scripts"),
"-s", join("$PIOPACKAGES_DIR", "tool-openocd",
"share", "openocd", "scripts", "board")
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
)
if "zero" in env.subst("$BOARD"):
env.Append(
UPLOADERFLAGS=[
"-s", join("$PLATFORMFW_DIR", "variants",
"${BOARD_OPTIONS['build']['variant']}",
"openocd_scripts")
]
)
env.Append(
UPLOADERFLAGS=[
"-c", "\"telnet_port", "disabled;",
"program", "{{$SOURCES}}",
"verify", "reset",
"%s;" % user_code_section if user_code_section else "",
"shutdown\""
]
)
elif upload_protocol == "sam-ba":
board_type = env.subst("$BOARD")