rtic-rs / rtic

Real-Time Interrupt-driven Concurrency (RTIC) framework for ARM Cortex-M microcontrollers

Home Page:https://rtic.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Error with STM32L0

sreyhani opened this issue · comments

I was trying to use the Async/await feature that is in the alpha version of Rtic in my project which is using STM32L051C8 but I could not build it. build fails with the following error:

error: linking with `rust-lld` failed: exit status: 1

I have created a repository so you can test it yourself. codes are based on blinky examples, using stm32l0xx_hal
the v1 version uses task spawn with delay and is dependent on rtic 1.1.4 and builds and runs on board completely fine.
the v2 version uses async task and await. and it fails with the said error. its dependent on rtic 2.0.0-alpha.2

here is my repository rtic-blink.

rtic version: 2.0.0-alpha.2

active toolchain:

----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.66.1 (90743e729 2023-01-10)

full error:

Compiling stm32l0-blinky v0.1.0 (/path-to-repo/stm32l0_blinky_async)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/bin:/home/user/.cargo/bin:/home/user/.local/bin:/usr/share/safe-rm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/Downloads/clion-2021.2.3/bin" VSLANG="1033" "rust-lld" "-flavor" "gnu" "/tmp/rustc9DYXkt/symbols.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.14zvigrz8abjyix8.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.1wkvt6rvozk4ri1h.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.29frt9dfo6296fn6.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.2ivatp38tbbbmec4.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.3dqr67jyjjcxelco.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.4l3fnf02mos44w73.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.50v6ig3e6gndg10d.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.51e5wraafzg2634h.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.58p3vcwptajn9kra.rcgu.o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.i1c0fcc8glovnev.rcgu.o" "--as-needed" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps" "-L" "/path-to-repo/stm32l0_blinky_async/target/debug/deps" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/build/cortex-m-f8aa977e2cdcc05f/out" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/build/stm32l0xx-hal-65d6f4f1235a806b/out" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/build/stm32l0xx-hal-65d6f4f1235a806b/out" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/build/cortex-m-rt-6f2d9968716ecff9/out" "-L" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/build/stm32l0-d5a13c7dfecbb03f/out" "-L" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv6m-none-eabi/lib" "-Bstatic" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libstm32l0xx_hal-8c8e6dd4178f5846.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtcc-c397ebb7928b16af.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libchrono-5d9061e2006bd1a7.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libembedded_time-25496a29aa99c7d6.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum-72bdff236368c2db.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum_iter-e0f4031f2e6b5106.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum_rational-1f1ee405f151dd88.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum_integer-47265f43f7a08303.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum_complex-da30f47be341f9ad.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnum_traits-1439aa72f13376de.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcast-9a6b72b5cf90c115.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libas_slice-70210f9d28d90e7e.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libstable_deref_trait-bfcc2e305d851ba2.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libstm32l0-7495974c05ebdcc7.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcortex_m_rt-0fcc90309fb11437.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libr0-b519d820398325a6.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtic_monotonics-228e1569d3189d04.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcfg_if-fe12da60b70b8f1a.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libfugit-2df8fd589e37c44d.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libgcd-31abf31a4c5bbe6e.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtic_time-bc2fecff77e3b5b7.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtic_common-f2f4476c3ee76b8d.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libfutures_util-ca3b7c8837a5be64.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libpin_project_lite-b76961e605da802d.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libfutures_task-0d84c6f3c1c5a311.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libpin_utils-b7b67d1281d3b19d.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libfutures_core-af90076ae7ad435e.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtic-b885a9b796b78d81.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libatomic_polyfill-627a7120268f457b.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcritical_section-595dcc42a5424df7.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libbare_metal-542d815b2bf06cf0.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtic_core-b9a5a7e130c9f185.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libpanic_rtt_target-cbab39d8470698c9.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librtt_target-f75133ce94b855c3.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcortex_m-234584f7d3c1391c.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libembedded_hal-9ba7dfa74af71074.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libvoid-f7d945eef198f357.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnb-d1c36bf5f9312488.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libnb-b7c29d10fef21295.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libvolatile_register-e7237362da0c3d6f.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libvcell-d514017aa22a5dab.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libbare_metal-2bc55d7d88d768e6.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libufmt_write-4ff4b07fb61b3b4a.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/librustc_std_workspace_core-a659648fa9bc94b6.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcore-7b68c749b9405aa6.rlib" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/libcompiler_builtins-3231ecb47df42227.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/thumbv6m-none-eabi/lib" "-o" "/path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917" "--gc-sections" "--nmagic" "-Tlink.x"
  = note: rust-lld: warning: section type mismatch for .uninit.rtic0
          >>> /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(.uninit.rtic0): SHT_PROGBITS
          >>> output section .uninit: SHT_NOBITS
          
          rust-lld: warning: section type mismatch for .uninit.rtic1
          >>> /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(.uninit.rtic1): SHT_PROGBITS
          >>> output section .uninit: SHT_NOBITS
          
          rust-lld: warning: section type mismatch for .got
          >>> <internal>:(.got): SHT_PROGBITS
          >>> output section .got: SHT_NOBITS
          
          rust-lld: warning: section type mismatch for .got.plt
          >>> <internal>:(.got.plt): SHT_PROGBITS
          >>> output section .got: SHT_NOBITS
          
          rust-lld: warning: section type mismatch for .got
          >>> <internal>:(.got): SHT_PROGBITS
          >>> output section .got: SHT_NOBITS
          
          rust-lld: error: undefined symbol: _critical_section_1_0_acquire
          >>> referenced by lib.rs:180 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:180)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(stm32l0_blinky::app::__rtic_internal_async_0_prio_dispatcher::h80555bfe3c523a0a)
          >>> referenced by lib.rs:180 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:180)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(stm32l0_blinky::app::__rtic_internal_async_0_prio_dispatcher::h80555bfe3c523a0a)
          >>> referenced by lib.rs:180 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:180)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.50v6ig3e6gndg10d.rcgu.o:(rtic_time::TimerQueue$LT$Mono$GT$::on_monotonic_interrupt::hf9d404e4dae8cc40)
          >>> referenced 6 more times
          
          rust-lld: error: undefined symbol: _critical_section_1_0_release
          >>> referenced by lib.rs:197 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:197)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(stm32l0_blinky::app::__rtic_internal_async_0_prio_dispatcher::h80555bfe3c523a0a)
          >>> referenced by lib.rs:197 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:197)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.48fts0b8qo4akymn.rcgu.o:(stm32l0_blinky::app::__rtic_internal_async_0_prio_dispatcher::h80555bfe3c523a0a)
          >>> referenced by lib.rs:197 (/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/critical-section-1.1.1/src/lib.rs:197)
          >>>               /path-to-repo/stm32l0_blinky_async/target/thumbv6m-none-eabi/debug/deps/stm32l0_blinky-24b555a20a984917.50v6ig3e6gndg10d.rcgu.o:(rtic_time::TimerQueue$LT$Mono$GT$::on_monotonic_interrupt::hf9d404e4dae8cc40)
          >>> referenced 7 more times
          

error: could not compile `stm32l0-blinky` (bin "stm32l0-blinky") due to previous error

You need to enable a critical-section implementation.

See here and here