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/08 15:36:28 UTC

[GitHub] [incubator-nuttx] tito97sp opened a new pull request, #7258: arch: stm32h7: Add support for dual bank flash

tito97sp opened a new pull request, #7258:
URL: https://github.com/apache/incubator-nuttx/pull/7258

   Signed-off-by: Andrés Sánchez Pascual <ti...@hotmail.com>
   
   ## Summary
   stm32_flash.c not supports currently the dual bank flash memory layout. This commit contemplates this possible layout.
   
   Also a bug in stm32h7_israngeerased function has been solved.
   
   ## Impact
   stm32h7 arch and based boards.
   
   ## Testing
   Tested with nucleo-h743zi with multiple MTD drivers in different memory banks:
   
   - /dev/ota0 in bank1   (start_address  0x08040000, lenght 0xC0000)
   - /dev/ota1 in bank2   (start_address  0x08100000, lenght 0xC0000)
   - /dev/scratch in bank2 (start_address  0x081E0000, lenght 0x40000)
   
   
   


-- 
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


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #7258: arch: stm32h7: Add support for dual bank flash

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7258:
URL: https://github.com/apache/incubator-nuttx/pull/7258


-- 
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


[GitHub] [incubator-nuttx] tito97sp commented on a diff in pull request #7258: arch: stm32h7: Add support for dual bank flash

Posted by GitBox <gi...@apache.org>.
tito97sp commented on code in PR #7258:
URL: https://github.com/apache/incubator-nuttx/pull/7258#discussion_r990780304


##########
arch/arm/src/stm32h7/stm32_flash.c:
##########
@@ -330,15 +331,24 @@ static inline uint32_t stm32h7_flash_size(
 static inline
 struct stm32h7_flash_priv_s * stm32h7_flash_bank(size_t address)
 {
-  struct stm32h7_flash_priv_s *priv = &stm32h7_flash_bank1_priv;
-  if (address < priv->base || address >=
-      priv->base + stm32h7_flash_size(priv))
+  struct stm32h7_flash_priv_s *priv = NULL;
+ 
+  uint32_t bank_size;
+#ifdef STM32_DUAL_BANK
+  bank_size = stm32h7_flash_size(priv) / 2;
+#else
+  bank_size = stm32h7_flash_size(priv);
+#endif
+
+  if (address >= stm32h7_flash_bank1_priv.base && address <
+      stm32h7_flash_bank1_priv.base + bank_size)
     {
-      return NULL;
+      priv = &stm32h7_flash_bank1_priv;
     }
 
-#if STM32_FLASH_NBLOCKS > 1
-  if (address >= stm32h7_flash_bank2_priv.base)
+#ifdef STM32_DUAL_BANK
+  else if (address >= stm32h7_flash_bank2_priv.base && address <
+      stm32h7_flash_bank2_priv.base + bank_size)

Review Comment:
   Fixed :+1: 



-- 
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


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7258: arch: stm32h7: Add support for dual bank flash

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7258:
URL: https://github.com/apache/incubator-nuttx/pull/7258#discussion_r990694486


##########
arch/arm/src/stm32h7/stm32_flash.c:
##########
@@ -330,15 +331,24 @@ static inline uint32_t stm32h7_flash_size(
 static inline
 struct stm32h7_flash_priv_s * stm32h7_flash_bank(size_t address)
 {
-  struct stm32h7_flash_priv_s *priv = &stm32h7_flash_bank1_priv;
-  if (address < priv->base || address >=
-      priv->base + stm32h7_flash_size(priv))
+  struct stm32h7_flash_priv_s *priv = NULL;
+ 
+  uint32_t bank_size;
+#ifdef STM32_DUAL_BANK
+  bank_size = stm32h7_flash_size(priv) / 2;
+#else
+  bank_size = stm32h7_flash_size(priv);
+#endif
+
+  if (address >= stm32h7_flash_bank1_priv.base && address <
+      stm32h7_flash_bank1_priv.base + bank_size)
     {
-      return NULL;
+      priv = &stm32h7_flash_bank1_priv;
     }
 
-#if STM32_FLASH_NBLOCKS > 1
-  if (address >= stm32h7_flash_bank2_priv.base)
+#ifdef STM32_DUAL_BANK
+  else if (address >= stm32h7_flash_bank2_priv.base && address <
+      stm32h7_flash_bank2_priv.base + bank_size)

Review Comment:
   ```suggestion
     else if (address >= stm32h7_flash_bank2_priv.base &&
              address < stm32h7_flash_bank2_priv.base + bank_size)
   ```



-- 
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