This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 89d3ba44ca Fixes to RP2040 SMART flash and documentation
89d3ba44ca is described below

commit 89d3ba44ca9221dd9b5e31c4ce7ae0a497e89b46
Author: curuvar <58759586+curu...@users.noreply.github.com>
AuthorDate: Mon Sep 5 14:34:58 2022 -0400

    Fixes to RP2040 SMART flash and documentation
---
 .../boards/adafruit-feather-rp2040/index.rst       |  6 ++++
 .../arm/rp2040/boards/adafruit-kb2040/index.rst    |  6 ++++
 .../rp2040/boards/adafruit-qt-py-rp2040/index.rst  |  6 ++++
 .../arm/rp2040/boards/pimoroni-tiny2040/index.rst  |  6 ++++
 .../arm/rp2040/boards/raspberrypi-pico-w/index.rst |  9 +++++-
 .../arm/rp2040/boards/raspberrypi-pico/index.rst   |  6 ++++
 .../arm/rp2040/adafruit-feather-rp2040/README.txt  |  2 +-
 boards/arm/rp2040/adafruit-kb2040/README.txt       |  2 +-
 boards/arm/rp2040/adafruit-qt-py-rp2040/README.txt |  2 +-
 boards/arm/rp2040/pimoroni-tiny2040/README.txt     |  2 +-
 boards/arm/rp2040/raspberrypi-pico-w/README.txt    |  2 +-
 boards/arm/rp2040/raspberrypi-pico/README.txt      |  2 +-
 .../ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c        |  2 +-
 .../ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h        |  2 +-
 fs/smartfs/smartfs.h                               | 14 ++++++---
 fs/smartfs/smartfs_smart.c                         | 36 ++--------------------
 fs/smartfs/smartfs_utils.c                         |  4 +--
 17 files changed, 60 insertions(+), 49 deletions(-)

diff --git 
a/Documentation/platforms/arm/rp2040/boards/adafruit-feather-rp2040/index.rst 
b/Documentation/platforms/arm/rp2040/boards/adafruit-feather-rp2040/index.rst
index 2804c50eab..9bbfe545e9 100644
--- 
a/Documentation/platforms/arm/rp2040/boards/adafruit-feather-rp2040/index.rst
+++ 
b/Documentation/platforms/arm/rp2040/boards/adafruit-feather-rp2040/index.rst
@@ -156,6 +156,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git 
a/Documentation/platforms/arm/rp2040/boards/adafruit-kb2040/index.rst 
b/Documentation/platforms/arm/rp2040/boards/adafruit-kb2040/index.rst
index d3074d5b26..3babaa5c4c 100644
--- a/Documentation/platforms/arm/rp2040/boards/adafruit-kb2040/index.rst
+++ b/Documentation/platforms/arm/rp2040/boards/adafruit-kb2040/index.rst
@@ -132,6 +132,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git 
a/Documentation/platforms/arm/rp2040/boards/adafruit-qt-py-rp2040/index.rst 
b/Documentation/platforms/arm/rp2040/boards/adafruit-qt-py-rp2040/index.rst
index 3052d078e6..93f363df5f 100644
--- a/Documentation/platforms/arm/rp2040/boards/adafruit-qt-py-rp2040/index.rst
+++ b/Documentation/platforms/arm/rp2040/boards/adafruit-qt-py-rp2040/index.rst
@@ -100,6 +100,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART1, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git 
a/Documentation/platforms/arm/rp2040/boards/pimoroni-tiny2040/index.rst 
b/Documentation/platforms/arm/rp2040/boards/pimoroni-tiny2040/index.rst
index e4b61efd11..3ef289a096 100644
--- a/Documentation/platforms/arm/rp2040/boards/pimoroni-tiny2040/index.rst
+++ b/Documentation/platforms/arm/rp2040/boards/pimoroni-tiny2040/index.rst
@@ -97,6 +97,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git 
a/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico-w/index.rst 
b/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico-w/index.rst
index b72b96b42d..0d94d0bc13 100644
--- a/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico-w/index.rst
+++ b/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico-w/index.rst
@@ -1,5 +1,5 @@
 ===============================
-Raspberry Pi Pico
+Raspberry Pi Pico W
 ===============================
 
 The `Raspberry Pi Pico 
<https://www.raspberrypi.com/products/raspberry-pi-pico/>`_ is a general 
purpose board supplied by
@@ -38,6 +38,7 @@ Buttons and LEDs
 ================
 
 LED controlled by GPIO0 of the wireless chip (not the RP2040 processor).
+Use rp2040_extra_gpio_put(0,value) to control this LED.
 
 A BOOTSEL button, which if held down when power is first
 applied to the board, will cause the RP2040 to boot into programming
