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 2020/02/27 13:37:16 UTC

[GitHub] [incubator-nuttx] bjbrandt commented on a change in pull request #391: arch/arm/src/stm32/stm32f20xxf40xx_flash.c: Add progmen flash block mapping.

bjbrandt commented on a change in pull request #391: arch/arm/src/stm32/stm32f20xxf40xx_flash.c: Add progmen flash block mapping.
URL: https://github.com/apache/incubator-nuttx/pull/391#discussion_r385129510
 
 

 ##########
 File path: arch/arm/src/stm32/stm32f20xxf40xx_flash.c
 ##########
 @@ -226,83 +279,65 @@ int stm32_flash_writeprotect(size_t page, bool enabled)
       up_waste();
     }
 
-  /* Relock options */
+  /* Re-lock options */
 
   modifyreg32(STM32_FLASH_OPTCR, 0, FLASH_OPTCR_OPTLOCK);
   return 0;
 }
 
 size_t up_progmem_pagesize(size_t page)
 {
-  static const size_t page_sizes[STM32_FLASH_NPAGES] = STM32_FLASH_SIZES;
-
-  if (page >= sizeof(page_sizes) / sizeof(*page_sizes))
-    {
-      return 0;
-    }
-  else
-    {
-      return page_sizes[page];
-    }
+  return PAGESIZE;
 
 Review comment:
   Hi David, 
   this is a naming issue. Commit 0f18e8cc328f1a420135531eb2afe57b27d3332f introduced 'page' as the unit for r/w access. This is constant for the F4 (128 bit). The not constant sector size is only relevant for erase operations and therefore accessible via up_progmem_erasesize(). 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services