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

rp-binary-info is not compatible with picotool for rp2350 #853

Closed
romainreignier opened this issue Sep 25, 2024 · 5 comments · Fixed by #854
Closed

rp-binary-info is not compatible with picotool for rp2350 #853

romainreignier opened this issue Sep 25, 2024 · 5 comments · Fixed by #854
Assignees

Comments

@romainreignier
Copy link

With the latest version (2.0.0) of picotool, picotool info works with rp2040 binaries but not with rp2350.

$ picotool version
picotool v2.0.0 (Linux, GNU-11.4.0, Release)

Steps to reproduce

$ git clone https://github.com/rp-rs/rp-hal.git
$ cd rp2040-hal-examples
$ cargo build --bin binary_info_demo
$ picotool info -a -t elf target/thumbv6m-none-eabi/debug/binary_info_demo
File target/thumbv6m-none-eabi/debug/binary_info_demo:

Program Information
 name:          rp2040-hal Binary Info Example
 version:       0.1.0
 web site:      https://github.com/rp-rs/rp-hal
 description:   A GPIO blinky with extra metadata.
 binary start:  0x10000000

Fixed Pin Information
 none

Build Information
 pico_board:        pico
 build attributes:  debug

So it works with RP2040.

But doing the same RP2350 provides no info:

$ cd rp235x-hal-examples
$ cargo build --bin binary_info_demo
$ picotool info -a -t elf target/thumbv8m.main-none-eabihf/debug/binary_info_demo
File target/thumbv8m.main-none-eabihf/debug/binary_info_demo:

Program Information
 none

Fixed Pin Information
 none

Build Information
 none
@jonathanpallant jonathanpallant self-assigned this Sep 25, 2024
@jonathanpallant
Copy link
Contributor

That .... is unexpected (I wrote the support and the demos). I'll look into it.

@jonathanpallant
Copy link
Contributor

Can you attach your two elf files, or can you run llvm-objdump -t | rustfilt | sort on them?

@romainreignier
Copy link
Author

Sure.

Objdump results:
rp2040.txt
rp2350.txt

Elf files with a .txt extension to allow upload on Github:
rp2040_binary_info_demo_bin.txt
rp2350_binary_info_demo_bin.txt

@jonathanpallant
Copy link
Contributor

RP2020:

100001c0 g     O .boot_info	00000014 rp_binary_info::PICOTOOL_HEADER
100085a4 l     O .bi_entries	0000001c binary_info_demo::PICOTOOL_ENTRIES
100089b8 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
100089cc l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
100089fc l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10008a48 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10008a5c l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10008a70 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10008a7c l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
100094c8 g     O .rodata	00000018 rp_binary_info::MAPPING_TABLE

RP2350:

10008ba4 l     O .bi_entries	0000001c binary_info_demo::PICOTOOL_ENTRIES
10009084 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10009098 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
100090c8 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10009114 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10009128 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
1000913c l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY
10009148 l     O .rodata	0000000c binary_info_demo::PICOTOOL_ENTRIES::ENTRY

Oops.

The .boot_info input section is missing from the RP2350 example linker script. It should be packed into the .start_block output section.

@romainreignier
Copy link
Author

Indeed, it now works as expected:

$ cargo build --bin binary_info_demo
$ picotool info -a -t elf target/thumbv8m.main-none-eabihf/debug/binary_info_demo
File target/thumbv8m.main-none-eabihf/debug/binary_info_demo:

Program Information
 name:          binary_info_demo
 version:       0.1.0
 web site:      https://github.com/rp-rs/rp-hal
 description:   A GPIO blinky with extra metadata.
 binary start:  0x10000000
 target chip:   RP2350
 image type:    ARM Secure

Fixed Pin Information
 none

Build Information
 pico_board:        pico2
 build attributes:  debug

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 a pull request may close this issue.

2 participants