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

fix rom_table_lookup #20

Merged
merged 2 commits into from
Feb 21, 2021
Merged

fix rom_table_lookup #20

merged 2 commits into from
Feb 21, 2021

Conversation

jannic
Copy link
Member

@jannic jannic commented Feb 15, 2021

It seems like the rom_table_lookup missed one level of
pointer dereferencing.

After comparing it to the working call to reset_usb_boot() in
https://github.com/jannic/rp-microcontroller-rs/blob/master/util/rp2040-panic-usb-boot/src/lib.rs,
I changed the code until it generated basically the same assembly.

With that change, I was able to successfully call rom_data::reset_to_usb_boot()

I still don't like the type RomTableLookupFn, which just returns
some generic T without any checks, and I think rom_table_lookup
should be unsafe. But as none of those are pub, it doesn't matter too
much. So I just made the changes necessary to make the code work.

It seems like the rom_table_lookup missed one level of
pointer dereferencing.

After comparing it to the working call to reset_usb_boot() in
https://github.com/jannic/rp-microcontroller-rs/blob/master/util/rp2040-panic-usb-boot/src/lib.rs,
I changed the code until it generated basically the same assembly.

With that change, I was able to successfully call rom_data::reset_to_usb_boot()

I still don't like the type RomTableLookupFn, which just returns
some generic T without any checks, and I think rom_table_lookup
should be unsafe. But as none of those are pub, it doesn't matter too
much. So I just made the changes necessary to make the code work.
Copy link
Member

@thejpster thejpster left a comment

Choose a reason for hiding this comment

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

LGTM

@thejpster
Copy link
Member

This looks like it will close #17

@thejpster thejpster merged commit b96339c into rp-rs:main Feb 21, 2021
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.

None yet

2 participants