Skip to content

Conversation

VynDragon
Copy link
Contributor

@VynDragon VynDragon commented Sep 28, 2025

Introduce flash driver for 1 bank of flash (all of them on bl60x and bl70x, half of them on bl61x)

Caveat: no bank2 support (feature of bl61x)
Not sure how to handle the flash naming and devices as they are either separate die flash or external flash but need the controller to work (and so be soc-nv-flash).

@VynDragon VynDragon requested a review from josuah September 28, 2025 15:33
Copy link

github-actions bot commented Sep 28, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_bouffalolab zephyrproject-rtos/hal_bouffalolab@9f2ab1b (main) zephyrproject-rtos/hal_bouffalolab#5 zephyrproject-rtos/hal_bouffalolab#5/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_bouffalolab DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Sep 28, 2025
@VynDragon VynDragon added area: Flash platform: Bouffalo Lab and removed manifest manifest-hal_bouffalolab DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Sep 28, 2025
@github-actions github-actions bot added manifest manifest-hal_bouffalolab DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Sep 28, 2025
@VynDragon VynDragon force-pushed the bflb_flash_work branch 3 times, most recently from 5db0053 to 2a4c5d9 Compare October 10, 2025 18:46
@VynDragon VynDragon marked this pull request as ready for review October 10, 2025 18:50
@zephyrbot zephyrbot added area: Boards/SoCs area: RISCV RISCV Architecture (32-bit & 64-bit) labels Oct 10, 2025
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

It looks like a half-hardware (automatic read/write flash commands) half-software (manual config flash commands) peripheral. First time I see this (I've obviously not seen a lot).

@VynDragon
Copy link
Contributor Author

It looks like a half-hardware (automatic read/write flash commands) half-software (manual config flash commands) peripheral.

I think it's pretty common? RP2 memory peripheral has the same kind of things for both flash and PSRAM. It allows using any kind of flash and other more exotic (mram, psram, etc) stuffs

@VynDragon
Copy link
Contributor Author

I think I got all of the review comments? Might try another push with clang-format

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

Here is another round of review, I hope I caught everything this time.

I've been marking the existing checks and a few more. May you fold the comments that do not need a fix.

@VynDragon VynDragon force-pushed the bflb_flash_work branch 3 times, most recently from 94cb5ab to ec017e6 Compare October 11, 2025 21:44
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

I noticed I was not sure when function call errors should be ignored (some valid use-cases for that, i.e. do not break XIP for a temporary error) or not. So I marked them for you to tell, if that's ok.

I realize ESP-IDF has macros to automate if (ret) { return ret; }.

I think that's all though. It's a pretty large driver. A lot of code needed.

@VynDragon
Copy link
Contributor Author

anyway fun fact time, it's the 7th biggest driver in the folder... And there is still a bunch of features to add 😭

josuah
josuah previously approved these changes Oct 12, 2025
Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

I did not catch anything on this last round.
Thanks for all the effort!
Looking at other flash drivers, they are also very software-defined + it's HAL-free, so that's where the actual code is.
One more flash driver for Zephyr...

will be deleted

Signed-off-by: Camille BAUD <[email protected]>
Introduce Bouffalolab Flash Controller with support for bank 1

Signed-off-by: Camille BAUD <[email protected]>
Enable the Flash Controller

Signed-off-by: Camille BAUD <[email protected]>
Enable the flash controller. Relocation is required.

Signed-off-by: Camille BAUD <[email protected]>
josuah
josuah previously approved these changes Oct 12, 2025
Adds the flash to supported for testing

Signed-off-by: Camille BAUD <[email protected]>
@VynDragon
Copy link
Contributor Author

Added the flash test thing because it wasnt added.

Copy link

Copy link
Contributor

@josuah josuah left a comment

Choose a reason for hiding this comment

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

This confirms that the CI hotfix for flash worked, in a way.

@VynDragon
Copy link
Contributor Author

Not quite, this one never failed due the issue... because it had a flash driver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs area: Flash area: RISCV RISCV Architecture (32-bit & 64-bit) DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-hal_bouffalolab platform: Bouffalo Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants