-
Notifications
You must be signed in to change notification settings - Fork 3k
Prevent sector-unaligned erase #7952
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
Conversation
@bulislaw , @donatieng , @ARMmbed/mbed-os-maintainers , @dannybenor , @davidsaada . |
Please note that this fix should be entered before code freeze! |
SPIF_BD_ERROR_OK = 0, /*!< no error */ | ||
SPIF_BD_ERROR_DEVICE_ERROR = BD_ERROR_DEVICE_ERROR, /*!< device specific error -4001 */ | ||
SPIF_BD_ERROR_PARSING_FAILED = -4002, /* SFDP Parsing failed */ | ||
SPIF_BD_ERROR_READY_FAILED = -4003, /* Wait for Mem Ready failed */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rogue spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I caught the rouge tab (-:
{ | ||
utest_printf("\nTest Unaligned Program Starts..\n"); | ||
utest_printf("\nTest Unaligned Erase Starts..\n"); | ||
|
||
SPIFBlockDevice blockD(MBED_CONF_SPIF_DRIVER_SPI_MOSI, MBED_CONF_SPIF_DRIVER_SPI_MISO, MBED_CONF_SPIF_DRIVER_SPI_CLK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not use a camel case name (blockD) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix
return SPIF_BD_ERROR_INVALID_ERASE_PARAMS; | ||
} | ||
|
||
if ( ((addr % get_erase_size(addr)) != 0 ) || (((addr + in_size) % get_erase_size(addr + in_size - 1)) != 0 ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't the function is_valid_erase
work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_valid_erase wont work because it relies on a single erase-sector size.
This supports variable erase-sector size according to address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. This means that it has a bug, which should be fixed (but not in this PR of course).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidsaada - I think not all Block Devices support variable sector-erase size. You're right, it will require a separate PR, probably updating BlockDevice.h base class and maybe some inheriting block devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/morph build |
Build : SUCCESSBuild number : 2992 Triggering tests/morph test |
Test : SUCCESSBuild number : 2755 |
Exporter Build : SUCCESSBuild number : 2603 |
Description
Pull request type