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

imxrt-flash: support for calulating CRC32 of selected region #494

Merged
merged 2 commits into from
May 20, 2024

Conversation

ziemleszcz
Copy link
Contributor

CRC32 can be calulated for selected region of flash memory or raw partition. To calculate automatically CRC32 of whole memory/partition set addr and len to 0.

JIRA: NIL-574

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (imxrt1176).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@ziemleszcz ziemleszcz self-assigned this May 14, 2024
storage/imxrt-flash/flashsrv.c Outdated Show resolved Hide resolved
storage/imxrt-flash/flashsrv.c Outdated Show resolved Hide resolved
storage/imxrt-flash/imxrt-flashsrv.h Outdated Show resolved Hide resolved
Copy link

github-actions bot commented May 14, 2024

Unit Test Results

7 460 tests  ±0   6 745 ✅ ±0   39m 10s ⏱️ -1s
  420 suites ±0     715 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 0bf50dd. ± Comparison against base commit 6a502d1.

♻️ This comment has been updated with latest results.

@ziemleszcz ziemleszcz force-pushed the ziemleszcz/NIL-574 branch 2 times, most recently from d012992 to ebb4991 Compare May 16, 2024 09:13
gorbanchovie
gorbanchovie previously approved these changes May 17, 2024
Copy link
Contributor

@gorbanchovie gorbanchovie left a comment

Choose a reason for hiding this comment

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

lgtm

@ziemleszcz ziemleszcz marked this pull request as ready for review May 17, 2024 08:33
return res;
}

buf = malloc(CRC32_BUFSZ);
Copy link
Contributor

Choose a reason for hiding this comment

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

The imxrt-flash is a legally relevant part of fw. All allocated memory should be known at initialization stage or compile time. Using malloc/free at each call to function may lead to memory fragmentation during long-term operation (MISRA Dir 4.12 req.).
Btw. NOR page size is 256 bytes @ 4KiB sector size, you can use smaller buffer for it e.g. of page size 256 bytes if allocated statically to save ram space.

CRC32 can be calulated for selected region of flash memory or raw partition.
To calculate automatically CRC32 of whole memory/partition set addr and
len to 0.

JIRA: NIL-574
Copy link
Contributor

@gorbanchovie gorbanchovie left a comment

Choose a reason for hiding this comment

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

lgtm

@ziemleszcz ziemleszcz merged commit 655abb9 into master May 20, 2024
30 checks passed
@ziemleszcz ziemleszcz deleted the ziemleszcz/NIL-574 branch May 20, 2024 09:48
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