Skip to content

Conversation

soburi
Copy link
Member

@soburi soburi commented Feb 1, 2023

soc: arm: rpi_pico: Add support RaspberryPi Pico binary info feature

Binary Info embeds program meta information in flash,
which can be viewed with RaspberryPi Pico's picotool.

Metadata is automatically collected from pinctrl.

It can be override by the Kconfig configurations, such as

CONFIG_RPI_PICO_BINARY_INFO_OVERRIDE_PROGRAM_NAME="my program name"

When this feature is enabled, pinctrl groups are restricted to
consisting of pins with a single rpi_pico function.
In other words, SPI's MISO and MOSI can be in the same group,
but I2C's SDA cannot be included in this group.
This is rarely an issue in normal use,
and can be resolved by dividing them into separate groups.

@soburi soburi requested review from nashif and yonsch as code owners February 1, 2023 03:59
@soburi soburi force-pushed the pico_binary_info branch 3 times, most recently from 463304d to 93e30d2 Compare February 1, 2023 04:55
@soburi soburi changed the title soc: arm: rpi_pico: Add basic support for binary info feature soc: arm: rpi_pico: Add basic support for binary info feature Feb 1, 2023
@soburi soburi force-pushed the pico_binary_info branch 2 times, most recently from cdbad46 to 71495bb Compare February 1, 2023 09:26
@soburi soburi added the platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) label Feb 1, 2023
Copy link
Contributor

@mbolivar-nordic mbolivar-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work!

I am not sure about the CMake variable changes here. I'd like @tejlmand to confirm it is OK.

@yonsch
Copy link
Contributor

yonsch commented Feb 2, 2023

Before I comment on the changes themselves - I think this feature would be beneficial for all Zephyr users, not only for the pico. Being able to embed strings in a binary where they're accessable outside of the image is very useful. The main use case I can think of is a bootloader and an app being able to read each other's versions. Since this would require some more work I'm not sure it should block this PR for the meantime, but that is something to keep in mind.
I should also note that pico's binary_info can be used to store pin configurations, but I can't think of a use case for that.

@soburi soburi force-pushed the pico_binary_info branch 2 times, most recently from d0736a3 to 480ff02 Compare February 2, 2023 09:31
@soburi
Copy link
Member Author

soburi commented Feb 4, 2023

@yonsch

Before I comment on the changes themselves - I think this feature would be beneficial for all Zephyr users, not only for the pico. Being able to embed strings in a binary where they're accessable outside of the image is very useful. The main use case I can think of is a bootloader and an app being able to read each other's versions. Since this would require some more work I'm not sure it should block this PR for the meantime, but that is something to keep in mind. I should also note that pico's binary_info can be used to store pin configurations, but I can't think of a use case for that.

The 'self-reference'-ish feature is interresting suggestion.
But I also think there are some difficult point.
In the Pico's scope, the information mainly read it by BOOTSEL mode.
This is probably the same for other MCUs, and I think this function is strongly related to the "recovery mode" specification.
If there are other MCUs with similar functions, it may be possible to define an abstract interface.
If I can draw a big picture, I think it would wonderful if it could define as uf2 meta information. (Create a .uf2meta section with a linker and have the same information there. It can handle with common specification by recovery program and firmware itself!)

@yonsch
Copy link
Contributor

yonsch commented Feb 5, 2023

@soburi I've created a quick demonstration of what I was thinking of: #54464

@MaureenHelm
Copy link
Member

dev-review: depends on #54464

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions
Copy link

github-actions bot commented Aug 2, 2023

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Aug 2, 2023
@cfriedt
Copy link
Member

cfriedt commented Aug 3, 2023

@soburi - I assume that once #54464 is merged, work on this will continue

@soburi
Copy link
Member Author

soburi commented Aug 3, 2023

@cfriedt

I assume that once #54464 is merged, work on this will continue

That's right. Perhaps I will have to rethink the design accordingly.

@github-actions github-actions bot removed the Stale label Aug 4, 2023
@yonsch
Copy link
Contributor

yonsch commented Aug 4, 2023

@soburi Why does this depend on #54464?
Bindesc was supposed to be a standard Zephyr replacement for binary info.
Binary info would still be useful for someone who needs to specifically use the pico format, e.g. if a bootloader expects binary info descriptors.
I think we can treat them as if they are mutually exclusive, as they serve the same purpose, and proceed with this PR regardless of bindesc.
Unless, you somehow see them coexisting somehow, which would require more planning.

@github-actions github-actions bot added the Stale label May 3, 2025
@github-actions github-actions bot closed this May 17, 2025
@soburi soburi reopened this May 29, 2025
Copy link

@github-actions github-actions bot removed the Stale label May 30, 2025
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 31, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this potentially be handled by a linker script like rom_start?

@github-actions github-actions bot removed the Stale label Aug 1, 2025
Copy link

github-actions bot commented Oct 1, 2025

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Oct 1, 2025
@soburi soburi force-pushed the pico_binary_info branch 2 times, most recently from 768b887 to c20f3c8 Compare October 1, 2025 22:11
@github-actions github-actions bot removed the Stale label Oct 2, 2025
@soburi soburi force-pushed the pico_binary_info branch 11 times, most recently from 51c15c5 to 8f8d0cd Compare October 8, 2025 03:44
soburi added 3 commits October 8, 2025 12:49
The binary info feature references `boot_stage2` and `pico_binary_info`.
Add these to include dirs.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Use the definition of PICO_NO_BINARY_INFO if it already exists,
set it as 1 if not so.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Binary Info embeds program meta information in flash,
which can be viewed with RaspberryPi Pico's `picotool`.

Metadata is automatically collected from pinctrl.

It can be override by the Kconfig configurations, such as

```
CONFIG_RPI_PICO_BINARY_INFO_OVERRIDE_PROGRAM_NAME="my program name"
```

When this feature is enabled, pinctrl groups are restricted to
consisting of pins with a single rpi_pico function.
In other words, SPI's MISO and MOSI can be in the same group,
but I2C's SDA cannot be included in this group.
This is rarely an issue in normal use,
and can be resolved by dividing them into separate groups.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Copy link

sonarqubecloud bot commented Oct 8, 2025

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants