Skip to content

fix(esp8266): Use custom flash config due to different ROM implementation#75

Merged
Dzarda7 merged 1 commit intomasterfrom
fix/esp8266_flash_config
Mar 3, 2026
Merged

fix(esp8266): Use custom flash config due to different ROM implementation#75
Dzarda7 merged 1 commit intomasterfrom
fix/esp8266_flash_config

Conversation

@Dzarda7
Copy link
Collaborator

@Dzarda7 Dzarda7 commented Mar 3, 2026

ESP8266 contains g_rom_flashchip, but it is in different order than esp_rom_spiflash_chip_t, esp_rom_spiflash_config_param might take also different order of parameters but due to missing possibility to check in ROM code custom implementation seems like okay solution preventing possible future issues.

Description

Related

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

…tion

ESP8266 contains g_rom_flashchip, but it is in different order than
esp_rom_spiflash_chip_t, esp_rom_spiflash_config_param might take also
different order of parameters but due to missing possibility to check in
ROM code custom implementation seems like okay solution preventing
possible future issues.
@Dzarda7 Dzarda7 requested review from Copilot and erhankur March 3, 2026 12:00
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello Dzarda7, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 3eb4aa1

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts ESP8266 flash configuration handling to avoid relying on ROM structs/functions whose field/parameter ordering may not match esp_rom_spiflash_chip_t.

Changes:

  • Replaces the ESP8266 ROM g_rom_flashchip usage with a custom in-RAM esp_rom_spiflash_chip_t instance.
  • Adds an ESP8266-specific stub_target_flash_update_config() implementation that updates the custom struct.
  • Marks the common stub_target_flash_update_config() as weak so targets can override it.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/target/esp8266/src/flash.c Introduces a custom flashchip config struct and overrides config update/getter for ESP8266.
src/target/common/src/flash.c Makes the default stub_target_flash_update_config() weak to allow per-target overrides.

Copy link
Collaborator

@erhankur erhankur left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. Is this because I removed macros and forced client codes to get flash params from config?

@Dzarda7
Copy link
Collaborator Author

Dzarda7 commented Mar 3, 2026

Is this because I removed macros and forced client codes to get flash params from config?

Yes, I then had to use stub_lib_flash_get_config for some alignment on sector size which aligned it probably to block size (or some other field).

@Dzarda7
Copy link
Collaborator Author

Dzarda7 commented Mar 3, 2026

FYI @radimkarnis

@Dzarda7 Dzarda7 merged commit 4ed1b38 into master Mar 3, 2026
34 checks passed
@Dzarda7 Dzarda7 deleted the fix/esp8266_flash_config branch March 3, 2026 12:19
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