sdcard: Updating sector calculation for SDXC.#1052
sdcard: Updating sector calculation for SDXC.#1052projectgus merged 1 commit intomicropython:masterfrom
Conversation
4157a86 to
42670e4
Compare
|
will fix issue #1053 |
|
Is there anything you could do to add a test for this to sdtest.py? |
I'd be happy to work on it... is there a framework for mocking out the hardware, or is that test run against a particular sdcard? |
|
I think it's just run against real hardware, though of no particular spec; changing the test to one that requires SDXC hardware to pass isn't an issue. (From experience, it's actually more difficult to get non-SDXC cards these days...) As for what operation to actually test with, you're probably more familiar than I here --- but the thought that comes to mind is if there's a way to attempt to operate on a large sparse file or a small file that's in a high-numbered sector past the end of the max SDHC sector number. If the only way to actually exercise this change is to write >32GB of data though, that should probably be added as a second test that isn't run by default --- but having the test code already prepared will make it a lot easier for a maintainer to verify the change either way. |
projectgus
left a comment
There was a problem hiding this comment.
I think the only way to get a useful test would be to mock out the SD card. If you're keen to implement something like this then it'd be very welcome, @benwynn, but I'm happy to merge this fix as-is for now.
Thanks for submitting it!
The only remaining thing to do is to bump the bugfix version in sdcard/manifest.py, so that mip can see the updated package.
The current code only calculates sectors for SDHC, with a max of 32G The new code will calculate sectors for SDXC, with a max of 2T C_SIZE is 22 bits[69:48] and the high 2 bits of csd[7] are required to be 0, currently, so i'm not masking them off. The max value for C_SIZE is 0x3FFEFF, so C_SIZE+1*1024 is a 32-bit number. bumped version in manifest.py Signed-off-by: Ben Wynn <bwynn@glowie.com>
|
bumped version in manifest.py |
|
Thanks! |
The current code only calculates sectors for SDHC, with a max of 32G
The new code will calculate sectors for SDXC, with a max of 2T
C_SIZE is 22 bits[69:48] and the high 2 bits of csd[7] are required
to be 0, currently, so i'm not masking them off.
The max value for C_SIZE is 0x3FFEFF, so C_SIZE+1*1024 is a 32-bit number.