@@ -179,6 +180,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git 
a/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico/index.rst 
b/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico/index.rst
index f4585c6e66..196cf03733 100644
--- a/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico/index.rst
+++ b/Documentation/platforms/arm/rp2040/boards/raspberrypi-pico/index.rst
@@ -158,6 +158,12 @@ nsh
 
 Basic NuttShell configuration (console enabled in UART0, at 115200 bps).
 
+nsh-flash
+---------
+
+Basic NuttShell configuration (console enabled in UART0, at 115200 bps
+with SMART flash filesystem.
+
 nshsram
 -------
 
diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/README.txt 
b/boards/arm/rp2040/adafruit-feather-rp2040/README.txt
index 80f2a72af0..313f36672f 100644
--- a/boards/arm/rp2040/adafruit-feather-rp2040/README.txt
+++ b/boards/arm/rp2040/adafruit-feather-rp2040/README.txt
@@ -71,7 +71,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/boards/arm/rp2040/adafruit-kb2040/README.txt 
b/boards/arm/rp2040/adafruit-kb2040/README.txt
index 4c725d2166..082dcba688 100644
--- a/boards/arm/rp2040/adafruit-kb2040/README.txt
+++ b/boards/arm/rp2040/adafruit-kb2040/README.txt
@@ -70,7 +70,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/boards/arm/rp2040/adafruit-qt-py-rp2040/README.txt 
b/boards/arm/rp2040/adafruit-qt-py-rp2040/README.txt
index 039eb52964..925782094b 100644
--- a/boards/arm/rp2040/adafruit-qt-py-rp2040/README.txt
+++ b/boards/arm/rp2040/adafruit-qt-py-rp2040/README.txt
@@ -65,7 +65,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/boards/arm/rp2040/pimoroni-tiny2040/README.txt 
b/boards/arm/rp2040/pimoroni-tiny2040/README.txt
index 4eb1ab821c..76668788a1 100644
--- a/boards/arm/rp2040/pimoroni-tiny2040/README.txt
+++ b/boards/arm/rp2040/pimoroni-tiny2040/README.txt
@@ -69,7 +69,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/boards/arm/rp2040/raspberrypi-pico-w/README.txt 
b/boards/arm/rp2040/raspberrypi-pico-w/README.txt
index 1757187c4d..4940494200 100644
--- a/boards/arm/rp2040/raspberrypi-pico-w/README.txt
+++ b/boards/arm/rp2040/raspberrypi-pico-w/README.txt
@@ -72,7 +72,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/boards/arm/rp2040/raspberrypi-pico/README.txt 
b/boards/arm/rp2040/raspberrypi-pico/README.txt
index 86d60167e7..a6826e0f7b 100644
--- a/boards/arm/rp2040/raspberrypi-pico/README.txt
+++ b/boards/arm/rp2040/raspberrypi-pico/README.txt
@@ -71,7 +71,7 @@ Defconfigs
 - nsh
     Minimum configuration with NuttShell
 
-- nsh_flash
+- nsh-flash
     NuttX shell with SMART flash filesystem.
 
 - nshsram
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c 
b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c
index c534982baa..586d636eea 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c
@@ -129,7 +129,7 @@ int process_f2_frame_header(FAR bcmf_interface_dev_t *gbus,
  ****************************************************************************/
 
 /****************************************************************************
- * Name: read_f2_frame
+ * Name: bcmf_gspi_read_f2_frame
  *
  * Description:
  *    Read and process an F2 frame.
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h 
b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h
index bad14cba45..06ae58fda2 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h
@@ -32,7 +32,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: read_f2_frame
+ * Name: bcmf_gspi_read_f2_frame
  *
  * Description:
  *    Read and process an F2 frame.
diff --git a/fs/smartfs/smartfs.h b/fs/smartfs/smartfs.h
index d00d836bf6..0e66875c7d 100644
--- a/fs/smartfs/smartfs.h
+++ b/fs/smartfs/smartfs.h
@@ -199,15 +199,21 @@
 
 #ifdef CONFIG_SMARTFS_ALIGNED_ACCESS
 #  define SMARTFS_NEXTSECTOR(h)        (smartfs_rdle16(h->nextsector))
-#  define SMARTFS_SET_NEXTSECTOR(h, v) smartfs_wrle16(h->nextsector, v)
+#  define SMARTFS_SET_NEXTSECTOR(h, v) smartfs_wrle16(h->nextsector, \
+                                            (uint16_t)(v))
+
 #  define SMARTFS_USED(h)              (smartfs_rdle16(h->used))
-#  define SMARTFS_SET_USED(h, v)       smartfs_wrle16(h->used, v)
+#  define SMARTFS_SET_USED(h, v)       smartfs_wrle16(h->used, \
+                                            (uint16_t)(v))
 
 #else
 #  define SMARTFS_NEXTSECTOR(h)        (*((uint16_t *)h->nextsector))
-#  define SMARTFS_SET_NEXTSECTOR(h, v) ((*((uint16_t *)h->nextsector)) = v)
+#  define SMARTFS_SET_NEXTSECTOR(h, v) ((*((uint16_t *)h->nextsector)) = \
+                                            (uint16_t)(v))
+
 #  define SMARTFS_USED(h)              (*((uint16_t *)h->used))
-#  define SMARTFS_SET_USED(h, v)       ((*((uint16_t *)h->used)) = v)
+#  define SMARTFS_SET_USED(h, v)       ((*((uint16_t *)h->used)) = \
+                                            (uint16_t)(v))
 #endif
 
 #ifdef CONFIG_MTD_SMART_ENABLE_CRC
diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c
index 9cebba5c99..9b48562a0a 100644
--- a/fs/smartfs/smartfs_smart.c
+++ b/fs/smartfs/smartfs_smart.c
@@ -45,10 +45,6 @@
 
 #include "smartfs.h"
 
-#ifdef CONFIG_DEBUG_FS_INFO
-#  include <stdio.h>
-#endif
-
 /****************************************************************************
  * Private Type
  ****************************************************************************/
@@ -532,8 +528,6 @@ static ssize_t smartfs_read(FAR struct file *filep, char 
*buffer,
 
   DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
 
-  finfo("Reading %u bytes\n", (unsigned) buflen);
-
   /* Recover our private data from the struct file instance */
 
   sf    = filep->f_priv;
@@ -639,18 +633,6 @@ static ssize_t smartfs_read(FAR struct file *filep, char 
*buffer,
 
   /* Return the number of bytes we read */
 
-#ifdef CONFIG_DEBUG_FS_INFO
-  finfo("Read %lu bytes:", bytesread);
-  for (uint32_t i = 0; i < bytesread; ++i)
-    {
-      if ((i & 0x0f) == 0) printf("\n    ");
-
-      printf("%02x, ", buffer[i]);
-    }
-
-  printf("\n");
-#endif
-
   ret = bytesread;
 
 errout_with_semaphore:
@@ -675,18 +657,6 @@ static ssize_t smartfs_write(FAR struct file *filep, const 
char *buffer,
 
   DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
 
-#ifdef CONFIG_DEBUG_FS_INFO
-  finfo("Writing %lu bytes:", (uint32_t)buflen);
-  for (uint32_t i = 0; i < buflen; ++i)
-    {
-      if ((i & 0x0f) == 0) printf("\n    ");
-
-      printf("%02x, ", buffer[i]);
-    }
-
-  printf("\n");
-#endif
-
   /* Recover our private data from the struct file instance */
 
   sf    = filep->f_priv;
@@ -882,7 +852,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const 
char *buffer,
           /* Copy the new sector to the old one and chain it */
 
           header = (struct smartfs_chain_header_s *) sf->buffer;
-          SMARTFS_SET_NEXTSECTOR(header, (uint16_t) ret);
+          SMARTFS_SET_NEXTSECTOR(header, ret);
 
           /* Now sync the file to write this sector out */
 
@@ -938,7 +908,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const 
char *buffer,
               /* Copy the new sector to the old one and chain it */
 
               header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
-              SMARTFS_SET_NEXTSECTOR(header, (uint16_t) ret);
+              SMARTFS_SET_NEXTSECTOR(header, ret);
               readwrite.offset = offsetof(struct smartfs_chain_header_s,
                 nextsector);
               readwrite.buffer = (uint8_t *) header->nextsector;
@@ -971,8 +941,6 @@ static ssize_t smartfs_write(FAR struct file *filep, const 
char *buffer,
 
   ret = byteswritten;
 
-  finfo("Wrote %u bytes\n", (unsigned) byteswritten);
-
 errout_with_semaphore:
   smartfs_semgive(fs);
   return ret;
diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c
index ef2d019c3a..24267ca65f 100644
--- a/fs/smartfs/smartfs_utils.c
+++ b/fs/smartfs/smartfs_utils.c
@@ -2031,7 +2031,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
           /* Copy the new sector to the old one and chain it */
 
           header = (struct smartfs_chain_header_s *) sf->buffer;
-          SMARTFS_SET_NEXTSECTOR(header, (uint16_t)ret);
+          SMARTFS_SET_NEXTSECTOR(header, ret);
 
           /* Now sync the file to write this sector out */
 
@@ -2087,7 +2087,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
               /* Copy the new sector to the old one and chain it */
 
               header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
-              SMARTFS_SET_NEXTSECTOR(header, (uint16_t)ret);
+              SMARTFS_SET_NEXTSECTOR(header, ret);
 
               readwrite.offset = offsetof(struct smartfs_chain_header_s,
                                           nextsector);

Reply via email to