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

Create safe wrappers for some ROM functions in the rom module #1290

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

jessebraham
Copy link
Member

The idea here is basically to provide consistent APIs (as consistent as possible, as least) for our ROM functions, contained within the rom module. Rather than having a bunch of externs and unsafe blocks throughout our drivers, we can simply define safe wrappers within this module.

There are still some lingering extern "C" {} blocks in the code base, but they're generally pretty specific to a peripheral and chip, so I've left them for now.

(Some unrelated cleanup got mixed in here, sorry for the noise)

@jessebraham jessebraham added the skip-changelog No changelog modification needed label Mar 14, 2024
Copy link
Contributor

@JurajSadel JurajSadel left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Whilst you're touching these pieces, could you fix the transmute in esp32s3's CPU control?

We transmute an address to call ets_set_appcpu_boot_addr - we should just put this in the rom-functions.x linker script instead.

Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

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

LGTM! Much cleaner this way. I left 2 suggestion that can totally be ignored.

@jessebraham
Copy link
Member Author

@SergioGasquez thanks, but there is so much cleanup that needs to be done in some of these modules I'm not going to worry about that stuff right now 😁

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Thanks!

@jessebraham jessebraham added this pull request to the merge queue Mar 14, 2024
Merged via the queue into esp-rs:main with commit b402692 Mar 14, 2024
18 checks passed
@jessebraham jessebraham deleted the experiment/rom-api branch March 14, 2024 16:46
yanshay pushed a commit to yanshay/esp-hal that referenced this pull request Mar 16, 2024
…rs#1290)

* Create safe wrappers for some ROM functions in the `rom` module

* Replace transmute in ESP32-S3's `cpu_control` module with ROM function

* Inline *all* the things!

* Remove duplicate of `rom::regi2c_write` with ROM function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants