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

SFDP: Add unit tests for Sector Map Parameter Table parsing #14983

Merged
merged 4 commits into from
Aug 6, 2021

Conversation

LDong-Arm
Copy link
Contributor

@LDong-Arm LDong-Arm commented Aug 6, 2021

Summary of changes

Add tests for sfdp_parse_sector_map_table() which currently (at the time of this PR) supports flash devices with

  • no Sector Map Parameter Table (i.e. the whole flash is uniform and non-configurable)
  • a single descriptor in the Sector Map Parameter Table (i.e. the flash layout is non-configurable and has multiple regions)

Support and unit tests for flashes with multiple configurable layouts (issue #12574) will be added in a subsequent PR.

Note: The implementation of sfdp_parse_sector_map_table() assumes the table to be valid if read succeeds, so the SFDP reader callback needs to ensure it reads data correctly or return an error.
When we cover #12574 in a upcoming PR, we'll add more checks on SFDP data consistency when we rework this function.

Impact of changes

Migration actions required

Documentation

None.


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR

Reviewers

@ARMmbed/mbed-os-core


When a flash chip's SFDP table has no sector map, we treat the whole
flash as a single region. As an optimization, this should only be
done if there is indeed no sector map.
@LDong-Arm LDong-Arm requested a review from a team August 6, 2021 09:03
@LDong-Arm LDong-Arm added this to In progress (8) in Mbed Core via automation Aug 6, 2021
@LDong-Arm LDong-Arm moved this from In progress (8) to Awaiting review (3) in Mbed Core Aug 6, 2021
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Aug 6, 2021
@ciarmcom ciarmcom requested a review from a team August 6, 2021 09:30
@ciarmcom
Copy link
Member

ciarmcom commented Aug 6, 2021

@LDong-Arm, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

Patater
Patater previously requested changes Aug 6, 2021
storage/blockdevice/source/SFDP.cpp Show resolved Hide resolved
storage/blockdevice/tests/UNITTESTS/SFDP/test_sfdp.cpp Outdated Show resolved Hide resolved
Mbed Core automation moved this from Awaiting review (3) to Review in progress (4) Aug 6, 2021
@Patater Patater self-assigned this Aug 6, 2021
A flash device with no sector map table has uniform sectors, and we
treat the whole flash as one region. In this case the function
`sfdp_parse_sector_map_table()` sets the single region's size and high
boundary accordingly, but it lacks setting of region count to 1, so
users of the SFDP parser may not get the correct number of regions.
This commit fixes the issue.
The test data `struct mbed::sfdp_smptbl_info smptbl` is only relevant
to `TestEraseTypeAlgorithm` and not shared with other test cases.
@LDong-Arm LDong-Arm requested a review from Patater August 6, 2021 13:31
@mergify mergify bot dismissed Patater’s stale review August 6, 2021 13:31

Pull request has been modified.

@LDong-Arm
Copy link
Contributor Author

@Patater Thanks for reviewing, I've addressed your comments, please have a look.

Copy link
Contributor

@Patater Patater left a comment

Choose a reason for hiding this comment

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

LGTM

Mbed Core automation moved this from Review in progress (4) to Reviewer approved & awaiting CI & merge (3) Aug 6, 2021
@Patater
Copy link
Contributor

Patater commented Aug 6, 2021

CI Started

Mbed Core automation moved this from Reviewer approved & awaiting CI & merge (3) to Review in progress (4) Aug 6, 2021
Patater
Patater previously requested changes Aug 6, 2021
storage/blockdevice/tests/UNITTESTS/SFDP/test_sfdp.cpp Outdated Show resolved Hide resolved
@mergify mergify bot added needs: work and removed needs: CI labels Aug 6, 2021
Add tests for `sfdp_parse_sector_map_table()` which currently (at the
time of this commit) supports flash devices with
* no Sector Map Parameter Table (i.e. the whole flash is uniform and
non-configurable)
* a single descriptor in the Sector Map Parameter Table (i.e. the
flash layout is non-configurable and has multiple regions)

Support and unit tests for flashes with multiple configurable layouts
will be added in the future.

Note: The implementation of `sfdp_parse_sector_map_table()` assumes
the table to be valid if read succeeds, so the SFDP reader callback
needs to ensure it reads data correctly or return an error.
@LDong-Arm LDong-Arm requested a review from Patater August 6, 2021 14:28
@mergify mergify bot dismissed Patater’s stale review August 6, 2021 14:28

Pull request has been modified.

Mbed Core automation moved this from Review in progress (4) to Reviewer approved & awaiting CI & merge (3) Aug 6, 2021
@mbed-ci
Copy link

mbed-ci commented Aug 6, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM
jenkins-ci/mbed-os-ci_build-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-greentea-ARM
jenkins-ci/mbed-os-ci_cmake-example-ARM

@mergify mergify bot added needs: CI and removed needs: work labels Aug 6, 2021
@mbed-ci
Copy link

mbed-ci commented Aug 6, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@Patater Patater merged commit d4b1534 into ARMmbed:master Aug 6, 2021
Mbed Core automation moved this from Reviewer approved & awaiting CI & merge (3) to Done Aug 6, 2021
@mergify mergify bot removed the ready for merge label Aug 6, 2021
@Patater Patater moved this from Done to Reported in Mbed Core Aug 9, 2021
@mbedmain mbedmain added release-version: 6.14.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Aug 18, 2021
@LDong-Arm LDong-Arm deleted the sfdp_sector_map branch August 23, 2021 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Mbed Core
  
Reported
Development

Successfully merging this pull request may close these issues.

None yet

5 participants