added openocd scripts to fix #1

pull/2/head
sq2ips 2025-02-23 14:27:12 +01:00
rodzic 7c3504462c
commit c0f76f5ea3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: C383A71588BA55F5
5 zmienionych plików z 80 dodań i 5 usunięć

Wyświetl plik

@ -179,7 +179,7 @@ make protection
```
or if you don't have `make` or want to run it directly:
```bash
openocd -f ./openocd_m20.cfg -c "init; halt; flash protect 0 0 7 reset; exit"
openocd -s ./openocd/ -f ./openocd/openocd_m20.cfg -c "init; halt; flash protect 0 0 7 reset; exit"
```
After it finishes you can flash the build firmware:
```bash
@ -187,7 +187,7 @@ make flash
```
or directly
```bash
openocd -f ./openocd_m20.cfg -c "program build/m20.elf verify reset exit"
openocd -s ./openocd/ -f ./openocd/openocd_m20.cfg -c "program build/m20.elf verify reset exit"
```
After it finishes your sonde should now work with the new firmware.

Wyświetl plik

@ -209,9 +209,9 @@ clean:
# flash
flash:
openocd -f ./openocd_m20.cfg -c "program build/m20.elf verify reset exit"
openocd -s ./openocd/ -f ./openocd/openocd_m20.cfg -c "program build/m20.elf verify reset exit"
# remove protect
protect:
openocd -f ./openocd_m20.cfg -c "init; halt; flash protect 0 0 7 reset; exit"
openocd -s ./openocd/ -f ./openocd/openocd_m20.cfg -c "init; halt; flash protect 0 0 7 reset; exit"
# *** EOF ***

Wyświetl plik

@ -0,0 +1,38 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Helper for common memory read/modify/write procedures
# mrw: "memory read word", returns value of $reg
proc mrw {reg} {
return [read_memory $reg 32 1]
}
add_usage_text mrw "address"
add_help_text mrw "Returns value of word in memory."
# mrh: "memory read halfword", returns value of $reg
proc mrh {reg} {
return [read_memory $reg 16 1]
}
add_usage_text mrh "address"
add_help_text mrh "Returns value of halfword in memory."
# mrb: "memory read byte", returns value of $reg
proc mrb {reg} {
return [read_memory $reg 8 1]
}
add_usage_text mrb "address"
add_help_text mrb "Returns value of byte in memory."
# mmw: "memory modify word", updates value of $reg
# $reg <== ((value & ~$clearbits) | $setbits)
proc mmw {reg setbits clearbits} {
set old [mrw $reg]
set new [expr {($old & ~$clearbits) | $setbits}]
mww $reg $new
}
add_usage_text mmw "address setbits clearbits"
add_help_text mmw "Modify word in memory. new_val = (old_val & ~clearbits) | setbits;"

Wyświetl plik

@ -21,7 +21,7 @@ hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374
# set any jtag related features
#
source [find target/swj-dp.tcl]
source [find swj-dp.tcl]
source [find mem_helper.tcl]
if { [info exists CHIPNAME] } {

Wyświetl plik

@ -0,0 +1,37 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ARM Debug Interface V5 (ADI_V5) utility
# ... Mostly for SWJ-DP (not SW-DP or JTAG-DP, since
# SW-DP and JTAG-DP targets don't need to switch based
# on which transport is active.
#
# declare a JTAG or SWD Debug Access Point (DAP)
# based on the transport in use with this session.
# You can't access JTAG ops when SWD is active, etc.
# params are currently what "jtag newtap" uses
# because OpenOCD internals are still strongly biased
# to JTAG .... but for SWD, "irlen" etc are ignored,
# and the internals work differently
# for now, ignore non-JTAG and non-SWD transports
# (e.g. initial flash programming via SPI or UART)
# split out "chip" and "tag" so we can someday handle
# them more uniformly irlen too...)
if [catch {transport select}] {
echo "Error: unable to select a session transport. Can't continue."
shutdown
}
proc swj_newdap {chip tag args} {
if [using_jtag] {
eval jtag newtap $chip $tag $args
} elseif [using_swd] {
eval swd newdap $chip $tag $args
} else {
echo "Error: transport '[ transport select ]' not supported by swj_newdap"
shutdown
}
}