From 738ee32a51163c515cb53866625ffead1ae52e6c Mon Sep 17 00:00:00 2001 From: Stewart Mackenzie Date: Wed, 15 Jan 2020 05:07:19 +0800 Subject: [PATCH] improved the development process --- .gitignore | 1 + README.md | 40 +++++++++++++++++++++++++++++++++++++++ build.sh | 1 + openocd/gdb-zynq-commands | 29 ++++++++++++++++++++++++++++ openocd/zc706.cfg | 5 ++++- tmux.sh | 25 ++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 1 deletion(-) create mode 100755 build.sh create mode 100644 openocd/gdb-zynq-commands create mode 100755 tmux.sh diff --git a/.gitignore b/.gitignore index ea8c4bf..70b03ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +zc706.elf diff --git a/README.md b/README.md index d722eb8..1e41742 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,43 @@ nix-shell --command "cargo xbuild --release --no-default-features --features=tar cd openocd openocd -f cora-z7-10.cfg ``` + +### Development Process + +Clone this repo onto your development/build machine and the raspberry pi that controls the Xilinx 7000 board + +On the dev machine, the below script builds zc706 and secure copies it to the target pi (in your pi $HOME directory) +```shell +cd ~/zc706 +./build.sh $your_user/ssh_id +``` + +On the pi, we need an information rich environment that includes a relatively reliable `gdb` experience (that includes `ctrl-p` and `ctrl-n` command history that persists across `cgdb` executions), run: +```shell +ssh pi4 +cd zc706 +./tmux.sh +``` + +Time to run your code with: +```shell +zynq-connect +zynq-restart +c +``` +or, for a more succinct experience, (identical to above) +```shell +dc +dr +c +``` + +After every build on your dev machine, simply run: +```shell +dr +c +``` +Sometimes you might need to type `load` after `dr`. + +Note, to exit `picocom` hit `ctrl-a x` + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..84a6332 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +nix-shell --command "cargo xbuild --release" && scp -P 2204 -C target/armv7-none-eabihf/release/zc706-experiments $1@nixbld.m-labs.hk:/home/$1/zc706/zc706.elf diff --git a/openocd/gdb-zynq-commands b/openocd/gdb-zynq-commands new file mode 100644 index 0000000..cca9608 --- /dev/null +++ b/openocd/gdb-zynq-commands @@ -0,0 +1,29 @@ +def zynq-connect + target remote :3333 +end + +def zynq-fsbl-restart + mon xilinx_ps7_init +end + +def zynq-restart + mon xilinx_ps7_init + #mon load_image zc706.elf 0x00000000 elf + load zc706.elf +end + +# easily typed shortcuts +# device connect +def dc + zynq-connect +end +# device restart +def dr + zynq-restart +end + +def dfr + zynq-fsbl-restart +end + + diff --git a/openocd/zc706.cfg b/openocd/zc706.cfg index 24e671e..c8f0b44 100644 --- a/openocd/zc706.cfg +++ b/openocd/zc706.cfg @@ -1,4 +1,5 @@ source [find interface/ftdi/olimex-arm-usb-tiny-h.cfg] +source [find xilinx-tcl.cfg] adapter_khz 1000 set PL_TAPID 0x23731093 @@ -41,4 +42,6 @@ arm mcr 15 0 1 0 0 [expr [arm mrc 15 0 1 0 0] & ~0xd] targets $_TARGETNAME_0 arm mcr 15 0 1 0 0 [expr [arm mrc 15 0 1 0 0] & ~0xd] - +# uncomment the below to load up a bitstream onto the fpga +#pld load 0 blinker_migen.bit +#exit diff --git a/tmux.sh b/tmux.sh new file mode 100755 index 0000000..aa42fdf --- /dev/null +++ b/tmux.sh @@ -0,0 +1,25 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p gdb openocd cgdb picocom tmux +SESSION=$USER + +tmux -2 new-session -d -s $SESSION +tmux new-window -t $SESSION:1 -n 'ZC706' +tmux split-window -h +tmux select-pane -t 0 +tmux send-keys "picocom --b 115200 /dev/ttyUSB1" C-m +#tmux send-keys "cat /dev/ttyUSB1" C-m +tmux select-pane -t 1 +tmux send-keys "sleep 10 && cgdb zc706.elf -x openocd/gdb-zynq-commands" C-m +tmux split-window -v +tmux resize-pane -D 20 +tmux send-keys "cd openocd && openocd -f zc706.cfg -c reset init" C-m + +# Set default window +tmux select-window -t $SESSION:1 + +# Set focus on gdb +tmux select-pane -t $SESSION:.- + +# Attach to session +tmux -2 attach-session -t $SESSION +