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

[feature] MCU hotplug - Changing targets. #244

Closed
rewolff opened this issue Jun 15, 2014 · 8 comments · Fixed by #1124
Closed

[feature] MCU hotplug - Changing targets. #244

rewolff opened this issue Jun 15, 2014 · 8 comments · Fixed by #1124

Comments

@rewolff
Copy link
Contributor

rewolff commented Jun 15, 2014

I leave "st-util -m" running in a corner and then "develop" stuff for my STM32 boards.

Sometimes I swap targets. disconnect the cable to one SWD connetor, connect the next target board.

st-util then doesn't notice the change. It never notices that a different processor is now connected. I'm not sure when would be appropriate to check the connected hardware. How about when gdb connects? I have to switch directories and compiler settings, and will quit and restart gdb in the new directory when starting to work on the other project.

@prattmic
Copy link
Contributor

That is certainly a bug. I would say that it should either do as you say, and look for devices on GDB connect, or simply detect the device disconnect and exit.

It isn't exactly a solution to your problem, but my typical workflow is to use a Bash function that will automatically start st-util and gdb, allowing me to start debugging with one command, without having st-util running continuously in the background.

function stm32-gdb() {
    st-util &> /dev/null & arm-none-eabi-gdb -q -ex "tar rem :4242" --symbol "$*";
}

https://github.com/prattmic/dotfiles/blob/master/aliases#L23

@xor-gate
Copy link
Member

This behaviour is nice to have, but OpenOCD will also never support this. A more advanced mechanism needs to be designed and implemented to support this. There are two cases which the stlink library (and tools) are unable to detect (currently):

  • Hotplug of USB
  • Hotplug of SWD
  • Running multiple instances of stlink tools/libs and synchronize between them (a daemon which manages the programmers)

@xor-gate
Copy link
Member

I'm closing this due to inactivity of the original issuer, and because it is not a common use-case.

@rewolff
Copy link
Contributor Author

rewolff commented May 17, 2016

Calling me inactive?? Liar! :-)

Ah well. Yeah I know I'm weird...

@xor-gate
Copy link
Member

Hahaha, I know you are alive you wizard 👍 I appreciate your feedback but there needs to be moved alot of work to have hot-plugging working cross-platform. As stated in libusb documentation it is supported on some platforms: http://libusb.sourceforge.net/api-1.0/hotplug.html. And for swd-only hotplug there needs to be some retrying as done in openocd.

@rewolff
Copy link
Contributor Author

rewolff commented May 18, 2016

I would think that: "when GDB connects, check the CPU that is connected" is not very difficult and platform independent. If the CPU is not the one we expect, reinitialize the "what CPU do we have" part....

The "hotplug the STLINK" is probably more difficult.

@xor-gate
Copy link
Member

It has nothing todo with gdb, because st-util needs to attach/reattach to the (new)CPU.

@rewolff
Copy link
Contributor Author

rewolff commented May 18, 2016

If "reconnect" is really necessary, then st-util already does that: I can change the attached CPU on the fly and st-util won't notice. The problem is that if I change to a different CPU, st-util will use the wrong flashing algorithm. So verifying the CPUID register at each gdb-connect would make st-util aware of the changed CPU. The easiest "fix" would be to just say: "whoa CPU changed, error, exiting".

@Nightwalker-87 Nightwalker-87 added this to the v1.7.0 milestone Feb 26, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.7.0, Feedback required Mar 20, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, v1.6.2 Mar 25, 2020
@Nightwalker-87 Nightwalker-87 changed the title Changing targets. [feature] MCU hotplug - Changing targets. Mar 27, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.2, v1.6.1 Mar 27, 2020
@Nightwalker-87 Nightwalker-87 added this to To do in Release v1.6.1 via automation Mar 27, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.1, v1.6.2 Apr 28, 2020
@Nightwalker-87 Nightwalker-87 removed this from To do in Release v1.6.1 Apr 28, 2020
@Nightwalker-87 Nightwalker-87 added this to To do in Release v1.7.0 via automation May 24, 2020
@Nightwalker-87 Nightwalker-87 removed this from To do in Release v1.7.0 Mar 10, 2021
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.2, v1.6.3 Mar 10, 2021
@Nightwalker-87 Nightwalker-87 added this to To do in Release v1.7.0 via automation Apr 11, 2021
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.8.0, v1.7.0 Apr 11, 2021
@Nightwalker-87 Nightwalker-87 moved this from To do to Review in progress in Release v1.7.0 Apr 11, 2021
@Nightwalker-87 Nightwalker-87 moved this from Review in progress to Reviewer approved in Release v1.7.0 Apr 11, 2021
Release v1.7.0 automation moved this from Reviewer approved to Done Apr 13, 2021
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants