-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
No way to address a particular FTDI for OpenOCD #22543
Comments
@vanti did you deal with something similar to this? |
The openocd runner has gotten really overgrown over time. It was basically ported from shell to Python and then evolved organically since. It would be nice to see a cleanup of the way it works instead of this proliferation of options, but I personally am not going to work on that anytime soon, as it'd be spare time effort for me :). So I too think suggestions are welcome. |
I have dealt with something similar in the context of LAVA, where I want to have multiple boards connected. The way I dealt with it was to create an additional .cfg file, board_selection.cfg, with the command:
The TI device that I dealt with uses "xds110_serial" instead of "ftdi_serial". The serial number is set as part of a LAVA board file that configures the board. Then, when running the openocd command, I added an additional command line parameter
to essentially augment the default config with the additional statement. However, note that LAVA invokes openocd directly, not through 'west', nor does it use openocd.cfg. The proposed approach here doesn't necessitate a temporary board_selection.cfg file to be created, which is good. I wonder if exposing "--precfg-cmd" and letting the user figure out the command isn't a little unfriendly and prone to typos. How about just running
and standardizing to passing a variable named $_ZEPHYR_BOARD_SERIAL with the number to openocd.cfg? Then openocd.cfg can just invoke
depending on the platform. |
@vanti thanks for your input! In fact the first thing that I wanted to do was exactly Also since Anyways if we're in agreement with use of |
To be used in setups with multiple boards attached to the same one host we need to have an ability to specify precisely which JTAG probe to use for a particular board. This is done by passing "ftdi_serial XXX" command to OpenOCD. And the serial ("XXX") is supposed to be passed from higher level, typically via west's options. And exactly for that we add another "openocd" runner option "--serial=XXX" which sets a Tcl's "_ZEPHYR_BOARD_SERIAL" variable that later gets passed to OpenOCD's "ftdi_serial" command. See more discussions on the matter here: zephyrproject-rtos#22543 Signed-off-by: Alexey Brodkin <[email protected]>
To be used in setups with multiple boards attached to the same one host we need to have an ability to specify precisely which JTAG probe to use for a particular board. This is done by passing "ftdi_serial XXX" command to OpenOCD. And the serial ("XXX") is supposed to be passed from higher level, typically via west's options. And exactly for that we add another "openocd" runner option "--serial=XXX" which sets a Tcl's "_ZEPHYR_BOARD_SERIAL" variable that later gets passed to OpenOCD's "ftdi_serial" command. See more discussions on the matter here: #22543 Signed-off-by: Alexey Brodkin <[email protected]>
@abrodkin I'm closing as I think this is done. Please reopen if you disagree. |
OpenOCD runner works perfectly fine for boards with FTDI-based JTAGs while there's only 1 board attached to the host. If multiple similar or the same boards are attached
openocd
cannot figure out which JTAG probe to use as typically OpenOCD config only filters FTDI devices by USB VID/PID.One solution to the problem might be in specifying FTDI's
serial number
via OpenOCD's command like that:ftdi_serial 251642517567
. But that this command needs to be executed in between of FTDI interface creation:and TAP instantiation
i.e. typically in the middle of board's
openocd.cfg
. So ideally we just put that command right there inopenocd.cfg
. But given that serial number is [at least supposed to be] unique we cannot hardcode any value once and for all. Ok, we'll use internal variable, so we'll add something like that:Ok, but the next question is how to set this new
_FTDI_SERIAL
variable? That's easy, just issue command like thatset _FTDI_SERIAL 251642517567
, i.e. onopenocd
invocation we may do-c 'set _FTDI_SERIAL 251642517567'
.Now looking at OpenOCD runner (scripts/west_commands/runners/openocd.py) I see that it's not obvious how to squeeze yet another command in between
openocd
binary itself &openocd.cfg
.The first thing that comes to my mind is to add yet another option like "precfg_cmd" and add it like that
Now I at least may specify desired FTDI like that:
Frankly I don't quite like that hack so if there're any better suggestions I'll be happy to discuss it.
The text was updated successfully, but these errors were encountered: