Skip to content

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

Merged
bors[bot] merged 4 commits intomainfrom
fix-603-raw-pointer-formatting
Mar 10, 2023
Merged

Add 0x prefix onto defmt'd pointers.#734
bors[bot] merged 4 commits intomainfrom
fix-603-raw-pointer-formatting

Conversation

@jonathanpallant
Copy link
Copy Markdown
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

@jonathanpallant jonathanpallant force-pushed the fix-603-raw-pointer-formatting branch from 4b8c3e1 to 680208e Compare March 8, 2023 11:03
@jonathanpallant jonathanpallant force-pushed the fix-603-raw-pointer-formatting branch from 680208e to 378102f Compare March 8, 2023 11:04
@Urhengulas
Copy link
Copy Markdown
Member

bors r+

@bors
Copy link
Copy Markdown
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