Skip to content

Implement embedded-storage traits for flash #6202

Description

@MabezDev

Implement the blocking embedded-storage traits for Flash<'_, Blocking> behind unstable (optional embedded-storage-03, no new features):

#[instability::unstable]
impl ErrorType for Flash<'_, Blocking> {
    type Error = Error;
}

#[instability::unstable]
impl ReadNorFlash for Flash<'_, Blocking> {
    const READ_SIZE: usize = 1;

    #[ram]
    fn read(&mut self, offset: u32, data: &mut [u8]) -> Result<(), Self::Error> {}

    fn capacity(&self) -> usize {}
}

#[instability::unstable]
impl NorFlash for Flash<'_, Blocking> {
    const WRITE_SIZE: usize = 4;
    const ERASE_SIZE: usize = 4096;

    #[ram]
    fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {}

    #[ram]
    fn write(&mut self, offset: u32, data: &[u8]) -> Result<(), Self::Error> {}
}

#[instability::unstable]
impl MultiwriteNorFlash for Flash<'_, Blocking> {}

NotAligned/OutOfBounds map to the matching NorFlashErrorKind, everything else to Other. Multiwrite is plain-access only. These stay unstable until embedded-storage 1.0. READ_SIZE drops from 4 to 1, so add HIL coverage for unaligned reads.

Activity

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

Metadata

Metadata

Assignees

Labels

package:esp-storageIssues related to the esp-storage packagestatus:blockedUnable to progress - dependent on another task

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions