Skip to content

Can not use stm32f3xx-hal, fails in flip-link. #376

@StephenVanWijk

Description

@StephenVanWijk

The moment I comment out in Cargo.toml the stm32f3xx-hal reference, it builds without errors, without warnings.
But including the crate stm32f3xx-hal give a lot of complaints from flip-link.
I have checked my Rust embedded VCS setup, and will continue to do so, so far, everythings seems to function okay.
To check extra, I going to program STM32F303 via STMcubeProgrammer. I don't expect that the board is the problem, but just to make sure.
I thought, well, I try it via the crate stm32f3, then I can reach the registers directly. But that crate gives similar results.

  • **Chip: stm32f303xc
  • Rust version: 1.88.0
  • flip-link version: 0.1.10
  • Error log:

C:\Users\Hp\my-app> cargo build
Compiling my-app v0.1.0 (C:\Users\Hp\my-app)
error: linking with flip-link failed: exit code: 1
|
= note: "flip-link" "-flavor" "gnu" "C:\Users\Hp\AppData\Local\Temp\rustc4jgtsF\symbols.o" "<1 object files omitted>" "--as-needed" "-Bstatic" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\deps/{libmy_app-7b30e5d1683f6a2a.rlib,libcortex_m_rt-949b5e38549dc197.rlib,libpanic_probe-49bc590eb1675fa4.rlib,libdefmt_rtt-8e1089b92995c97a.rlib,libdefmt-2dc16b1298925ebe.rlib,libbitflags-796083134b4a6f2f.rlib,libcortex_m_semihosting-6fbacfcc1bdbde63.rlib,libcortex_m-f813bff1541b26fc.rlib,libembedded_hal-7f2be796758a608d.rlib,libvoid-c059cae99a3c68e8.rlib,libnb-66422ac96959af13.rlib,libnb-6cf6cd2c1ded76be.rlib,libcritical_section-819d272aff5a8a3f.rlib,libvolatile_register-d360eaea9d77fb70.rlib,libvcell-8bc19d3bace03a30.rlib,libbare_metal-233822720e5bc188.rlib}.rlib" "\lib\rustlib\thumbv7em-none-eabihf\lib/{librustc_std_workspace_core-,libcore-,libcompiler_builtins-*}.rlib" "-L" "C:\Users\Hp\AppData\Local\Temp\rustc4jgtsF\raw-dylibs" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\my-app-3e8824360845326e\out" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\cortex-m-81203f232298d1ae\out" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\cortex-m-rt-ba468a14a02025c6\out" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\defmt-ee695bc570874009\out" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\stm32f3xx-hal-3913ee8f201de197\out" "-L" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\build\stm32f3-41278f1dc6bc6d89\out" "-o" "C:\Users\Hp\my-app\target\thumbv7em-none-eabihf\debug\deps\overflow-b9032416ab3221c8" "--gc-sections" "-Tlink.x" "-Tdefmt.x" "--nmagic"
= note: some arguments are omitted. use --verbose to show all linker arguments
= note: rust-lld: error: ␍
ERROR(cortex-m-rt): The interrupt vectors are missing.␍
Possible solutions, from most likely to less likely:␍
- Link to a svd2rust generated device crate␍
- Check that you actually use the device/hal/bsp crate in your code␍
- Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency␍
may be enabling it)␍
- Supply the interrupt handlers yourself. Check the documentation for details.␍

rust-lld: error: ␍
ERROR(cortex-m-rt): The interrupt vectors are missing.␍
Possible solutions, from most likely to less likely:␍
- Link to a svd2rust generated device crate␍
- Check that you actually use the device/hal/bsp crate in your code␍
- Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency␍
may be enabling it)␍
- Supply the interrupt handlers yourself. Check the documentation for details.␍

rust-lld: error: ␍
ERROR(cortex-m-rt): The interrupt vectors are missing.␍
Possible solutions, from most likely to less likely:␍
- Link to a svd2rust generated device crate␍
- Check that you actually use the device/hal/bsp crate in your code␍
- Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency␍
may be enabling it)␍
- Supply the interrupt handlers yourself. Check the documentation for details.␍

There is more, for a full build of the my-app project, but I guess you get the picture...

  • Minimal example:

Cargo.toml:

[package]
authors = ["StephenVanWijk [email protected]"]
name = "my-app"
build = "build.rs"

edition = "2024"
version = "0.1.0"

[[bin]]
name = "bitfield"
path = "src/bin/bitfield.rs"
test = false

[[bin]]
name = "format"
path = "src/bin/format.rs"
test = false

[[bin]]
name = "hello"
path = "src/bin/hello.rs"
test = false

[[bin]]
name = "levels"
path = "src/bin/levels.rs"
test = false

[[bin]]
name = "overflow"
path = "src/bin/overflow.rs"
test = false

[[bin]]
name = "panic"
path = "src/bin/panic.rs"
test = false

[lib]
harness = false

[[test]]
name = "integration"
harness = false

[dependencies]
stm32f3xx-hal = { version = "0.10.0", features = ["ld", "rt", "stm32f303xc"] }
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.1"
defmt = "1.0"
defmt-rtt = "1.0"
panic-probe = { version = "1.0", features = ["print-defmt"] }
panic-halt = "1.0.0"
cortex-m-semihosting = "0.5.0"

[dev-dependencies]
defmt-test = "0.4"

[profile.dev]
codegen-units = 1
debug = 2
debug-assertions = true # <-
incremental = false
opt-level = 'z' # <-
overflow-checks = true # <-

[profile.test]
codegen-units = 1
debug = 2
debug-assertions = true # <-
incremental = false
opt-level = 3 # <-
overflow-checks = true # <-

[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-

[profile.bench]
codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-

Source code:
src/lib/hello.rs

#![no_main]
#![no_std]

use my_app as _; // global logger + panicking-behavior + memory layout

#[cortex_m_rt::entry]
fn main() -> ! {
defmt::println!("Hello, world!");

my_app::exit()

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions