Rtt-target library error

I am trying to use the example code in probe-rs for cargo-embed but i am getting an error for the same with rtt-target while building

`#![no_main]
#![no_std]

use panic_halt as _;

use cortex_m_rt::entry;
use cortex_m_semihosting::{debug, hprintln};
use MXP1064 as _;
use rtt_target::{rprintln, rtt_init_print};

#[cortex_m_rt::entry]
fn main() -> ! {
rtt_init_print!();
loop {
rprintln!("Hello, world!");
}
}`

the error:

note: "rust-lld" "-flavor" "gnu" "C:\\Users\\Admin\\AppData\\Local\\Temp\\rustc5QhLU2\\symbols.o" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\NXP1064_example-5bf2a1cea24512b7.63qe0ril252w2jcgwc7p37nue.rcgu.o" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\NXP1064_example-5bf2a1cea24512b7.8ucm47ftccyidve0wflacttrq.rcgu.o" "--as-needed" "-L" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps" "-L" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\debug\\deps" "-L" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\build\\MXP1064-acc669ca12614796\\out" "-L" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\build\\cortex-m-b8941ad80b058d2d\\out" "-L" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\build\\cortex-m-rt-db43cbd0a3e7c7fb\\out" "-L" "C:\\Users\\Admin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib" "-Bstatic" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\librtt_target-e21d6af2c75e9c43.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libcritical_section-2b61549d4d2ad06e.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libufmt_write-974116cbc3e4a50a.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libMXP1064-8ebcf014032a42b3.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libcortex_m_semihosting-e6b46cb85be67ed8.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libcortex_m-7d330d24d24042eb.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libembedded_hal-61a5d9b50d823416.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libvoid-84de6e3089e01bbe.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libnb-8b8d42a7d160ee91.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libnb-44d9f4f0c83b2add.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libvolatile_register-4f4042ea0930e359.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libvcell-82387be74167f886.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libbare_metal-fe3ef568287118d0.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libcortex_m_rt-0e309290dbfb788a.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libr0-0629d99891300178.rlib" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\libpanic_halt-bb95a61588caf22d.rlib" "C:\\Users\\Admin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib\\librustc_std_workspace_core-c456381a8b8e35db.rlib" "C:\\Users\\Admin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib\\libcore-427ff03a8fcba738.rlib" "C:\\Users\\Admin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib\\libcompiler_builtins-44e380169a097313.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "C:\\Users\\Admin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\thumbv7em-none-eabihf\\lib" "-o" "D:\\Varad-Intern_contents\\NXP1064-example\\target\\thumbv7em-none-eabihf\\debug\\deps\\NXP1064_example-5bf2a1cea24512b7" "--gc-sections" "-Tlink.x"
  = note: rust-lld: error: undefined symbol: _critical_section_1_0_acquire
          >>> referenced by lib.rs:193 (C:\Users\Admin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\critical-section-1.1.3\src\lib.rs:193)
          >>>               rtt_target-e21d6af2c75e9c43.rtt_target.50077343e8b09909-cgu.0.rcgu.o:(critical_section::with::hc9df4037eb6d937e) in archive D:\Varad-Intern_contents\NXP1064-example\target\thumbv7em-none-eabihf\debug\deps\librtt_target-e21d6af2c75e9c43.rlib
          >>> referenced by lib.rs:193 (C:\Users\Admin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\critical-section-1.1.3\src\lib.rs:193)
          >>>               rtt_target-e21d6af2c75e9c43.rtt_target.50077343e8b09909-cgu.0.rcgu.o:(critical_section::with::he17ceb430c52311d) in archive D:\Varad-Intern_contents\NXP1064-example\target\thumbv7em-none-eabihf\debug\deps\librtt_target-e21d6af2c75e9c43.rlib

          rust-lld: error: undefined symbol: _critical_section_1_0_release
          >>> referenced by lib.rs:210 (C:\Users\Admin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\critical-section-1.1.3\src\lib.rs:210)
          >>>               rtt_target-e21d6af2c75e9c43.rtt_target.50077343e8b09909-cgu.0.rcgu.o:(core::ptr::drop_in_place$LT$critical_section..with..Guard$GT$::he16a6046f6fd8f07) in archive D:\Varad-Intern_contents\NXP1064-example\target\thumbv7em-none-eabihf\debug\deps\librtt_target-e21d6af2c75e9c43.rlib

you need to implement the critical section primitives. this is usually provided by the architectural support crate.

for example, for the rp2040 SoC, the rp2040-hal crate provides a multi-core safe critical section implementation, behind the critical-section-impl feature flag. however, for common single core cortex-m based chips, or if only a single core of the rp2040 is used, the implementation provided by the cortex-m crate for single-core Cortex-M microcontrollers via its critical-section-single-core feature is good for most uses.

I don't know what chip you are using, but since you are using cortex-m-rt, I think you just need to enable the critical-section-single-core feature of cortex-m. unless of course, your chip has multiple cores and your application is parallel , in which case you should check the hal crate, or maybe provide a custom implementation if needed. check the documentation of critical-section for details.

you can use the cargo add command to enable the required feature flag:

$ cargo add cortex-m --features critical-section-single-core

Apologies for not providing all the info ,Its a single core M7F chip (IMXRT1064) by NXP , I also have made the custom crate called MXP1064 using svd2rust for the board, I have also added the feature for critical-section-single-core in my Cargo.toml for my cortex-m and performed cargo clean to start afresh but this does not seem to solve the problem

that makes no sense to me. only reason I can think of is, maybe cortex-m wasn't linked at all?

try to force the linker to link against the cortex-m crate by declaring an extern crate, add this line to your code:

extern crate cortex_m;

if this is the cause, it is really an unusual scenario, for one thing, this is a minimal "hello world" example that didn't import cortex-m directly, and also you didn't use a hal crate, which has cortex-m as its dependency.

Sure ,I will look into this and update on this thread for the same, thanks for the help