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

tools/mspdebug: fix make debug and make debugserver #19556

Merged
merged 1 commit into from
May 24, 2023

Conversation

maribu
Copy link
Member

@maribu maribu commented May 7, 2023

Contribution description

The semantics of make debug and make debugserver have changed in the years since the MSP430 integration. This brings the implementation back into line with the current semantics

  • make debug now starts both mspdebug and GDB, no need to run make debugserver prior to make debug anymore
  • make debug no longer flashes the target to not waste flash erase cycles
  • GDB mutliarch support is added
  • support for selecting a debug adapter by its serial is added

Testing procedure

make BOARD=<SOME_MSP430_BOARD> debug should now just work. (It does so for me and my Olimex MSP430-H1611.)

Issues/PRs references

None

@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: tools Area: Supplementary tools CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs labels May 7, 2023
@github-actions github-actions bot added the Area: build system Area: Build system label May 7, 2023
@riot-ci
Copy link

riot-ci commented May 7, 2023

Murdock results

✔️ PASSED

ca15b1e tools/mspdebug: fix make debug and make debugserver

Success Failures Total Runtime
1 0 1 54s

Artifacts

@maribu maribu force-pushed the tools/mspdebug branch 4 times, most recently from 2d7a19f to c7d8482 Compare May 7, 2023 11:18
Comment on lines -2 to -4
ifeq ($(strip $(MSPDEBUG_PROGRAMMER)),uif)
MSPDEBUGFLAGS += -d $(PROG_DEV)
endif
Copy link
Contributor

@aabadie aabadie May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it's possible to flash using mspdebug over a TTY, using uif-bsl (maybe before it was called uif ?). Even if unused (no msp430 based board supports this in RIOT codebase, maybe it was for msp430 boards that were removed a few years ago ?), maybe we should keep it for compatibility ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mspdebug supports flashing via TTY instead of USB for a number of programmers, but defaults to using USB. My guess is that this is a workaround that I don't think is needed anymore. At least judging from the output of mspdebug uif it seems it would just select the matching USB device directly without a TTY given:

$ mspdebug uif   
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <[email protected]>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.3.1.4 Copyright (C) 2013 TI, Inc.

usbutil: unable to find a device matching 0451:f430

But that theory will be difficult to put to test:

The MSP-FET430UIF is no longer recommended for new designs.

And it seems to not be available any more. I have the feeling that most people actually taking a look at MSP430 will either use the new boards with FRAM with the integrated eZ-FET programmer/debugger (once that is ported to RIOT), or go for Olimex hardware with legacy MSP430Fx1xx hardware. Maybe @OlegHahm has still legacy programmers at hands and could give it a test?

@maribu
Copy link
Member Author

maribu commented May 10, 2023

I could add the -d $(PROG_DEV) again; but I have no means of testing. IMO the logic should be different: If the users provides some PROG_DEV, it should be used regardless of the MSPDEBUG_PROGRAMMER that is used. This would allow user of uif to also flash without having to specify PROG_DEV. And if someone indeed faces an issue that could be worked around by using the TTY for programming instead of using USB directly, this could be used for all programmers.

(E.g. for my Olimex MSP430-JTAG-TINY-V2 programmer I first had to write an udev rule to give my default user the permissions. If I had no root access to install such udev rule, I could have used the TTY interface instead.)

@maribu maribu force-pushed the tools/mspdebug branch 2 times, most recently from 344c8cd to dc0ef4f Compare May 11, 2023 11:06
@maribu maribu requested a review from jia200x as a code owner May 11, 2023 11:06
@github-actions github-actions bot added the Area: doc Area: Documentation label May 11, 2023
@maribu
Copy link
Member Author

maribu commented May 11, 2023

PROG_DEV is set by default to $(PORT), so it is never empty. I changed the logic to allow using -d again by setting MSPDEBUG_TTY. I also prepared the debugger script for the new MSP430FRxxxx MCUs that no longer JTAG, but Spi-Bi-Wire for programming/debugging. The debugger protocol can now be set to Spi-Bi-Wire by future boards.

@maribu
Copy link
Member Author

maribu commented May 15, 2023

I just noticed that FFLAGS has to be a recursively defined variable due to $(FLASHFILE) being undefined at the time FFLAGS += "prog $(FLASHFILE)" is evaluated and fixed it directly.

The semantics of `make debug` and `make debugserver` have changed in
the years since the MSP430 integration. This brings the implementation
back into line with the current semantics

- `make debug` now starts both mspdebug and GDB, no need to
  run `make debugserver` prior to `make debug` anymore
- `make debug` no longer flashes the target to not waste flash erase
  cycles
- GDB mutliarch support is added
- support for selecting a debug adapter by its serial is added
@aabadie
Copy link
Contributor

aabadie commented May 24, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented May 24, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 993c10a into RIOT-OS:master May 24, 2023
@maribu maribu deleted the tools/mspdebug branch May 24, 2023 19:06
@maribu
Copy link
Member Author

maribu commented May 24, 2023

Thx :)

@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: doc Area: Documentation Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants