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

Fix last-address calculate error in norflash_erase #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion device/peripheral/flash/fl256s/spi_flash_fl256s.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int32_t fl256s_erase(FL256S_DEF_PTR dev, uint32_t address, uint32_t size)
DEV_SPI_TRANSFER cmd_xfer;

// start address of last sector
last_address = (address + size) & (~(dev->sector_sz - 1));
last_address = (address + size - 1) & (~(dev->sector_sz - 1));

// start address of first sector
address &= ~(dev->sector_sz - 1);
Expand Down
2 changes: 1 addition & 1 deletion device/peripheral/flash/w25qxx/spi_flash_w25qxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int32_t w25qxx_erase(W25QXX_DEF_PTR dev, uint32_t address, uint32_t size)
DEV_SPI_TRANSFER cmd_xfer;

// start address of last sector
last_address = (address + size) & (~(dev->sector_sz - 1));
last_address = (address + size - 1) & (~(dev->sector_sz - 1));

// start address of first sector
address &= ~(dev->sector_sz - 1);
Expand Down
2 changes: 1 addition & 1 deletion example/baremetal/dma_spiflash/spi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ int32_t spiflash_erase(uint32_t address, uint32_t size)
SPI_XFER cmd_xfer;

// start address of last sector
last_address = (address + size) & (~(FLASH_SECTOR_SIZE - 1));
last_address = (address + size - 1) & (~(FLASH_SECTOR_SIZE - 1));

// start address of first sector
address &= ~(FLASH_SECTOR_SIZE - 1);
Expand Down