-
Notifications
You must be signed in to change notification settings - Fork 16
Extending SPIF BD SFDP support #20
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
Hello: @geky, @bulislaw , @donatieng , @ARMmbed/mbed-os-maintainers , @dannybenor , @davidsaada - I'd appreciate your review of SPIF Block Device extended SFDP support |
Hey @offirko, quick question. How does this relate to qspif-blockdevice and ARMmbed/mbed-os#7774? |
@geky, AFAIU the planned steps by order are:
@dannybenor - please correct me if I'm wrong |
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.
Looks good to me 👍 (I was only able to do a rough review)
Will need to see the outcome for dual mode support.
bd_size_t SPIFBlockDevice::get_erase_size() const | ||
{ | ||
// return minimal erase size supported by all regions (0 if none exists) | ||
return _min_common_erase_size; |
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.
Maybe this should assert if there's no common erase size? Most of the existing code doesn't expect errors from this function.
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.
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.
@geky Maybe this seems harsh, but shouldn't we deprecate this function (the one that doesn't accept the address as parameter)? We have this problem in other cases as well (FlashIAP for instance).
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.
What does LittleFS call then? LittleFS only support fixed-size blocks, but that's the majority of the storage devices (especially larger ones).
My thought was if the blockdevice-level get_erase_size gets called on a device without a common block size then it's an error (shouldn't use a block-based filesystem on a block device without a common block size).
I double checked with LittleFS and FAT and it looks like both will error if get_erase_size returns 0, so maybe returning zero is a good idea.
/*********************************************/ | ||
/************** Local Functions **************/ | ||
/*********************************************/ | ||
static unsigned int local_math_power(int base, int exp) |
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.
Why not use std::pow? Then we could potentially share code.
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.
I think std::pow operates on float/double and would have required casting (not too critical)..
Also, using this small local function made it possible for me to avoid including <math.h> or "mbed.h"
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.
Oh you're right, I missed that there is no int overload... It was a small thought anyways
Sorry, had to revert the namespace mbed. It broke compatibility, which was being relied on by CI: 662c4a6 Was this the only blockdevice being moved into the mbed namespace? @deepikabhavnani has some plans to move to correct namespacing, but this will probably need to be a separate set of work: |
@geky - thanks for reverting namespace ... missed that with all the namespace recent flipflops |
No description provided.