Page MenuHomePhabricator

Partial erase operation performed by SST on PSoC6 target
Closed, ResolvedPublic

Description

When sst_flash_erase_block() is invoked from Flash File System for PSoC6 target, I think it would never be able to erase more than 512 bytes on PSoC6 when SST emulated block is 4KB, which seems to be a concern during the initialization sequence.

Although during the write operation, we do have an implementation in driver layer of PSoC target which take care of erasing emulated block size of 4KB before write operation which doesn't seem to be adequate way, as the erase needs to happen at the SST than driver layer of the target.

Assuming these are just the workarounds here:

  • Do we have a design plan to sort out this in the near future for all the targets?
  • The way I see is there are 2 tasks here:
    • Fix the erase.
    • Remove the workaround for the write in the driver layer for all targets if any.

Event Timeline

jainvikas8 added a comment.EditedSep 13 2019, 10:06 AM

To fix the erase part, I'd like to propose that we have a new definition in the partition of each target

/* Number of FLASH_AREA_IMAGE_SECTOR_SIZE to emulate a SST block*/
#define SST_NBR_FAISES_PER_SECTOR         (0x8)

Then

#define SST_SECTOR_SIZE (SST_NBR_FAISES_PER_SECTOR * FLASH_AREA_IMAGE_SECTOR_SIZE)

and should support all the targets. Other targets would simply adhere to 4KB emulated block size where SST_NBR_FAISES_PER_SECTOR is 1.

The solution could be:

psa_ps_status_t sst_flash_erase_block(uint32_t block_id)
{
    uint32_t flash_addr, offset = BLOCK_START_OFFSET, sectors_to_erase = SST_NBR_FAISES_PER_SECTOR;
    psa_ps_status_t status;

    while (sectors_to_erase > 0)
    {
        flash_addr = get_phys_address(block_id, offset);

        status = flash_erase(flash_addr);

        if(status != PSA_PS_SUCCESS)
        {
            break;
        }
        
        sectors_to_erase--;

        offset += FLASH_AREA_IMAGE_SECTOR_SIZE;
    }

    return status;
}

@ainh Any thoughts, please?

jf549 assigned this task to jainvikas8.Sep 27 2019, 1:25 PM
jf549 triaged this task as Normal priority.
jf549 added a project: Restricted Project.
jf549 moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
jf549 added a subscriber: jf549.

Please close this issue. Changes are either merged or no longer required.

jf549 closed this task as Resolved.Nov 18 2019, 5:00 PM
jf549 moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.