Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 0x prefix onto defmt'd pointers. #734

Merged
merged 4 commits into from
Mar 10, 2023
Merged

Conversation

jonathanpallant
Copy link
Contributor

@jonathanpallant jonathanpallant commented Mar 8, 2023

#![no_main]
#![no_std]

use test_pointers as _;

static MY_VALUE: [u8; 64] = [0xCC; 64];

#[cortex_m_rt::entry]
fn main() -> ! {
    let p = MY_VALUE.as_ptr();
    defmt::println!("Hello, world!, p1 = {:?}", p);
    test_pointers::exit()
}
(HOST) INFO  flashing program (2 pages / 8.00 KiB)
(HOST) INFO  success!
────────────────────────────────────────────────────────────────────────────────
Hello, world!, p1 = 0x15a2
└─ hello::__cortex_m_rt_main @ src/bin/hello.rs:12
────────────────────────────────────────────────────────────────────────────────
stack backtrace:
   0: lib::inline::__bkpt
        at ./asm/inline.rs:14:5
   1: __bkpt
        at ./asm/lib.rs:51:17
   2: test_pointers::exit
        at src/lib.rs:20:5
   3: hello::__cortex_m_rt_main
        at src/bin/hello.rs:14:5
   4: main
        at src/bin/hello.rs:8:1
   5: Reset
(HOST) WARN  call stack was corrupted; unwinding could not be completed
(HOST) INFO  device halted without error

Fixes #603

@Urhengulas
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 10, 2023

Build succeeded:

@bors bors bot merged commit 1a5e8fb into main Mar 10, 2023
@bors bors bot deleted the fix-603-raw-pointer-formatting branch March 10, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

defmt::Format implementation for raw pointers diverges from core::Debug implementation
2 participants