From: Luke Kenneth Casson Leighton Date: Sat, 10 Oct 2020 16:12:54 +0000 (+0100) Subject: add debug start/stop to firmware_upload script X-Git-Tag: 24jan2021_ls180~164 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e443cd78b7b050c56101c36374fdc429eaad0cd;p=soc.git add debug start/stop to firmware_upload script --- diff --git a/src/soc/debug/firmware_upload.py b/src/soc/debug/firmware_upload.py index 3b41654f..e388243e 100644 --- a/src/soc/debug/firmware_upload.py +++ b/src/soc/debug/firmware_upload.py @@ -40,14 +40,14 @@ WB_READ = 6 WB_WRRD = 7 -def read_dmi_addr(dmi_addr): +def read_dmi_addr(dut, dmi_addr): # write DMI address yield from jtag_read_write_reg(dut, DMI_ADDR, 8, dmi_addr) # read DMI register return (yield from jtag_read_write_reg(dut, DMI_READ, 64)) -def writeread_dmi_addr(dmi_addr, data): +def writeread_dmi_addr(dut, dmi_addr, data): # write DMI address yield from jtag_read_write_reg(dut, DMI_ADDR, 8, dmi_addr) @@ -76,13 +76,13 @@ def jtag_sim(dut, firmware): ####### JTAG to DMI Setup (stop, reset) ###### - yield from read_dmi_addr(dut, DMI_ADDR, 8, DBGCore.CTRL) + yield from read_dmi_addr(dut, DBGCore.CTRL) # read DMI CTRL reg status = yield from read_dmi_addr(dut, DBGCore.CTRL) print ("dmi ctrl status", bin(status)) # write DMI CTRL register - STOP and RESET - status = yield from writeread_dmi_addr(dut, DBCCore.CTRL, 0b011) + status = yield from writeread_dmi_addr(dut, DBGCore.CTRL, 0b011) print ("dmi ctrl status", hex(status)) assert status == 4 # returned old value (nice! cool feature!) @@ -90,7 +90,7 @@ def jtag_sim(dut, firmware): while True: status = yield from read_dmi_addr(dut, DBGCore.STAT) print ("dmi ctrl status", bin(status)) - if status & DBGStat.STOPPED: + if (status & (1<