jsanchez-2g commented on code in PR #19978:
URL: https://github.com/apache/nuttx/pull/19978#discussion_r3864649131


##########
arch/arm/src/common/stm32/stm32_uid.c:
##########
@@ -56,6 +61,20 @@ void stm32_get_uniqueid(uint8_t uniqueid[12])
 {
   uint32_t uid[3];
   int i;
+#if defined(CONFIG_ARCH_CHIP_STM32H5) && defined(CONFIG_STM32_ICACHE)
+  bool icache_enabled;
+
+  /* The STM32H5 UID is stored in flash information memory, which cannot be
+   * read while the instruction cache is enabled.  Preserve the cache state
+   * across the UID access.
+   */
+
+  icache_enabled = (getreg32(STM32_ICACHE_CR) & ICACHE_CR_EN) != 0;

Review Comment:
   ah, ok. that makes sense also. I’ll add stm32_icache_enabled() to the ICACHE 
interface and use it from the UID implementation instead of accessing 
STM32_ICACHE_CR directly.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to