Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JTAG Configuration #32

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ occamy_system_download_sw: # In ESAT Server; this procedure will only inject the
make -C ./target/fpga/sw download_sw

open_terminal: # It opens ttyUSB1 without locking it, and set baudrate at 1Mbps
$(shell minicom -D /dev/ttyUSB1 -b 1000000 -o)
$(info "shell minicom -D /dev/ttyUSB1 -b 1000000 -o")

# FPGA Workflow (with no Xilinx IP - tapeout configuration)
# Please be attention that in this configuration, injecting any binary files by Xilinx Vivado are not possible anymore; please use JTAG or embedded bootrom to load the binary
Expand Down
33 changes: 0 additions & 33 deletions target/fpga/openocd_configs/digilent-HS2.cfg

This file was deleted.

33 changes: 0 additions & 33 deletions target/fpga/openocd_configs/vcu128-1.cfg

This file was deleted.

33 changes: 0 additions & 33 deletions target/fpga/openocd_configs/vcu128-2.cfg

This file was deleted.

8 changes: 7 additions & 1 deletion target/fpga/sw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ APP ?= $(TARGET)/sim/sw/host/apps/hello_world/build/hello_world.elf
BIN2JTAG ?= $(ROOT)/util/bin2jtag.py
BIN_VERIFY ?= $(ROOT)/util/bin2jtag_only_verify.py

CVA6_GCC_ROOT = /tools/riscv/bin
RISCV_CC = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-gcc
RISCV_OBJCOPY = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-objcopy
RISCV_OBJDUMP = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-objdump
RISCV_READELF = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-readelf

.PHONY: sw download_sw clean verify_sw

sw: bootrom.tcl app.tcl app_verify.tcl
Expand All @@ -21,7 +27,7 @@ bootrom.tcl: $(BOOTROM)
$(BIN2JTAG) -c32 -b 0 -d hw_axi_1 $< > $@

app.bin:
riscv64-unknown-elf-objcopy -O binary $(APP) $@
$(RISCV_OBJCOPY) -O binary $(APP) $@

app.tcl: app.bin
$(BIN2JTAG) -c32 -b 80000000 -d hw_axi_2 $< > $@
Expand Down
6 changes: 3 additions & 3 deletions target/fpga/sw/send_uart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ else
FILE=$1
fi

stty -F /dev/ttyUSB1 cs8 1000000 ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon crtscts
stty -F /dev/ttyUSB3 cs8 1000000 ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon crtscts

echo -n 2 > /dev/ttyUSB1
echo -n 2 > /dev/ttyUSB3

sx -k "$FILE" < /dev/ttyUSB1 > /dev/ttyUSB1
sx -k "$FILE" < /dev/ttyUSB3 > /dev/ttyUSB3

fi
23 changes: 23 additions & 0 deletions target/fpga_chip/jtag/app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))
TARGET := $(MKFILE_DIR)../../..
ROOT := ${MKFILE_DIR}../../../..

APP ?= $(TARGET)/sim/sw/host/apps/hello_world/build/hello_world.elf

CVA6_GCC_ROOT = /tools/riscv/bin
RISCV_CC = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-gcc
RISCV_OBJCOPY = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-objcopy
RISCV_OBJDUMP = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-objdump
RISCV_READELF = $(CVA6_GCC_ROOT)/riscv64-unknown-elf-readelf

.PHONY: download_sw

app.bin:
$(RISCV_OBJCOPY) -O binary $(APP) $@

download_sw:
${VIVADO} -mode batch -source download_sw.tcl

clean:
@rm -f app.bin
1 change: 1 addition & 0 deletions target/fpga_chip/jtag/openocd_configs/download_bin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
load_image /users/micas/ydeng/Desktop/SNAX/HeMAiA/target/fpga_chip/jtag/app/app.bin 0x80000000
27 changes: 27 additions & 0 deletions target/fpga_chip/jtag/openocd_configs/hemaia_vcu128.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

adapter driver ftdi
adapter speed 2000
transport select jtag

# FT4232
ftdi vid_pid 0x0403 0x6011
adapter serial FT80Z5JA
ftdi layout_init 0x0808 0x0b0b
ftdi channel 1

set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20002001

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME

riscv.cpu riscv set_ir idcode 0x9249
# riscv.cpu riscv set_ir dtmcs 0x22924
# riscv.cpu riscv set_ir dmi 0x23924

tcl port disabled
gdb port 3334
telnet_port 4444
27 changes: 27 additions & 0 deletions target/fpga_chip/jtag/openocd_configs/hemaia_vpk180.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

adapter driver ftdi
adapter speed 2000
transport select jtag

# FT4232
ftdi vid_pid 0x0403 0x6011
adapter serial FT80Z5JA
ftdi layout_init 0x0808 0x0b0b
ftdi channel 0

set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20002001

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME

riscv.cpu riscv set_ir idcode 0x9249
# riscv.cpu riscv set_ir dtmcs 0x22924
# riscv.cpu riscv set_ir dmi 0x23924

tcl port disabled
gdb port 3334
telnet_port 4444
Loading