Skip to content

I have a question, oh also, where do I ask questions? #48

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

Closed
freiguy1 opened this issue Oct 16, 2018 · 6 comments
Closed

I have a question, oh also, where do I ask questions? #48

freiguy1 opened this issue Oct 16, 2018 · 6 comments

Comments

@freiguy1
Copy link

When it comes to embedded development, I'm fairly used to not debugging. On a related note I'm not used to gdb. Is there any way I can build with cargo and then just use openocd to push the compiled bytes to my device? All the documentation I've seen requires gdb to flash the program to the board. Would this be worth adding to the book?

Secondly, where do I ask questions about embedded rust dev? Making an issue like this seems a bit clunky, but I couldn't find any info related to this topic either.

@adamgreig
Copy link
Member

Hi!

To answer your second question first: good places include the embedded category on the forum and the IRC (#rust-embedded @ irc.mozilla.org).

I'd really recommend trying out debugging on embedded, especially with gdb. It can be a really quick and powerful way to solve problems. Even if you're not going to use it for debugging though, you do have to use it to load code via OpenOCD. It should be as simple as target :3333 followed by load, but the various tutorials and readmes are probably a better starting place.

If you just want to push a compiled binary to your device, you can actually skip OpenOCD entirely and use vendor supplied tools such as STLink (or the Linux-compatible texane/stlink).

There is work ongoing on a new book which will cover programming and debugging in detail, with lots of specific examples for different pieces of hardware.

@freiguy1
Copy link
Author

Thanks for the quick and helpful response. I think my main problem is inexperience with gdb. I was able to get a blink program with RTFM flashed to my blue pill with gdb. It just seemed cumbersome to build, run gdb, then type continue, next, next to get my program running each time I make a change. Also it seems I'm not exiting gdb correctly because my blinking led stops blinking. I'm being intentionally vague here because I can't remember each detail since it's been a few weeks.

@jamesmunns
Copy link
Member

Issue is already closed, but @freiguy1, make sure to check out .gdbinit, you can specify commands to execute every time you load gdb. For example, you might have something like this:

target remote :3333
load
continue

Which would open the connection to the debugger, load your binary, and begin running it.

@freiguy1
Copy link
Author

Ah, of course. Great idea. I just tried out my project again last night and another issue I have is the software doesn't run (LED isn't blinking) on the blue pill unless it's hooked up to gdb.

In other words, if I disconnect my blue pill from my computer and power it with a cell phone charger, the LED doesn't blink. Almost like it's waiting for gdb or openocd to give it the go ahead?

@freiguy1 freiguy1 reopened this Oct 16, 2018
@adamgreig
Copy link
Member

Are you using semihosting (or panic-semihosting)? Semihosting will generally require an attached debugger to function, and otherwise blocks or panics.

@freiguy1
Copy link
Author

@adamgreig aww - I didn't see your reply. I absolutely am and that was the issue. I just figured it out and was hoping to enlighten everyone :)

Thanks again!

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

No branches or pull requests

3 participants