Skip to content

Commit

Permalink
Add a new debug target for the atlys board (see timvideos#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
cklarhorst committed Jul 20, 2020
1 parent 8126cd4 commit 983baf2
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions targets/atlys/debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from litex.soc.cores import uart
from litescope import LiteScopeAnalyzer
from .base import BaseSoC

# Connection Overview:
#
# |---> LiteScope
# HOST <--> UARTWishboneBridge <---|---> Crossover UART
# |---> CPU Debug Interface
#
# Note: The CPU Debug Interface is only available
# if your CPU_VARIANT includes "debug"
#
# There are currently two ways to connect to your UARTWishboneBridge:
# 1. Litex Server:
# Usage: litex_server --uart --uart-port /dev/ttyXXX
# - Features:
# - LiteScope: (todo)
# - Crossover UART:
# - cd into build/[target]/test/
# - start litex_crossover_uart
# - connect to /dev/pts/XXX (e.g minicom -D /dev/pts/XXX)
# - CPU Debug Interface: (not supported)
# 2. Wishbone Tool (https://github.com/litex-hub/wishbone-utils)
# - Features:
# - LiteScope: (not supported)
# - Crossover UART:
# wishbone-tool -s terminal --csr-csv build/[target]/test/csr.csv
# - CPU Debug Interface:
# - wishbone-tool -s gdb --csr-csv build/[target]/test/csr.csv
# - start gdb
# - issue: target remote :1234

class DebugSoC(BaseSoC):

def __init__(self, platform, *args, **kwargs):

# Use the crossover uart that is able to connect over the uart bridge
kwargs['uart_name']="crossover"

BaseSoC.__init__(self, platform, *args, **kwargs)

#Add the uart bridge (you may adapt the baudrate e.g 500000, 921600)
self.submodules.uartbone = uart.UARTWishboneBridge(
pads = self.platform.request("serial"),
clk_freq = self.sys_clk_freq,
baudrate = 115200)
self.bus.add_master(name="uartbone", master=self.uartbone.wishbone)

#add LitexScope
analyzer_signals = [
self.ddrphy.dfi,
self.cpu.ibus.cyc,
self.cpu.ibus.stb
]
self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals,
depth = 2048,
clock_domain = "sys")
self.add_csr("analyzer")

# Generate the configuration file for the LiteScope client
def do_exit(self, vns, filename="test/analyzer.csv"):
self.analyzer.export_csv(vns, filename)

SoC = DebugSoC

0 comments on commit 983baf2

Please sign in to comment.