cmaglie / FlashStorage

A convenient way to store data into Flash memory on the ATSAMD21 and ATSAMD51 processor family
203 stars 69 forks source link

typo , should be SR but wrote CR #46

Closed WinflyLam closed 3 years ago

WinflyLam commented 3 years ago

typo on line 56 of FlashStorage.cpp

#if defined(__SAMD51__)
// Invalidate all CMCC cache entries if CMCC cache is enabled.
static void invalidate_CMCC_cache()
{
  if (CMCC->CR.bit.CSTS) {      <--- SR.bit.CSTS
    CMCC->CTRL.bit.CEN = 0;
    while (CMCC->SR.bit.CSTS) {}
    CMCC->MAINT0.bit.INVALL = 1;
    CMCC->CTRL.bit.CEN = 1;
  }
}
#endif
obra commented 3 years ago

@dhalbert Do you have opinions on this? I'm unable to build with #38 merged:

/Users/jesse/Documents/Arduino/libraries/FlashStorage/src/FlashStorage.cpp:56:13: error: 'struct Cmcc' has no member named 'CR'; did you mean 'SR'?
   56 |   if (CMCC->CR.bit.CSTS) {
      |             ^~
      |             SR
dhalbert commented 3 years ago

This fix is correct. I looked at my old work on this and it appears that I fixed this locally but somehow it did not get committed during the PR. I have a FlashStorage.cpp and FlashStorage.cpp~, and this is the diff!

56c56
<   if (CMCC->SR.bit.CSTS) {
---
>   if (CMCC->CR.bit.CSTS) {

If you submit a PR I will approve it!

obra commented 3 years ago

@dhalbert Thanks for the quick confirmation. I've opened PR #47 with the one character change.