Skip to content

rp2xxx fixes#959

Merged
mattnite merged 3 commits into
mainfrom
rp2xxx_fixes
Jun 20, 2026
Merged

rp2xxx fixes#959
mattnite merged 3 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.

@Grazfather Grazfather requested a review from tact1m4n3 June 13, 2026 00:19
@Grazfather Grazfather force-pushed the rp2xxx_fixes branch 2 times, most recently from e1f8156 to 54b806a Compare June 13, 2026 00:54

@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.

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.

Yes, that's exactly what I mean

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.

OK done.

},
.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 :)

@mattnite mattnite merged commit 95686d4 into main Jun 20, 2026
59 checks passed
@mattnite mattnite deleted the rp2xxx_fixes branch June 20, 2026 06:55
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