NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
shibboleth has joined #openocd
dliviu has quit [Quit: Going away]
dliviu has joined #openocd
shibboleth has quit [Quit: shibboleth]
tsal_ has joined #openocd
tsal has quit [Ping timeout: 248 seconds]
shibboleth has joined #openocd
_whitelogger has joined #openocd
shibboleth has quit [Quit: shibboleth]
nerozero has joined #openocd
Haohmaru has joined #openocd
cp- has quit [Read error: Connection reset by peer]
jjulian has joined #openocd
<jjulian> Hey, I'm trying to setup openocd to access a RISC-V soft CPU running on a Lattice LIFCLU FPGA. The original Lattice tooling seems to use a patched openocd, using a vexriscv target. I am trying to use stock openocd with RISC-V instead. The CPU has a "JTAG channel" set to 14, which in the Lattice config is set using a "set channel 14" command in
<jjulian> openocd. Is that a standard command? I can't find it documented.
<jjulian> Right now, I am in a state where the scan sees the FPGA itself, but I can't get down to the CPU. If I do not set the channel in the lattice openocd variant, I get the same behavior. So I somewhat suspect that channel thing might be the issue?
<jjulian> the interface is a FTDI FT2232H
<zapb> jjulian, "set channel 14" is no OpenOCD command
<Haohmaru> forked and modified openocd again
<zapb> jjulian, where did you get the patched OpenOCD version from? The corresponding source code must be available somewhere
<zapb> If the target is a normal riscv target, you should be able to use the "riscv" target
<zapb> There is also a riscv-openocd fork which you can give a try
<jjulian> It's shipped as part of the Lattice Radiant tooling... I wouldn't be surprised if they violated license terms.
<zapb> jjulian, did you try vanilla openocd (Git master) with riscv target?
<jjulian> I just realized that the set channel command might be for their interface implementation. They have a dedicated process the "cableserver", which talks to the FTDI interface and are not using the stock ftdi support of openocd. I would obviously rather use the latter.
<jjulian> zapb: That's what I'm trying right now, but I can't get the JTAG scan to actuall see the CPU
<zapb> jjulian, show your config and output (pastebin)
<zapb> Would not be the first time some company violates GPL :D
<Haohmaru> "If you want to violate the GPL - press one" 11111111111111
<jjulian> zapb: This is the config that lattice uses: https://pastebin.com/LRKjvJc4. I've added the openocd call with all arguments in the bottom. My config currently looks like this: https://pastebin.com/f6n9kd7Q
<jjulian> And this is the output I get:
<jjulian> so true about the GPL...
<jjulian> and this is the output of the lattice openocd: https://pastebin.com/YZD1juj3
<Haohmaru> QCoreApplication::applicationDirPath <- dafuq, have they added some crap from the cue-tea lib to openocd?
<Haohmaru> and it looks like they aren't even using it properly
<zapb> jjulian, seems "heavily" modified. Maybe a look into the RISCV_SMALL_YAML file give some insights. Could be that they perform some configuration to enable debug access (?)
<zapb> jjulian, do you use the same adapter in both setups?
<zapb> (not read entirely)
<zapb> The most important part here is: "The VexRiscv debug infrastructure is not compatible with the standard RISC-V Debug Specification."
<jjulian> Sorry, was pulled into a call. Back now.
<jjulian> That post looks very much like it's what I need. Thanks. I'll check in detail
<zapb> jjulian, you're welcome
<jjulian> unfortunately that article leaves out the details on the JTAGG primitive cell support, which seems to be used to hook the VexRISC-V's JTAG behind that FPGA's JTAG. Couldn't really figure out how to configure that, yet.
<jjulian> I suppose this relates to the magic "set channel 14" in the lattice tooling.
<zapb> Is this a lattice specific thing?
<zapb> jjulian, feel free to ask/request the source code from Lattice (e.g. via forum)
<zapb> jjulian, you could also check if the "set channel" command is included in the openocd fork mentioned in the article
<Haohmaru> you should do that early because they probably won't respond very urgently ;P~
<jjulian> It seems lattice specific. This is the lattice-cable.cfg, which is used by their tooling: https://pastebin.com/kJ5XAwHf
<jjulian> If a channel is set, they relay that to the "lattice_jtaghub_channel_select" command
<jjulian> which is not supported by the spinalhdl riscv-openocd fork either
alkane has quit [Quit: WeeChat 4.6.3]
alkane has joined #openocd
<zapb> jjulian, is it not possible to route the jtag signals directly to I/Os?
<zapb> They did not even change the comments in the config file ("Olimex ARM-JTAG-EW") :D
<jjulian> zapb: there are not many spare I/Os on the board, so it's not really feasible to routed the CPU's JTAG to dedicated pins
<zapb> Okay, I see
<jjulian> I fear it wouldn't be even helpful if lattice published the source code of their openocd variant, as the actual magic for selecting the JTAG target probably appears within their cableserver, through which openocd only communicates via a tcp socket.
akaWolf has quit [Ping timeout: 240 seconds]
akaWolf has joined #openocd
flatmush has quit [Remote host closed the connection]
flatmush has joined #openocd
<jjulian> Maybe my best bet is to actually sniff the JTAG with a logic analyzer when using the lattice tooling to figure out which opcodes it send to select the CPU's JTAG port.
<PaulFertser> jjulian: is that thing you want going via JTAGG? And is it somehow that you do not see VHDL source for how the soft core integrates with it?
<PaulFertser> But that's weird, doesn't look like it provides an easy way to connect arbitrary JTAG TAP to it judging by https://github.com/tomverbeure/ecp5_jtag/blob/main/README.md
<jjulian> PaulFertser: To be honest I am not completely sure, whether JTAGG is what I need. I'm running on a LIFCL-33U FPGA, which is based on the Lattice Nexus platform. I couldn't find documentation specifically on that one for the JTAG routing feature. On the ECP5 FPGAs it apparently is done via JTAGG, though.
<PaulFertser> jjulian: quick look at that JTAGG description didn't tell me how one can switch between the states of the JTAG machine connected to it, that's odd.
Hawk777 has joined #openocd
<jjulian> PaulFertser: Did you look at [this](http://www.latticesemi.com/view_document?document_id=52656) or something else? The JTAGF seems to basically be a mux, which has two TDO output lines?
<PaulFertser> jjulian: I looked only at https://github.com/tomverbeure/ecp5_jtag/blob/main/README.md . Well, TDO output I can understand but for JTAG also you need TMS to guide state machine transitions.
<jjulian> Hm, I also can't really bring this together with the JTAG channel selection, where you can select 14, 15 or 16 for the RISC-V CPU in the lattice tooling.
<jjulian> The JTAGG really looks like a 1:2 mux at most, right?
<PaulFertser> Kinda but not sure how that combines with actual JTAG connections. Normally you have some amount of taps chained with TMS and TCK going in parallel, then you load "instructions" to each of them in parallel by going through the relevant states, then you go to Shift-DR state and you can load/read DRs of each of them in parallel.
<PaulFertser> Big SoCs also often feature some "JTAG routers" or "switches" which allow to connect additional taps in the chain but it's still the same idea after the connection is completed.
<jjulian> Hm, yes, I saw a mention of "JTAG Hub" in some Lattice document. That sounds somewhat like a router/switch. And maybe that one is in use. But documentation doesn't really seem to exist.
Haohmaru has quit [Quit: saionara]
nerozero has quit [Ping timeout: 240 seconds]
jjulian has quit [Quit: Client closed]
tsal has joined #openocd
tsal_ has quit [Ping timeout: 276 seconds]
Hawk777 has quit [Quit: Leaving.]