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

rework bootloader's SPI flash access #321

Merged
merged 10 commits into from
May 30, 2022
Merged

rework bootloader's SPI flash access #321

merged 10 commits into from
May 30, 2022

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented May 20, 2022

Triggered by #319 (by @jpf91) this PR reworks some of the bootloader's SPI flash functionality and configuration options:

  • The flash "SPI flash presence detection" by reading the 1st byte of the flash's manufacturer ID is removed as this command is not supported by some flash chips (see Bootloader: Some SPI flash ICs don't support SPI_FLASH_CMD_READ_ID (0x9E) #319).
  • The new "SPI flash presence detection" mechanism checks if the WEL (write enable latch) of the flash status register can be set and cleared again.
    • the flash has to support command 0x04: write disable - which is a standard command
  • the address size of the SPI flash can now be configured by passing according flags during compilation
    • SPI_FLASH_ADDR_BYTES: number of address bytes (2,3,4) -> 2=16-bit, 3=24-bit, 4=32-bit, default = 3 / 24-bit

The SPI address size (as well as all other bootloader customization options) can be modified at compile time. Example (configuring 16-bit address width):

sw/bootloader$ make USER_FLAGS+=-D'SPI_FLASH_ADDR_BYTES=2' clean_all exe

📚 The bootloader's documentation is also updated accordingly by this PR.

* remove "presence detection" by reading manufacturer ID
* added new presence detection mechanism by checking if the WEL bit of the flash status register can be set and cleared again
* added new configuration option to select spi flash address width (2,3 or 4 bytes)
@stnolting stnolting added enhancement New feature or request SW software-related labels May 20, 2022
@stnolting stnolting self-assigned this May 20, 2022
@stnolting stnolting marked this pull request as ready for review May 21, 2022 14:10
@stnolting stnolting marked this pull request as draft May 28, 2022 12:46
@stnolting stnolting marked this pull request as ready for review May 30, 2022 11:29
@stnolting stnolting merged commit 396c69c into main May 30, 2022
@stnolting stnolting deleted the bootloader_spi_rework branch May 30, 2022 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SW software-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootloader: Some SPI flash ICs don't support SPI_FLASH_CMD_READ_ID (0x9E)
1 participant