Closed gustavowd closed 5 months ago
The first one i was able to sove using:
fn panic() -> ! {
core::panic!("panic via defmt::panic!
")
}
you're missing -Tdefmt.x
linker flag.
I suggest adding them via build.rs like the examples do, not via .cargo/config.toml.
Thanks @Dirbaio .
Just one more question. Why when inserting the build.rs file I no longer need to have a memory.x file? In fact, when maintaining the memory.x file I receive a message that the FLASH memory has already been declared elsewhere.
memory-x
feature in embassy-stm32
automatically provides a memory.x file. if you want to provide your own, you have to disble it.
I'm trying to start a embassy project for a STM32G4 microcontroller from scratch, but i'm facing an persistent error. When i try to compile with cargo build or cargo embed i'm getting the following error:
`a1af864f49" "--gc-sections" "-Tlink.x" = note: rust-lld: error: undefined symbol: _defmt_panic
error: aborting due to 1 previous error
[main.rs] `use defmt::*; use embassy_executor::Spawner; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_time::Timer; use {defmtrtt as , panicprobe as };
[embassy_executor::main]
async fn main(_spawner: Spawner) { let p = embassy_stm32::init(Default::default()); info!("Hello World!");
}`
[cargo.toml] `[package] name = "blinky" version = "0.1.0" edition = "2021"
[dependencies] cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] } cortex-m-rt = "0.7.3"
panic-probe = { version = "0.3.1", features = ["print-defmt"] } futures = { version = "0.3.17", default-features = false, features = ["async-await"] } heapless = { version = "0.8", default-features = false } static_cell = "2.0.0"
embassy-stm32 = {version = "0.1.0", features = [ "defmt", "time-driver-any", "stm32g474re", "memory-x", "unstable-pac", "exti"] } embassy-sync = {version = "0.5.0", features = ["defmt"]} embassy-executor = {version = "0.5.0", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"]} embassy-time = {version = "0.3.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"]} embassy-futures = "0.1.0" defmt = "0.3.6" defmt-rtt = "0.4"
[profile.release] debug = 2`
[config.toml] `[build] target = "thumbv7em-none-eabihf"
[target.thumbv7em-none-eabihf] rustflags = ["-C", "link-arg=-Tlink.x"]
[env] DEFMT_LOG = "trace"`
Any ideais? Thanks in advance