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

applet.interface.jtag_openocd: Add option to ignore unsupported commands #267

Closed

Conversation

mwick83
Copy link

@mwick83 mwick83 commented Jan 30, 2021

This adds an option to ignore unsupported commands.

This can be very handy when debugging the protocol using netcat / socat,
in cases it is needed to send CR/LF to actually get the data sent out.
Without the option, the fifo will simply not advance processing and the
connection gets stuck.

This adds an option to ignore unsupported commands.

This can be very handy when debugging the protocol using netcat / socat,
in cases it is needed to send CR/LF to actually get the data sent out.
Without the option, the fifo will simply not advance processing and the
connection gets stuck.
@whitequark
Copy link
Member

Try socat open:/dev/tty,raw,echo=0 tcp-connect:localhost:3333 instead.

@mwick83
Copy link
Author

mwick83 commented Feb 1, 2021

Thanks for the hint, I will check that out!
But nevertheless, I'm was a bit surprised that the FIFO read enable gets deasserted on unsupported command characters. The consequence is that the FIFO will never ever be read again and the communication gets stuck at that point. Any particular reason to behave like that?

@whitequark
Copy link
Member

Any particular reason to behave like that?

Robustness against unknown conditions. If I was writing software, I would add an else: assert False branch to make sure that I only accept the input that I definitively understand--since doing otherwise could be hiding a bug! (For example, I could have misunderstood the spec.) In hardware I can't exactly crash the FPGA, so it just infinite loops instead.

All of the existing applets are written like that (where they aren't, they should be) and I expect future applets to be, though this could be improved by adding some sort of signaling for the case where the assertion is hit.

@mwick83
Copy link
Author

mwick83 commented Feb 1, 2021

Robustness against unknown conditions. If I was writing software, I would add an else: assert False branch to make sure that I only accept the input that I definitively understand--since doing otherwise could be hiding a bug! (For example, I could have misunderstood the spec.) In hardware I can't exactly crash the FPGA, so it just infinite loops instead.

Well, I guess there are different standpoints here, because I think silently looping without signaling isn't very userfriendly and just looks like another kind of hidden bug from a user perspective...

All of the existing applets are written like that (where they aren't, they should be) and I expect future applets to be, though this could be improved by adding some sort of signaling for the case where the assertion is hit.

... but I will not argue against the design decision, because consistancy is far more important in my opinion.

@mwick83 mwick83 closed this Feb 1, 2021
@mwick83 mwick83 deleted the ign-unsupp-jtag-openocd branch February 1, 2021 09:48
@whitequark
Copy link
Member

silently looping without signaling isn't very userfriendly

Indeed. That's why I said that some sort of signaling for this condition should be added. Unfortunately, this is not trivial, and since Glasgow's approach is novel, I considered it more important to get the common case to be robust than to handle the uncommon case of someone extending the openocd protocol itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants