texitoi / blue-pill-quickstart Goto Github PK
View Code? Open in Web Editor NEWQuickstart a Rust project for the blue pill board
License: MIT License
Quickstart a Rust project for the blue pill board
License: MIT License
My *buntu setup already had a copy of OpenOCD installed in /usr/local
, so following the instructions produced this error:
Open On-Chip Debugger 0.10.0+dev-00403-g3737dd69e738 (2018-04-20-22:55)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:60: Error: Can't find openocd.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 60
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: Debug Adapter has to be specified, see "interface" command
embedded:startup.tcl:60: Error:
in procedure 'script'
at file "embedded:startup.tcl", line 60
The solution was to run this instead:
openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg
It might be a good idea to acknowledge that possibility.
I get the error below when trying run on ubuntu. I'm not familiar enough with rust yet but it looks like "-Tlink.x" is being used as a command line argument twice for rust-lld. Commenting out the rustflags line in .cargo/config fixes this for me.
Compiling blue-pill-quickstart v0.1.0 (/home/zlewko/src/my-new-project/blue-pill-quickstart)
error: linking with `rust-lld` failed: exit code: 1
|
= note: "rust-lld" "-flavor" "gnu" "-L" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.10l9keozr1azjxxb.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1nnvqjw29kudhvn3.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1qdwekv9om07jq89.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.1wqxsabd0q7gamlh.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2ckemoq0z4sbznl9.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2d3ro4mimji4gjot.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2jvvr9y25t17tqu8.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2ktiphgdj33f5dhp.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2odvisrdwlwbncgw.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.2zau10m7ucn44pn4.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.3o97obryy241fwbl.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.4hlo6wom1hmssrw3.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.4l7jjzmb1yy8yvxp.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.5722xo7rjzr5sw89.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.5ebqcj5vu1lkcjus.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.64rwavbiml2ui7g.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.aigwtnjqxough0l.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.izjotxgugmodeed.rcgu.o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc.onapcjauee2gk5n.rcgu.o" "-o" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/blue_pill_quickstart-3ab8b685c888f3cc" "--gc-sections" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/debug/deps" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-9345be4a269acadb/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-rt-2b43955fa98b4ad0/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/cortex-m-semihosting-ab07e1b57173a6a5/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-hal-16832c351c2938ac/out" "-L" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-d3deb763bb715481/out" "-L" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib" "-Bstatic" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libstm32f103xx_hal-75db98507f0321f8.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcast-a5321062713d01a4.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libstm32f103xx-09e4d9d1fdff3e8e.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libembedded_hal-aad34f8d9c33ffcf.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvoid-c89b4d8d5f4ffed8.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libnb-115008accecdccaa.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m_rt-4d3998b9322d76f6.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libr0-d9b5ebe20b659dec.rlib" "--start-group" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libpanic_semihosting-48bd918cb6b7e64c.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m_semihosting-619a349c9ad4ce86.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libcortex_m-3fdd2f688076ed68.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvolatile_register-237e033e63048848.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libvcell-617ada1d0d900745.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libbare_metal-d9e85f06fcdd0262.rlib" "/home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/deps/libaligned-24e16d16f1d52771.rlib" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib/libcore-bc99d396b91fe14a.rlib" "--end-group" "/home/zlewko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-4b33c00e5bd54fa2.rlib" "-Tlink.x" "-Tlink.x" "-Bdynamic"
= note: rust-lld: error: /home/zlewko/src/my-new-project/blue-pill-quickstart/target/thumbv7m-none-eabi/debug/build/stm32f103xx-hal-16832c351c2938ac/out/memory.x:4: region 'FLASH' already defined
>>> FLASH : ORIGIN = 0x08000000, LENGTH = 64K
>>> ^
error: aborting due to previous error
error: Could not compile `blue-pill-quickstart`.
Hello and thank you!
It turns out that recent blue pills sometimes (always?) have a clone of the stm32 so the corresponding openocd config file needs to be updated as described here: https://www.eevblog.com/forum/beginners/unexpected-idcode-flashing-bluepill-clone/
In case that link breaks, the error printed by openocd is:
Info : using stlink api v2
Info : Target voltage: 3.140492
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'init'
in procedure 'ocd_bouncer'
The fix is to update the ID in the stm config file to match the clone:
curl https://raw.githubusercontent.com/arduino/OpenOCD/master/tcl/target/stm32f1x.cfg > clone.cfg
sed -i 's/0x1ba01477/0x2ba01477/g' clone.cfg
openocd -f interface/stlink-v2.cfg -f clone.cfg
Can this be fixed by making a PR against openocd with the new config file? Would it be better to keep the config file for the one true original chip and document the possible modifications here? Perhaps this issue suffices to document this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.