Name
eCos Common Support for SPI Flash Memory Devices — Overview
Description
The CYGPKG_DEVS_FLASH_SPI_COMMON
package
provides an abstraction layer between the standard eCos I/O
Flash API package (CYGPKG_IO_FLASH
) and
hardware specific x
SPI controller
drivers. This allows for serial memory device support to be
shared across architectures and platforms, avoiding the need
for the H/W specific device drivers to duplicate manufacturer
or device specific information in each H/W
x
SPI driver implementation.
Note | |
---|---|
Many eCos targets will still use the older driver model where the architecture specific device driver will implement direct support for a specific subset of SPI memory devices. Only newer ports, and some ports that have been explicitly updated, will reference this common approach. The goal is to bring as much support as is relevant for SPI memory devices into this single package, to aid maintenance and porting, with a simpler H/W device driver implementation for the platform specific component. |
This common package presents as a Flash V2 device driver to the Flash I/O layer.
The package allows for
JEDEC Serial Flash Discoverable Parameters (SFDP)
device supplied parameter tables to be used to configure the
required device access. The package currently supports
JESD216D.01
and earlier devices. It will
work with devices that implement newer versions of the
standard, but will be limited to the backwards compatible
features .
Caution | |
---|---|
At the time of writing not all of the SFDP table declared configurations have been tested. |
The following table is not an exhaustive list of tested platforms/devices, but an example set:
Platform | Device | x SPI | Notes |
---|---|---|---|
mimxrt1050_evk | IS25WP064AJBLE | Quad | 64-Mbit |
samv71_xult | S25FL116K | Quad | 16-Mbit |
stm32h735_disco | MX25LM51245GXDI00 | Octal | 512-Mbit |
- | W25Q32JV | Quad | 32-Mbit |
- | W25Q512JV-DTR | Quad | 512-Mbit |
Configuration Options
The common SPI memory driver package will be loaded
automatically when configuring eCos for a target with suitable
hardware. However the driver will be inactive unless the
generic flash package CYGPKG_IO_FLASH
is
loaded. It may be necessary to add the generic
CYGPKG_IO_FLASH
package to the
configuration explicitly before the driver functionality
becomes available. There should never be any requirement to
load or unload the
CYGPKG_DEVS_FLASH_SPI_COMMON
driver
package.
The flash driver provides a small number of configuration options which application developers may use to control features provided by the package.
CYGFUN_DEVS_FLASH_SPI_COMMON_MEMMAPPED
If this option is enabled then the flash device is configured for memory mapped mode when the underlying H/W driver and platform HAL support such use.
Memory mapped access allows the CPU to directly read data or execute code from the flash area. The default is for the feature to be enabled, which is desired for most configurations. However, in some situations, indirect (e.g. DMA) access may be preferred for performance reasons, in which case this feature can be disabled.
When the option is enabled some further configuration options are presented:
CYGIMP_DEVS_FLASH_SPI_COMMON_MEMMAPPED_XIPISR
This option should be enabled if ISRs or DSRs are to execute from the memory mapped xSPI space.
Note This will adversely affect the interrupt latency of the system, since certain xSPI operations will need to disable interrupts when switching out of memory mapped mode (e.g. erasing). So this feature should only be enabled if actually required.
CYGIMP_DEVS_FLASH_SPI_COMMON_MEMMAPPED_DRIVER
- If the eCos application providing the xSPI flash driver is executing from the flash device (using memory mapped mode) then some critical functionality must execute from a different memory space (e.g. SRAM).
CYGFUN_DEVS_FLASH_SPI_COMMON_SOFTRESET
- This option controls whether support for device soft reset is enabled. The developer is not normally required to modify this option
Fixed settings
If the target system needs to support devices without SFDP
tables, or where the tables provide inconsistent or incomplete
information, then a hook mechanism is provided based on the
standard RDID
command
(0x9F
). The flash_csm_fixedset.h
provides
the CYG_CSM_FIXEDSET(localname, mask, id,
init_function)
macro to allow an instantation of a
cyg_csm_family_t
structure to be added to
the table scanned by this common flash driver.
This provides a mechanism for partially or completely updating the internal context used to describe a device to the common flash code and the underlying H/W driver layer.
Currently SFDP fix-up support is provided for the
Winbond W25Q512JV
parts when the
CYGINT_DEVS_FLASH_SPI_COMMON_HARDWIRED_W25Q512
interface is implemented. Normally the required
implements
is performed by the target
platform CDL as required, and should not need to be managed by
application developers.
2024-12-10 | Open Publication License |