Skip to content

rp2xxx fixes#959

Open
Grazfather wants to merge 2 commits into
mainfrom
rp2xxx_fixes
Open

rp2xxx fixes#959
Grazfather wants to merge 2 commits into
mainfrom
rp2xxx_fixes

Conversation

@Grazfather

@Grazfather Grazfather commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator
  1. Flash size was incorrect for pico 2 and some third-party RP2350 boards. Fix them.
  2. Fix link type in boot meta: It is an offset, not a pointer.
  3. Explicitly set the size of the Item types so that we don't accidentally break them.

@mattnite mattnite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These then I'll force myself to read about bootmeta before merging.

const arch = @import("compatibility.zig").arch;

pub const image_def_block = if (microzig.config.ram_image and arch == .arm) Block(extern struct {
pub const image_def_block = if (microzig.config.ram_image and arch == .arm) Block(packed struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please include the backing integer for the packed struct, that's required upstream

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean that all packed structs will require the size? I'd rather not put it here, since it's derived from the size of its fields, and I set it there. If we were to change this, we'd have to manually add up the sizes of all of fields.

},
.link = microzig.options.hal.bootmeta.next_block,
} else Block(extern struct {
} else Block(packed struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

Comment on lines +104 to +105
return packed struct(u128) {
header: packed struct(u32) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is the reason for replacing all externs with packed (just wondering)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

as I understand, packed structs are 'now' the correct way to bit pack. And by using them, we can say how large they are and catch in the compile if the size changes. I accidentally changed the size of a field and it bit me :)

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.

3 participants