Initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
Import("env")
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def upload_via_openocd(source, target, env):
|
||||
pkg_dir = env.PioPlatform().get_package_dir("tool-openocd")
|
||||
openocd = os.path.join(pkg_dir, "bin", "openocd.exe")
|
||||
scripts = os.path.join(pkg_dir, "scripts")
|
||||
firmware = str(source[0]) # .elf path
|
||||
|
||||
cmd = [
|
||||
openocd,
|
||||
"-s", scripts,
|
||||
"-f", "interface/cmsis-dap.cfg",
|
||||
"-f", "target/at91samdXX.cfg",
|
||||
"-c", 'program "{}" verify reset; shutdown'.format(firmware.replace("\\", "/"))
|
||||
]
|
||||
|
||||
print(" ".join(cmd))
|
||||
result = subprocess.run(cmd)
|
||||
if result.returncode != 0:
|
||||
env.Exit(1)
|
||||
|
||||
env.Replace(UPLOADCMD=upload_via_openocd)
|
||||
Reference in New Issue
Block a user