zynq-rs/README.md

109 lines
2.3 KiB
Markdown
Raw Normal View History

2019-05-25 08:38:05 +08:00
# Build
```shell
2020-08-07 10:41:08 +08:00
nix-shell --command "cargo xbuild --release -p experiments"
2019-05-25 08:38:05 +08:00
```
2020-01-26 08:45:02 +08:00
Currently the ELF output is placed at `target/armv7-none-eabihf/release/experiments`
2019-05-25 08:38:05 +08:00
# Debug
2019-05-20 07:21:48 +08:00
## Using the Xilinx toolchain
2019-05-25 08:38:05 +08:00
Tested with the ZC706 board.
2019-05-20 07:21:48 +08:00
Run the Xilinx Microprocessor Debugger:
```shell
/opt/Xilinx/14.7/ISE_DS/EDK/bin/lin64/xmd
```
Connect to target (given it is connected and you have permissions):
```tcl
connect arm hw
```
Leave xmd running.
Start the Xilinx version of the GNU debugger with your latest build:
```shell
/opt/Xilinx/14.7/ISE_DS/EDK/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-gdb zc706
```
Connect the debugger to xmd over TCP on localhost:
```gdb
target remote :1234
```
Proceed using gdb with `load`, `c`
2019-05-25 08:38:05 +08:00
## Using OpenOCD
2019-05-20 07:21:48 +08:00
### Running on the ZC706
2019-05-25 08:38:05 +08:00
```shell
2020-08-07 10:41:08 +08:00
nix-shell --command "cargo xbuild --release -p experiments"
2019-08-20 13:45:50 +08:00
cd openocd
openocd -f zc706.cfg
```
2019-05-25 08:38:05 +08:00
### Running on the Cora Z7-10
```shell
nix-shell --command "cd experiments && cargo xbuild --release --no-default-features --features=target_cora_z7_10"
2019-08-20 13:45:50 +08:00
cd openocd
openocd -f cora-z7-10.cfg
2019-05-25 08:38:05 +08:00
```
2020-01-15 05:07:19 +08:00
### Loading a bitstream into volatile memory
```shell
2020-08-07 10:41:08 +08:00
openocd -f zc706.cfg -c "pld load 0 blinker_migen.bit; exit"
```
2020-01-15 05:07:19 +08:00
### Development Process
Clone this repo onto your development/build machine and the raspberry pi that controls the Xilinx 7000 board
2020-08-07 10:41:08 +08:00
On the dev machine, the below script builds zc706 and secure copies it to the nixbuild.m-labs.hk server:
2020-01-15 05:07:19 +08:00
```shell
2020-08-07 10:41:08 +08:00
cd ~/zynq-rs
./build.sh $your_user_or_ssh_id
```
Alternatively, you may copy the zc706 build to the target pi (in your pi $HOME directory, for example) using:
```shell
cd ~/zynq-rs
scp -C target/armv7-none-eabihf/release/experiments your_user_or_ssh_id@pi_hostname:/home/your_user_or_ssh_id/zynq-rs/zc706.elf
2020-01-15 05:07:19 +08:00
```
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
2020-08-07 10:41:08 +08:00
cd zynq-rs
# For ZC706, run:
./tmux.sh 0
# For Cora Z7, run:
2020-01-15 05:07:19 +08:00
./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`.