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/06/14 02:41:34 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6426: stm32wl5: add flash progmem driver support

xiaoxiang781216 commented on code in PR #6426:
URL: https://github.com/apache/incubator-nuttx/pull/6426#discussion_r896319032


##########
arch/arm/src/stm32wl5/stm32wl5_flash.c:
##########
@@ -359,6 +343,31 @@ ssize_t up_progmem_eraseblock(size_t block)
     }
 }
 
+ssize_t up_progmem_ispageerased(size_t page)

Review Comment:
   why change the order of up_progmem_ispageerased and up_progmem_eraseblock? it make the change is hard to compare.



##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_flash.c:
##########
@@ -0,0 +1,297 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_flash.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/mtd/mtd.h>
+#include <nuttx/mtd/configdata.h>
+#include <nuttx/fs/nxffs.h>
+#include <nuttx/fs/smart.h>
+#include <nuttx/fs/fs.h>
+
+#include <debug.h>
+#include <stdio.h>
+
+#include "nucleo-wl55jc.h"
+#include "hardware/stm32wl5_flash.h"
+
+/****************************************************************************
+ * Pre-Processor Definitions
+ ****************************************************************************/
+
+#if (CONFIG_ARCH_BOARD_FLASH_CPU1_PROG_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_CPU2_PROG_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART1_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART2_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART3_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART4_SIZE) > 128
+#   error "Sum of all flash pertitions cannot be bigger than 128"
+#endif
+
+#if (CONFIG_ARCH_BOARD_FLASH_CPU1_PROG_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_CPU2_PROG_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART1_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART2_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART3_SIZE + \
+     CONFIG_ARCH_BOARD_FLASH_PART4_SIZE) < 128
+#   warning "There is unused space on flash"
+#endif
+
+#define FLASH_PAGE_SIZE    STM32WL5_FLASH_PAGESIZE
+
+/****************************************************************************
+ * Private Definitions
+ ****************************************************************************/
+
+struct part_table
+{
+    int         size; /* partition size in pages */
+    const char *name; /* name of the partition */
+    const char *mnt;  /* mount point for the partition */
+    const char *fs;   /* fs type (smart, raw, nxffs) */
+};
+
+/* partition table, first entry *must always* be program flash memory */
+
+static struct part_table part_table[] =

Review Comment:
   add const



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