Skip to content

Add support for pinning XIP SRAM#298

Draft
will-v-pi wants to merge 5 commits intodevelopfrom
xip-sram
Draft

Add support for pinning XIP SRAM#298
will-v-pi wants to merge 5 commits intodevelopfrom
xip-sram

Conversation

@will-v-pi
Copy link
Contributor

Adds support for pinning XIP SRAM in a load map, and allows use of XIP SRAM in flash binaries

Also add --pin-xip-sram arg, add --clear arg to encrypt (rather than always clearing), and use model for correct pinning and clearing
@lurch
Copy link
Contributor

lurch commented Mar 11, 2026

For people like me who have no idea what "pinning XIP SRAM" is about, maybe it's worth adding a comment pointing to 5.9.3.2.1. in the RP2350 datasheet? 😉

@lurch
Copy link
Contributor

lurch commented Mar 11, 2026

"If, however, you have a non-flash binary with code or data in the XIP RAM address space, then you need to add a special
LOAD_MAP entry to indicate to the bootrom that the XIP contents should be pinned."
Does that imply that you could infer from the binary itself whether the XIP RAM needs to be pinned, rather than requiring an additional CLI flag?

@will-v-pi
Copy link
Contributor Author

"If, however, you have a non-flash binary with code or data in the XIP RAM address space, then you need to add a special LOAD_MAP entry to indicate to the bootrom that the XIP contents should be pinned." Does that imply that you could infer from the binary itself whether the XIP RAM needs to be pinned, rather than requiring an additional CLI flag?

Not necessarilly, because you could choose to pin manually only the region you want before loading your code/data into XIP SRAM, rather than having the bootrom pin the whole thing, in order to minimise the flash performance loss that comes from pinning XIP SRAM.

@lurch
Copy link
Contributor

lurch commented Mar 11, 2026

you could choose to pin manually only the region you want before loading your code/data into XIP SRAM, rather than having the bootrom pin the whole thing, in order to minimise the flash performance loss that comes from pinning XIP SRAM.

Okay. So is the --pin-xip-sram flag being added here doing the "Pin all of XIP SRAM on load" behaviour?

@will-v-pi
Copy link
Contributor Author

For people like me who have no idea what "pinning XIP SRAM" is about, maybe it's worth adding a comment pointing to 5.9.3.2.1. in the RP2350 datasheet? 😉

That section of the datasheet is currently incorrect (I have a PR open to fix it), but more generally picotool doesn't currently refer to the datasheet and instead assumes prior knowledge of the bootrom functionality (eg signing and hashing, what a load map is, etc), as that stuff is documented elsewhere

@will-v-pi
Copy link
Contributor Author

you could choose to pin manually only the region you want before loading your code/data into XIP SRAM, rather than having the bootrom pin the whole thing, in order to minimise the flash performance loss that comes from pinning XIP SRAM.

Okay. So is the --pin-xip-sram flag being added here doing the "Pin all of XIP SRAM on load" behaviour?

Yes, it's adding a load map entry to ask the bootrom to do that

@lurch
Copy link
Contributor

lurch commented Mar 11, 2026

Hmmm, very weird that the "Test Build Examples" jobs have suddenly decided to start failing 😕 It's complaining about a missing file but I don't think that any of the relevant repos have changed recently?

@will-v-pi
Copy link
Contributor Author

BTStack has been bumped in the SDK but not yet in pico-examples, which is causing the failure

@lurch
Copy link
Contributor

lurch commented Mar 11, 2026

BTStack has been bumped in the SDK but not yet in pico-examples, which is causing the failure

Ahhhh! Thanks 😀

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.

2 participants