Rust + Embedded + gdbserver + JLink

Answered

I am trying to put together a complex use case, but it looks like things are *almost* there. But I need a little bit of help, since I am not so familiar with CLion.

I am trying to set up CLion to do development wth Rust for an embedded target. Getting debugging working would make this a complete environment.

I have tried to create an "Embedded GDB Server" configuration, but unfortuantely I am left with a selection that says: "Nothing to run on".

 

So far, I have installed the Rust and Cargo plugins. Cargo plugin works fine for creating build configs, and by using the .cargo/config, I can target my embedded target.

For the debugging part, I am trying to use a J-Link debugger, since they are the best, and they provide a gdbserver.

gdbserver + arm-none-eabi-gdb definitely works from the command line, and I can load, run, and debug the ELF. Now it is just a matter of getting CLion to work with that.

Attached is a screenshot of how I have set up the configuration. Any clues as to why this results in something that is not launchable?

1
8 comments
Official comment

I think it's not possible yet to configure pure Rust(=non-CMake) project + embedded debugger.
Nevertheless, we have a couple of working examples Rust+C+CMake+embedded examples.

You may have a look at those:

https://github.com/JetBrains/hackathon19_deskovery
https://github.com/elmot/f3-rust/blob/master/CMakeLists.txt#L43-L65

I'd also highly recommend you to add -LocalhostOnly -nogui -singlerun keys to gdbserver parameters.

Avatar
Permanently deleted user

Ilia Motornyi, is this feature being worked on?

0

Well, we're getting closer to that, just because of various code changes and refactorings, but no actual schedule. I am afraid CMake+cargo(xcargo) is still the only option.
If you wanna embedded rust rushed, please file a ticket at https://youtrack.jetbrains.com/newIssue?project=CPP&c=Subsystem%20Embedded
People can vote there, and if the ticket gets enough of votes, we'll prioritize it.

0
Avatar
Permanently deleted user

Perfect, I've filed a ticket. Thanks!

0
Avatar
Permanently deleted user

Hi DDrost, do you have a link to the ticket you created? I'd like to upvote it but can't find it...

0

Here's the ticket:

https://youtrack.jetbrains.com/issue/CPP-18738

I should follow-up and see if they are unblocked on getting the embedded example up and running.

0
Avatar
Permanently deleted user

Awesome thanks Andrew.

0
Avatar
Permanently deleted user

I've made a CMake module to create CMake targets for rust following Ilia Motornyi examples.  It may be helpful to others until native support lands in CLion.

 

It's available here: https://github.com/berkowski/rust-target-cmake

1

Please sign in to leave a comment.