Comments (7)
Sorry for the trouble and the delay. #86 has updated the whole book to work with the latest version of the cortex-m crates as well as with recent nightlies.
from discovery.
Which nightly should we install so that it still works?
from discovery.
I've been using nightly-2018-05-20, but I'd guess most nightlies that are around the latest code commits in this repo would work.
from discovery.
2018-06-01 works too. rustup default nightly-2018-06-01
from discovery.
How do we fix this? part of the problem is that the cargo.toml specifies an older version of cortex-m-rt, which you can fix naively by going to the source and adding #![feature(panic_implementation)], but looking at more recent versions of cortex-m-rt it looks totally different.
from discovery.
Rolling back versions is a short term solution which I would rather not do. Seeing as new versions of cortex-m-rt have removed the abort-on-panic feature, I thought I would try removing it, adding the panic-abort crate, and bumping all the versions (all in 05/auxiliary/Cargo.toml). It still doesn't build though, so not sure how to fix it:
error: language item required, but not found: `panic_impl`
[package]
authors = ["Jorge Aparicio <[email protected]>"]
name = "aux5"
version = "0.2.0"
[dependencies]
cortex-m = "~0.5.2"
cortex-m-rt = "~0.5.1"
panic-abort = "~0.2"
[dependencies.f3]
features = ["rt"]
version = "~0.6.1"
from discovery.
This just bit me on chapter 16 as well.
I was able to get it to compile by adapting the panic implementation (see diff)
diff --git a/src/16-punch-o-meter/auxiliary/src/lib.rs b/src/16-punch-o-meter/auxiliary/src/lib.rs
index 5484cd7..e268ec8 100644
--- a/src/16-punch-o-meter/auxiliary/src/lib.rs
+++ b/src/16-punch-o-meter/auxiliary/src/lib.rs
@@ -2,6 +2,7 @@
#![feature(lang_items)]
#![feature(use_extern_macros)]
+#![feature(panic_implementation)]
#![no_std]
extern crate cortex_m;
@@ -49,20 +50,17 @@ pub fn init() -> (Lsm303dlhc, Delay, MonoTimer, ITM) {
(lsm303dlhc, delay, mono_timer, cp.ITM)
}
-#[lang = "panic_fmt"]
-unsafe extern "C" fn panic_fmt(
- args: ::core::fmt::Arguments,
- file: &'static str,
- line: u32,
- col: u32,
-) -> ! {
- let itm = &mut *ITM::ptr();
-
- itm::write_str(&mut itm.stim[0], "PANIC at '");
- itm::write_fmt(&mut itm.stim[0], args);
- iprintln!(&mut itm.stim[0], "', {}:{}:{}", file, line, col);
-
+use core::panic::PanicInfo;
+#[panic_implementation]
+fn panic(_info: &PanicInfo) -> ! {
+ unsafe {
+ let itm = &mut *ITM::ptr();
+
+ let location = _info.location().unwrap();
+ itm::write_str(&mut itm.stim[0], "PANIC at '");
+ itm::write_str(&mut itm.stim[0], _info.payload().downcast_ref::<&str>().unwrap());
+ iprintln!(&mut itm.stim[0], "', {}:{}:{}", location.file(), location.line(), location.column());
+ }
cortex_m::asm::bkpt();
-
loop {}
}
@japaric If this changes are good, I can also prepare a PR adding this changes to all aux libraries in this repo.
from discovery.
Related Issues (20)
- Chapter 7.1: Error failed attaching to target HOT 3
- This guide probably only works for Linux HOT 6
- error: linking with `rust-lld` failed: exit code: 0xc0000374
- Why can't I use gdb even though I set up the environment according to the build manual? Please help me. HOT 1
- Unit testing? HOT 1
- 5.3 'Debug It' gdb could not load XML target description HOT 1
- problem at 05-led-roulette, gdb debugging on windows10, incompatible version? HOT 1
- OpenOCD configuration for F3Discovery changed in v0.12
- Simple Chinese Tranlation HOT 4
- hidapi error: Failed to open a device with path '/dev/hidraw4': Permission denied HOT 1
- 3,4 Can't Verify Install - Failed Attaching To Target
- Additional content - snake game HOT 1
- [Chapter 5.3] compiled code seems to be optimized HOT 1
- error: Package `led-roulette v0.2.0 does not have the feature `v2` HOT 3
- Failed to parse inteface number in hardware IDs. HOT 2
- Definition of `meta` key not clear in Minicom
- [Chapter 5.3] Continue hangs, stuck at "0x00000000 in __vector_table ()"
- Extract STM32 discovery book to separate repo and archive HOT 1
- Extract and archive support for microbit:v1 HOT 2
- Micro:bit V2 Project Template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discovery.