You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/23 13:45:08 UTC

[GitHub] [incubator-nuttx] tito97sp commented on a diff in pull request #7397: arch: stm32h7: Flush D-Cache on flash erase operation

tito97sp commented on code in PR #7397:
URL: https://github.com/apache/incubator-nuttx/pull/7397#discussion_r1002712991


##########
arch/arm/src/stm32h7/stm32h743xx_flash.c:
##########
@@ -769,6 +769,12 @@ ssize_t up_progmem_eraseblock(size_t block)
       return (ssize_t)ret;
     }
 
+  /* Flush and invalidate D-Cache for this block */
+
+#ifdef CONFIG_ARMV7M_DCACHE
+  up_flush_dcache(block_address, block_address + FLASH_SECTOR_SIZE);

Review Comment:
   HI @pkarashchenko. The problem I face is a lack in synchronization between the sector erase inside `up_progmem_eraseblock()` and the following erase check in `stm32h7_israngeerased()`.
   
   I see that once the sector is erased the cache flush the precious contents and once I check the memory status it appears as not clean, so in my opinion the flush of cache from previous operations must be done before the sector erase.
   
   Regarding the use of `up_flush_cache()` in place of `up_invalidate_dcache()` is for using the most conservative Cache operation. `up_invalidate_dcache()`  marks the contents as invalid (basically, a delete operation). 
   
   Info form: [level-1-cache-on-stm32f7-series-and-stm32h7-series-stmicroelectronics.pdf](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwik8O-7vfb6AhWIhv0HHcrTCt4QFnoECBcQAQ&url=https%3A%2F%2Fwww.st.com%2Fresource%2Fen%2Fapplication_note%2Fdm00272913-level-1-cache-on-stm32f7-series-and-stm32h7-series-stmicroelectronics.pdf&usg=AOvVaw22vWOqlHEuqOoGdM3hJ8sd)
   
   What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org