-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
target extended-remote localhost:3333 | ||
|
||
# Load flashing program | ||
load sw/boot/flash.spm.elf | ||
|
||
# Load disk image to DRAM | ||
eval "restore %s binary 0x80000000", $img | ||
|
||
# Write flash parameters to scratch regs | ||
set *0x03000000=$target | ||
set *0x03000004=0x80000000 | ||
set *0x03000008=$offs | ||
set *0x0300000c=$len | ||
|
||
# Launch payload and quit after return | ||
continue | ||
quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! /usr/bin/env bash | ||
|
||
# Arguments: | ||
# $1: target board | ||
# $2: target disk | ||
# $3: (optional): disk image | ||
# $4: (optional): copy length | ||
# $5: (optional): copy offset | ||
|
||
Check failure on line 9 in util/flash_disk.sh GitHub Actions / lint-license
|
||
set -e | ||
|
||
# Determine the image name and size | ||
img=${3:-sw/boot/linux.${1}.gpt.bin} | ||
# Ensure the image exists and determine rounded-up size | ||
len=${4:-$(stat -c%s ${img})} | ||
len=$((len/512+1)) | ||
|
||
# Run OpenOCD and GDB | ||
openocd -f util/openocd.${1}.tcl & | ||
sleep 2 | ||
riscv64-unknown-elf-gdb --batch \ | ||
-ex "set \$target = ${2:-1}" \ | ||
-ex "set \$img = \"${img}\"" \ | ||
-ex "set \$len = ${len}" \ | ||
-ex "set \$offs = ${5:-0}" \ | ||
-ex "source util/flash_disk.gdb" | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters