1
0
Fork 0

improved the development process

This commit is contained in:
Stewart Mackenzie 2020-01-15 05:07:19 +08:00
parent 688e3b4432
commit 738ee32a51
6 changed files with 100 additions and 1 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/target
zc706.elf

View File

@ -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`

1
build.sh Executable file
View File

@ -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

29
openocd/gdb-zynq-commands Normal file
View File

@ -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

View File

@ -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

25
tmux.sh Executable file
View File

@ -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