Skip to content

Rename SPI-NOR flash functions after datasheet commands and opcodes - #61

Open
AlexLanzano wants to merge 1 commit into
wolfSSL:mainfrom
AlexLanzano:spi-nor-rename
Open

AlexLanzano wants to merge 1 commit into
wolfSSL:mainfrom
AlexLanzano:spi-nor-rename

Conversation

@AlexLanzano

Copy link
Copy Markdown
Member

Summary

Renames the SPI-NOR flash driver API so a board's vtable can be built by matching the part's datasheet command table. Functions follow whal_SpiNor_Flash_[Mode_]Command_XXh, where Command is the datasheet command name and XXh is the opcode sent on the bus.

Changes

  • Mode segments Addr4 (dedicated 4-byte opcodes), Addr4Mode (after B7h) and ExtAddr (extended address register, C5h) replace the 3b/4b/4bMode/4bExReg tags; 3-byte functions have no mode segment
  • Driver identity gains the Flash segment: whal_SpiNor_Flash_Cfg/_Dev/_Driver, WHAL_CFG_SPI_NOR_FLASH_SINGLE_INSTANCE/_DEV, guard WHAL_SPI_NOR_FLASH_H
  • Header overview rewritten for the new scheme; unused CMD_WRITE_DISABLE and CMD_READ_EAR removed
  • W25Q64 board and adding_a_peripheral.md updated
Old New
whal_SpiNor3b_ReadFast whal_SpiNor_Flash_FastRead_0Bh
whal_SpiNor4b_Erase64k whal_SpiNor_Flash_Addr4_BlockErase64k_DCh
whal_SpiNor4bMode_Write whal_SpiNor_Flash_Addr4Mode_PageProgram_02h
whal_SpiNor4bExReg_Read whal_SpiNor_Flash_ExtAddr_ReadData_03h
whal_SpiNor_EraseChip whal_SpiNor_Flash_ChipErase_C7h
whal_SpiNor4bMode_Init whal_SpiNor_Flash_Addr4Mode_Init

Testing

  • make BOARD=stm32wb55xx_nucleo PERIPHERALS=spi_nor_w25q64 TESTS=flash builds cleanly with -Werror

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 29, 2026 13:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the SPI-NOR API renaming.

No open issues 🎉

What changed in this PR

Renames wolfHAL’s SPI-NOR flash API to expose datasheet command names and opcodes, making it easier to select functions for a device’s flash vtable. Flash operation logic remains unchanged.

Changes:

  • Renames command functions and addressing-mode prefixes across declarations and definitions.
  • Adds Flash to driver types, symbols, configuration macros, and the header guard; removes two unused command constants.
  • Updates the W25Q64 peripheral configuration and documentation example to use the renamed API.
File Description
wolfHAL/​flash/​spi_nor_flash.h Renames public declarations and documents the command-based naming scheme.
src/​flash/​spi_nor_flash.c Updates definitions, singleton macros, and the default vtable; removes unused constants.
docs/​adding_a_peripheral.md Updates the example’s driver and configuration type names.
boards/​peripheral/​flash/​spi_nor_w25q64.c Migrates the W25Q64 configuration to the renamed API.

Review effort: Balanced

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