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

CRC support added #75

Merged
merged 2 commits into from
Mar 29, 2018
Merged

CRC support added #75

merged 2 commits into from
Mar 29, 2018

Conversation

deepikabhavnani
Copy link

CRC Class is added to mbed-os.
PR dependency #ARMmbed/mbed-os#5669

TODO:
Readme should be updated once upstream PR is merged, and add dependency of mbed-os release version.
Proper tag should be created to indicate the dependency

"FSFAT_SDCARD_INSTALLED": 1,
"CRC_ENABLED": 1,
"CRC7": "SlowCRC",
"CRC16":"FastCRC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiousity, why is one fast and one slow?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both Fast and Slow support CRC7/CRC16.

Using SlowCRC implementation for 7-bit as computation will be less (5bytes per command). SlowCRC does runtime computation.

FastCRC implementation generates CRC table during initialization instead of runtime computation, which makes it faster (but takes up RAM space). Using FastCRC for data makes sense as we need to compute for 512*blocks received for every transaction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks!

but takes up RAM space

Can this be forced into ROM?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance we could profile an SD card read and see what percentage of runtime is spent calculating the CRC? I'm really curious how the CRC compares to the overhead of the SPI transaction.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can check overhead in read as well as write data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And correct me if I'm wrong, but this is taking roughly 512 bytes of ROM?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

512 bytes for CRC16, 256 bytes for CRC7 if using FastCRC.

Copy link
Contributor

@sg- sg- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable but I dont understand why its conditionally compiled. Shouldn't this just always be there?

@deepikabhavnani
Copy link
Author

@sg- CRC support is not conditionally compiled now, but passed as parameter in constructor to add/remove this funcitonality

@deepikabhavnani
Copy link
Author

@geky - Please review

Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me as long as it has been well tested 👍

@deepikabhavnani
Copy link
Author

Tested with ARMmbed/mbed-os#6363 will wait for it to get merged to master.

+--------------+---------------+-------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
| target       | platform_name | test suite                          | test case                                                                              | passed | failed | result | elapsed_time (sec) |
+--------------+---------------+-------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+
| K66F-GCC_ARM | K66F          | sd-driver-tests-block_device-basic  | Testing read write random blocks                                                       | 1      | 0      | OK     | 4.92               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_00: fopen()/fgetc()/fprintf()/fclose() test.                          | 1      | 0      | OK     | 0.17               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_01: fopen()/fseek()/fclose() test.                                    | 1      | 0      | OK     | 0.25               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_03: tmpnam() test.                                                    | 1      | 0      | OK     | 0.07               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_04: fileno() test.                                                    | 1      | 0      | OK     | 0.06               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_05: opendir() basic test.                                             | 1      | 0      | OK     | 0.65               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_06: fread()/fwrite() file to sdcard.                                  | 1      | 0      | OK     | 0.14               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_07: sdcard fwrite() file test.                                        | 1      | 0      | OK     | 0.18               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_08: FATFileSystem::read()/write() test.                               | 1      | 0      | OK     | 4.34               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_09: POSIX FILE API fread()/fwrite() test.                             | 1      | 0      | OK     | 4.81               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-basic    | FSFAT_BASIC_TEST_10: ChanFS read()/write()) test.                                      | 1      | 0      | OK     | 4.21               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory creation                                                                     | 1      | 0      | OK     | 0.43               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory failures                                                                     | 1      | 0      | OK     | 0.07               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory iteration                                                                    | 1      | 0      | OK     | 0.09               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory remove                                                                       | 1      | 0      | OK     | 0.33               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory rename                                                                       | 1      | 0      | OK     | 3.03               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Directory tests                                                                        | 1      | 0      | OK     | 9.29               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | File creation                                                                          | 1      | 0      | OK     | 0.09               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Multi-block directory                                                                  | 1      | 0      | OK     | 51.16              |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Nested directories                                                                     | 1      | 0      | OK     | 1.15               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-dirs     | Root directory                                                                         | 1      | 0      | OK     | 0.07               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Block Size file test                                                                   | 1      | 0      | OK     | 0.53               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Dir check                                                                              | 1      | 0      | OK     | 0.06               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | File tests                                                                             | 1      | 0      | OK     | 9.28               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Large file test                                                                        | 1      | 0      | OK     | 7.83               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Medium file test                                                                       | 1      | 0      | OK     | 0.34               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Multiple block size file test                                                          | 1      | 0      | OK     | 0.71               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Non-overlap check                                                                      | 1      | 0      | OK     | 3.23               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Simple file test                                                                       | 1      | 0      | OK     | 0.13               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-files    | Small file test                                                                        | 1      | 0      | OK     | 0.14               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_01: fopen()/fwrite()/fclose() directories/file in multi-dir filepath. | 1      | 0      | OK     | 2.81               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_02: fopen(r) pre-existing file try to write it.                       | 1      | 0      | OK     | 0.16               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_03: fopen(w+) pre-existing file try to write it.                      | 1      | 0      | OK     | 0.3                |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_04: fopen() with a filename exceeding the maximum length.             | 1      | 0      | OK     | 0.1                |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_06: fopen() with bad filenames (minimal).                             | 1      | 0      | OK     | 0.09               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_07: fopen()/errno handling.                                           | 1      | 0      | OK     | 0.08               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_08: ferror()/clearerr()/errno handling.                               | 1      | 0      | OK     | 0.09               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_09: ftell() handling.                                                 | 1      | 0      | OK     | 0.11               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_10: remove() test.                                                    | 1      | 0      | OK     | 0.59               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_11: rename().                                                         | 1      | 0      | OK     | 0.9                |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_12: opendir(), readdir(), closedir() test.                            | 1      | 0      | OK     | 1.54               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_13: mkdir() test.                                                     | 1      | 0      | OK     | 0.5                |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_14: stat() test.                                                      | 1      | 0      | OK     | 0.62               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_15: format() test.                                                    | 1      | 0      | OK     | 9.32               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-fopen    | FSFAT_FOPEN_TEST_16: write/check n x 25kB data files.                                  | 1      | 0      | OK     | 38.38              |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-parallel | File tests                                                                             | 1      | 0      | OK     | 9.28               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-parallel | Filesystem access from multiple threads                                                | 1      | 0      | OK     | 0.68               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Boundary seek and write                                                                | 1      | 0      | OK     | 0.39               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Large dir seek                                                                         | 1      | 0      | OK     | 0.16               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Large file seek                                                                        | 1      | 0      | OK     | 0.12               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Large file seek and write                                                              | 1      | 0      | OK     | 0.14               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Out-of-bounds seek                                                                     | 1      | 0      | OK     | 0.12               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Seek tests                                                                             | 1      | 0      | OK     | 26.34              |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Simple dir seek                                                                        | 1      | 0      | OK     | 0.08               |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Simple file seek                                                                       | 1      | 0      | OK     | 0.1                |
| K66F-GCC_ARM | K66F          | sd-driver-tests-filesystem-seek     | Simple file seek and write                                                             | 1      | 0      | OK     | 0.13               |
+--------------+---------------+-------------------------------------+----------------------------------------------------------------------------------------+--------+--------+--------+--------------------+

Corrected version comment : 5.8.0
@deepikabhavnani deepikabhavnani self-assigned this Mar 27, 2018
@deepikabhavnani deepikabhavnani merged commit 48bdc88 into PelionIoT:master Mar 29, 2018
@deepikabhavnani deepikabhavnani deleted the crc_support branch March 29, 2018 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants