Initial commit
This commit is contained in:
commit
b49984b9c0
32 changed files with 2394 additions and 0 deletions
24
upload_openocd.py
Normal file
24
upload_openocd.py
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue