rust-embedded/cortex-m

hprintln! is not printing statements

Admsher opened this issue · 1 comments

I am trying to add aa debug statement in my code for MIMXRT1064 board and the code looks something like this:

`#![no_std]
#![no_main]

use panic_halt as _;
use cortex_m_rt::entry;
use cortex_m_semihosting::hprintln;
use NXP1064 as _;

#[entry]
fn main() -> ! {

loop {
    hprintln!("Hello"); // Print "Hello" via semihosting

}

}
`

The NXP1064 crate is a custom HAL crate i created using the svd for MIMXRT1064 , the binary is being generated and the tool i use for flash i MCUExpresso Secure Provisioning Tool which also flashes the code succesfully.

How are you connecting to the NXP to read the messages? You have to use software on the computer that has support for semiprinting, like gdb, which has to attach to the microcontroller after programming to see the messages.

If you can try probe-rs (https://probe.rs), it looks like it already supports programming the MIMXRT1064, and then you could use RTT instead, such as with defmt (https://crates.io/crates/defmt-rtt) or https://crates.io/crates/rtt-target. It's faster and often easier to use than semihosting.