foss-for-synopsys-dwc-arc-processors / embarc_osp

embARC Open Software Platform (OSP) - An embedded software distribution for IoT and other embedded applications for ARC
https://www.embarc.org/
BSD 3-Clause "New" or "Revised" License
70 stars 62 forks source link

norflash erase last address calculation error #179

Open CosmicRoach opened 2 months ago

CosmicRoach commented 2 months ago

https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp/blob/67ea926c6a62aa6e19efdc3b11cba3ea0b467e29/device/peripheral/flash/w25qxx/spi_flash_w25qxx.c#L267

Use the size to calculate the last address needs to subtract 1: last_address = (address + size -1) & (~(dev->sector_sz - 1));

abrodkin commented 2 months ago

@CosmicRoach could you please submit a pull-request with the proposed fix?