mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Add initial support for Arduino M0 Pro board // Issue #472
This commit is contained in:
@ -885,7 +885,7 @@
|
|||||||
"disable_flushing": true,
|
"disable_flushing": true,
|
||||||
"maximum_ram_size": 32768,
|
"maximum_ram_size": 32768,
|
||||||
"maximum_size": 262144,
|
"maximum_size": 262144,
|
||||||
"protocol": "sam-ba",
|
"protocol": "openocd",
|
||||||
"require_upload_port" : false,
|
"require_upload_port" : false,
|
||||||
"use_1200bps_touch": false,
|
"use_1200bps_touch": false,
|
||||||
"wait_for_upload_port": false
|
"wait_for_upload_port": false
|
||||||
@ -955,5 +955,36 @@
|
|||||||
},
|
},
|
||||||
"url": "https://www.arduino.cc/en/Main/ArduinoMKR1000",
|
"url": "https://www.arduino.cc/en/Main/ArduinoMKR1000",
|
||||||
"vendor": "Arduino"
|
"vendor": "Arduino"
|
||||||
|
},
|
||||||
|
"mzeropro": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino_zero",
|
||||||
|
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
|
||||||
|
"f_cpu": "48000000L",
|
||||||
|
"mcu": "samd21g18a",
|
||||||
|
"cpu": "cortex-m0plus",
|
||||||
|
"usb_product": "Arduino M0 Pro",
|
||||||
|
"variant": "arduino_zero",
|
||||||
|
"ldscript": "samd21g18a_bootloader_org.ld",
|
||||||
|
"hwids": [
|
||||||
|
["0x03EB", "0x2111"],
|
||||||
|
["0x2A03", "0x804F"]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "Arduino M0 Pro (Programming Port)",
|
||||||
|
"platform": "atmelsam",
|
||||||
|
"upload": {
|
||||||
|
"disable_flushing": true,
|
||||||
|
"maximum_ram_size": 32768,
|
||||||
|
"maximum_size": 262144,
|
||||||
|
"protocol": "openocd",
|
||||||
|
"require_upload_port" : false,
|
||||||
|
"use_1200bps_touch": false,
|
||||||
|
"wait_for_upload_port": false,
|
||||||
|
"section_start": "0x4000"
|
||||||
|
},
|
||||||
|
"url": "http://www.arduino.org/products/boards/arduino-m0-pro",
|
||||||
|
"vendor": "Arduino"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,6 @@ from platformio.util import get_serialports
|
|||||||
|
|
||||||
|
|
||||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||||
board_type = env.subst("$BOARD")
|
|
||||||
if "zero" not in board_type:
|
|
||||||
env.Append(
|
|
||||||
UPLOADERFLAGS=[
|
|
||||||
"-U",
|
|
||||||
"true" if ("usb" in board_type.lower(
|
|
||||||
) or board_type == "digix") else "false"
|
|
||||||
])
|
|
||||||
|
|
||||||
upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {})
|
upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {})
|
||||||
|
|
||||||
@ -48,7 +40,8 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
|||||||
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
||||||
|
|
||||||
# use only port name for BOSSA
|
# use only port name for BOSSA
|
||||||
if "/" in env.subst("$UPLOAD_PORT"):
|
if ("/" in env.subst("$UPLOAD_PORT") and
|
||||||
|
env.subst("$UPLOAD_PROTOCOL") == "sam-ba"):
|
||||||
env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT")))
|
env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT")))
|
||||||
|
|
||||||
|
|
||||||
@ -56,41 +49,8 @@ env = DefaultEnvironment()
|
|||||||
|
|
||||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
||||||
|
|
||||||
if env.subst("$BOARD") == "zero":
|
BOARD_OPTIONS = env.get("BOARD_OPTIONS", {})
|
||||||
env.Replace(
|
|
||||||
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", "0x00002000;", "shutdown\""
|
|
||||||
],
|
|
||||||
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
env.Replace(
|
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
|
||||||
UPLOADERFLAGS=[
|
|
||||||
"--info",
|
|
||||||
"--port", '"$UPLOAD_PORT"',
|
|
||||||
"--erase",
|
|
||||||
"--write",
|
|
||||||
"--verify",
|
|
||||||
"--reset",
|
|
||||||
"--debug"
|
|
||||||
],
|
|
||||||
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
|
|
||||||
)
|
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
|
|
||||||
@ -120,8 +80,21 @@ env.Append(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
user_code_section = BOARD_OPTIONS.get("upload", {}).get("section_start", False)
|
||||||
|
|
||||||
if "sam3x8e" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
|
if user_code_section:
|
||||||
|
env.Append(
|
||||||
|
CPPDEFINES=[
|
||||||
|
"printf=iprintf"
|
||||||
|
],
|
||||||
|
|
||||||
|
LINKFLAGS=[
|
||||||
|
"-Wl,--entry=Reset_Handler",
|
||||||
|
"-Wl,--section-start=.text=%s" % user_code_section
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""):
|
||||||
env.Append(
|
env.Append(
|
||||||
CPPDEFINES=[
|
CPPDEFINES=[
|
||||||
"printf=iprintf"
|
"printf=iprintf"
|
||||||
@ -137,7 +110,7 @@ if "sam3x8e" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
|
|||||||
]
|
]
|
||||||
|
|
||||||
)
|
)
|
||||||
elif "samd" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
|
elif "samd" in BOARD_OPTIONS.get("build", {}).get("mcu", ""):
|
||||||
env.Append(
|
env.Append(
|
||||||
LINKFLAGS=[
|
LINKFLAGS=[
|
||||||
"--specs=nosys.specs",
|
"--specs=nosys.specs",
|
||||||
@ -145,6 +118,62 @@ elif "samd" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
upload_protocol = BOARD_OPTIONS.get("upload", {}).get("protocol", None)
|
||||||
|
|
||||||
|
if upload_protocol == "openocd":
|
||||||
|
env.Replace(
|
||||||
|
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\""
|
||||||
|
],
|
||||||
|
|
||||||
|
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
|
||||||
|
)
|
||||||
|
|
||||||
|
elif upload_protocol == "sam-ba":
|
||||||
|
|
||||||
|
board_type = env.subst("$BOARD")
|
||||||
|
|
||||||
|
env.Replace(
|
||||||
|
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
||||||
|
UPLOADERFLAGS=[
|
||||||
|
"--info",
|
||||||
|
"--port", '"$UPLOAD_PORT"',
|
||||||
|
"--erase",
|
||||||
|
"--write",
|
||||||
|
"--verify",
|
||||||
|
"--reset",
|
||||||
|
"--debug",
|
||||||
|
"-U",
|
||||||
|
"true" if ("usb" in board_type.lower(
|
||||||
|
) or board_type == "digix") else "false"
|
||||||
|
],
|
||||||
|
|
||||||
|
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
|
||||||
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build executable and linkable firmware
|
# Target: Build executable and linkable firmware
|
||||||
#
|
#
|
||||||
@ -171,7 +200,7 @@ AlwaysBuild(target_size)
|
|||||||
# Target: Upload by default .bin file
|
# Target: Upload by default .bin file
|
||||||
#
|
#
|
||||||
|
|
||||||
if env.subst("$BOARD") == "zero":
|
if upload_protocol == "openocd":
|
||||||
upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
|
upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
|
||||||
else:
|
else:
|
||||||
upload = env.Alias(
|
upload = env.Alias(
|
||||||
|
Reference in New Issue
Block a user