You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/06/14 12:05:31 UTC

[incubator-nuttx] 02/04: boards/raspberrypi-pico: Add board support for USB device

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

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

commit e00546335dcf9d40ccadb5e1e8fa081fb6c78a48
Author: Yuichi Nakamura <y....@gmail.com>
AuthorDate: Sun Jun 13 23:58:22 2021 +0900

    boards/raspberrypi-pico: Add board support for USB device
---
 boards/arm/rp2040/common/src/Make.defs             |   8 +
 boards/arm/rp2040/common/src/rp2040_composite.c    | 276 +++++++++++++++++++++
 boards/arm/rp2040/common/src/rp2040_usbmsc.c       |  61 +++++
 boards/arm/rp2040/raspberrypi-pico/README.txt      |  20 ++
 .../configs/{displaypack => composite}/defconfig   |  66 ++---
 .../raspberrypi-pico/configs/displaypack/defconfig |   8 +-
 .../configs/{displaypack => usbmsc}/defconfig      |  59 ++---
 .../configs/{displaypack => usbnsh}/defconfig      |  56 +----
 8 files changed, 417 insertions(+), 137 deletions(-)

diff --git a/boards/arm/rp2040/common/src/Make.defs b/boards/arm/rp2040/common/src/Make.defs
index 68b28c3..32199ac 100644
--- a/boards/arm/rp2040/common/src/Make.defs
+++ b/boards/arm/rp2040/common/src/Make.defs
@@ -38,6 +38,14 @@ ifeq ($(CONFIG_LCD_ST7789),y)
 CSRCS += rp2040_st7789.c
 endif
 
+ifeq ($(CONFIG_USBMSC),y)
+CSRCS += rp2040_usbmsc.c
+endif
+
+ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
+CSRCS += rp2040_composite.c
+endif
+
 ifeq ($(CONFIG_RP2040_SPISD),y)
   CSRCS += rp2040_spisd.c
 endif
diff --git a/boards/arm/rp2040/common/src/rp2040_composite.c b/boards/arm/rp2040/common/src/rp2040_composite.c
new file mode 100644
index 0000000..153bf77
--- /dev/null
+++ b/boards/arm/rp2040/common/src/rp2040_composite.c
@@ -0,0 +1,276 @@
+/****************************************************************************
+ * boards/arm/rp2040/common/src/rp2040_composite.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 <sys/types.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/cdcacm.h>
+#include <nuttx/usb/usbmsc.h>
+#include <nuttx/usb/composite.h>
+
+#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE)
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC_COMPOSITE
+static FAR void *g_mschandle;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_mscclassobject
+ *
+ * Description:
+ *   If the mass storage class driver is part of composite device, then
+ *   its instantiation and configuration is a multi-step, board-specific,
+ *   process (See comments for usbmsc_configure below).  In this case,
+ *   board-specific logic must provide board_mscclassobject().
+ *
+ *   board_mscclassobject() is called from the composite driver.  It must
+ *   encapsulate the instantiation and configuration of the mass storage
+ *   class and the return the mass storage device's class driver instance
+ *   to the composite driver.
+ *
+ * Input Parameters:
+ *   classdev - The location to return the mass storage class' device
+ *     instance.
+ *
+ * Returned Value:
+ *   0 on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC_COMPOSITE
+static int board_mscclassobject(int minor,
+                                FAR struct usbdev_devinfo_s *devinfo,
+                                FAR struct usbdevclass_driver_s **classdev)
+{
+  int ret;
+
+  DEBUGASSERT(g_mschandle == NULL);
+
+  /* Configure the mass storage device */
+
+  uinfo("Configuring with NLUNS=1\n");
+  ret = usbmsc_configure(1, &g_mschandle);
+  if (ret < 0)
+    {
+      uerr("ERROR: usbmsc_configure failed: %d\n", -ret);
+      return ret;
+    }
+
+  uinfo("MSC handle=%p\n", g_mschandle);
+
+  /* Bind the LUN(s) */
+
+  uinfo("Bind LUN=0 to /dev/mmcsd0\n");
+  ret = usbmsc_bindlun(g_mschandle, "/dev/mmcsd0", 0, 0, 0, false);
+  if (ret < 0)
+    {
+      uerr("ERROR: usbmsc_bindlun failed for LUN 1 at /dev/mmcsd0: %d\n",
+           ret);
+      usbmsc_uninitialize(g_mschandle);
+      g_mschandle = NULL;
+      return ret;
+    }
+
+  /* Get the mass storage device's class object */
+
+  ret = usbmsc_classobject(g_mschandle, devinfo, classdev);
+  if (ret < 0)
+    {
+      uerr("ERROR: usbmsc_classobject failed: %d\n", -ret);
+      usbmsc_uninitialize(g_mschandle);
+      g_mschandle = NULL;
+    }
+
+  return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: board_mscuninitialize
+ *
+ * Description:
+ *   Un-initialize the USB storage class driver.
+ *   This is just an application specific wrapper for usbmsc_unitialize()
+ *   that is called form the composite device logic.
+ *
+ * Input Parameters:
+ *   classdev - The class driver instrance previously give to the composite
+ *     driver by board_mscclassobject().
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC_COMPOSITE
+static void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev)
+{
+  if (g_mschandle)
+    {
+      usbmsc_uninitialize(g_mschandle);
+    }
+
+  g_mschandle = NULL;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_composite_initialize
+ *
+ * Description:
+ *   Perform architecture specific initialization of a composite USB device.
+ *
+ ****************************************************************************/
+
+int board_composite_initialize(int port)
+{
+  return OK;
+}
+
+/****************************************************************************
+ * Name:  board_composite_connect
+ *
+ * Description:
+ *   Connect the USB composite device on the specified USB device port using
+ *   the specified configuration.  The interpretation of the configid is
+ *   board specific.
+ *
+ * Input Parameters:
+ *   port     - The USB device port.
+ *   configid - The USB composite configuration
+ *
+ * Returned Value:
+ *   A non-NULL handle value is returned on success.  NULL is returned on
+ *   any failure.
+ *
+ ****************************************************************************/
+
+FAR void *board_composite_connect(int port, int configid)
+{
+  /* Here we are composing the configuration of the usb composite device.
+   *
+   * The standard is to use one CDC/ACM and one USB mass storage device.
+   */
+
+  if (configid == 0)
+    {
+      struct composite_devdesc_s dev[2];
+      int ifnobase = 0;
+      int strbase  = COMPOSITE_NSTRIDS;
+      int n = 0;
+
+#ifdef CONFIG_USBMSC_COMPOSITE
+      /* Configure the mass storage device device */
+
+      /* Ask the usbmsc driver to fill in the constants we didn't
+       * know here.
+       */
+
+      usbmsc_get_composite_devdesc(&dev[n]);
+
+      /* Overwrite and correct some values... */
+
+      /* The callback functions for the USBMSC class */
+
+      dev[n].classobject  = board_mscclassobject;
+      dev[n].uninitialize = board_mscuninitialize;
+
+      /* Interfaces */
+
+      dev[n].devinfo.ifnobase = ifnobase;               /* Offset to Interface-IDs */
+      dev[n].minor = 0;                                 /* The minor interface number */
+
+      /* Strings */
+
+      dev[n].devinfo.strbase = strbase;                 /* Offset to String Numbers */
+
+      /* Endpoints */
+
+      dev[n].devinfo.epno[USBMSC_EP_BULKIN_IDX]  = 1;
+      dev[n].devinfo.epno[USBMSC_EP_BULKOUT_IDX] = 2;
+
+      /* Count up the base numbers */
+
+      ifnobase += dev[n].devinfo.ninterfaces;
+      strbase  += dev[n].devinfo.nstrings;
+      n++;
+#endif
+
+#ifdef CONFIG_CDCACM_COMPOSITE
+      /* Configure the CDC/ACM device */
+
+      /* Ask the cdcacm driver to fill in the constants we didn't
+       * know here.
+       */
+
+      cdcacm_get_composite_devdesc(&dev[n]);
+
+      /* Overwrite and correct some values... */
+
+      /* The callback functions for the CDC/ACM class */
+
+      dev[n].classobject  = cdcacm_classobject;
+      dev[n].uninitialize = cdcacm_uninitialize;
+
+      /* Interfaces */
+
+      dev[n].devinfo.ifnobase = ifnobase;             /* Offset to Interface-IDs */
+      dev[n].minor = 0;                               /* The minor interface number */
+
+      /* Strings */
+
+      dev[n].devinfo.strbase = strbase;               /* Offset to String Numbers */
+
+      /* Endpoints */
+
+      dev[n].devinfo.epno[CDCACM_EP_INTIN_IDX]   = 3;
+      dev[n].devinfo.epno[CDCACM_EP_BULKIN_IDX]  = 4;
+      dev[n].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = 5;
+      n++;
+#endif
+
+      return composite_initialize(n, dev);
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */
diff --git a/boards/arm/rp2040/common/src/rp2040_usbmsc.c b/boards/arm/rp2040/common/src/rp2040_usbmsc.c
new file mode 100644
index 0000000..401f8f5
--- /dev/null
+++ b/boards/arm/rp2040/common/src/rp2040_usbmsc.c
@@ -0,0 +1,61 @@
+/****************************************************************************
+ * boards/arm/rp2040/common/src/rp2040_usbmsc.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 <stdio.h>
+#include <syslog.h>
+#include <errno.h>
+
+#include <nuttx/board.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_usbmsc_initialize
+ *
+ * Description:
+ *   Perform architecture specific initialization as needed to establish
+ *   the mass storage device that will be exported by the USB MSC device.
+ *
+ ****************************************************************************/
+
+int board_usbmsc_initialize(int port)
+{
+  /* If system/usbmsc is built as an NSH command, then SD slot should
+   * already have been initialized in board_app_initialize()
+   * (see stm32_appinit.c).
+   * In this case, there is nothing further to be done here.
+   */
+
+  return OK;
+}
diff --git a/boards/arm/rp2040/raspberrypi-pico/README.txt b/boards/arm/rp2040/raspberrypi-pico/README.txt
index 23fa5f8..1126568 100644
--- a/boards/arm/rp2040/raspberrypi-pico/README.txt
+++ b/boards/arm/rp2040/raspberrypi-pico/README.txt
@@ -13,6 +13,9 @@ Currently only the following devices are suppored.
   - I2C
   - SPI
   - DMAC
+  - USB device
+    - MSC, CDC/ACM serial and these composite device are supported.
+    - CDC/ACM serial device can be used for the console.
   - PIO (RP2040 Programmable I/O)
   - Flash ROM Boot
   - SRAM Boot
@@ -56,6 +59,10 @@ Installation
 5. To access the console, GPIO 0 and 1 pins must be connected to the
    device such as USB-serial converter.
 
+   `usbnsh` configuration provides the console access by USB CDC/ACM serial
+   devcice.  The console is available by using a terminal software on the USB
+   host.
+
 Defconfigs
 ==========
 
@@ -118,6 +125,19 @@ Defconfigs
       https://shop.pimoroni.com/products/pico-audio-pack
     SD card interface is also enabled.
 
+- usbnsh
+    USB CDC/ACM serial console with NuttShell
+
+- usbmsc
+    USB MSC and CDC/ACM support
+    `msconn` and `sercon` commands enable the MSC and CDC/ACM devices.
+    The MSC support provides the interface to the SD card with SPI,
+    so the SD card slot connection like spisd configuraion is requied.
+
+- composite
+    USB composite device (MSC + CDC/ACM) support
+    `conn` command enables the composite device.
+
 License exceptions
 ==================
 
diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig
similarity index 56%
copy from boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
copy to boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig
index ea72069..31ccd3d 100644
--- a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
+++ b/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig
@@ -5,19 +5,17 @@
 # You can then do "make savedefconfig" to generate a new defconfig file that includes your
 # modifications.
 #
-# CONFIG_EXAMPLES_NXLINES_DEFAULT_COLORS is not set
 # CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
 # CONFIG_LIBC_LONG_LONG is not set
+# CONFIG_MMCSD_HAVE_CARDDETECT is not set
+# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
 # CONFIG_NSH_ARGCAT is not set
 # CONFIG_NSH_CMDOPT_HEXDUMP is not set
 # CONFIG_NSH_DISABLE_DATE is not set
 # CONFIG_NSH_DISABLE_LOSMART is not set
 # CONFIG_NSH_DISABLE_PRINTF is not set
 # CONFIG_NSH_DISABLE_TRUNCATE is not set
-# CONFIG_NXFONTS_DISABLE_16BPP is not set
-# CONFIG_NX_DISABLE_16BPP is not set
-# CONFIG_NX_PACKEDMSFIRST is not set
-# CONFIG_NX_WRITEONLY is not set
+# CONFIG_SPI_CALLBACK is not set
 # CONFIG_STANDARD_SERIAL is not set
 CONFIG_ARCH="arm"
 CONFIG_ARCH_BOARD="raspberrypi-pico"
@@ -29,70 +27,52 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARDCTL_RESET=y
 CONFIG_BOARD_LOOPSPERMSEC=10450
 CONFIG_BUILTIN=y
-CONFIG_DEBUG_ASSERTIONS=y
-CONFIG_DEBUG_FEATURES=y
+CONFIG_CDCACM=y
+CONFIG_CDCACM_COMPOSITE=y
+CONFIG_COMPOSITE_IAD=y
+CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS=y
+CONFIG_COMPOSITE_PRODUCTID=0x2022
+CONFIG_COMPOSITE_SERIALSTR="12345"
+CONFIG_COMPOSITE_VENDORID=0x03eb
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DISABLE_POSIX_TIMERS=y
-CONFIG_DRIVERS_VIDEO=y
-CONFIG_EXAMPLES_FB=y
 CONFIG_EXAMPLES_HELLO=y
-CONFIG_EXAMPLES_NX=y
-CONFIG_EXAMPLES_NXDEMO=y
-CONFIG_EXAMPLES_NXDEMO_BPP=16
-CONFIG_EXAMPLES_NXHELLO=y
-CONFIG_EXAMPLES_NXHELLO_BPP=16
-CONFIG_EXAMPLES_NXLINES=y
-CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
-CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
-CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
-CONFIG_EXAMPLES_NXLINES_BPP=16
-CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
-CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
-CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_USBSERIAL=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FS_FAT=y
 CONFIG_FS_PROCFS=y
 CONFIG_FS_PROCFS_REGISTER=y
-CONFIG_I2C=y
-CONFIG_LCD=y
-CONFIG_LCD_DEV=y
-CONFIG_LCD_FRAMEBUFFER=y
-CONFIG_LCD_MAXCONTRAST=255
-CONFIG_LCD_NOGETRUN=y
-CONFIG_LCD_ST7789=y
-CONFIG_LCD_ST7789_FREQUENCY=64000000
-CONFIG_LCD_ST7789_XOFFSET=53
-CONFIG_LCD_ST7789_XRES=135
-CONFIG_LCD_ST7789_YOFFSET=40
-CONFIG_LCD_ST7789_YRES=240
 CONFIG_MAX_TASKS=8
-CONFIG_MQ_MAXMSGSIZE=64
+CONFIG_MMCSD=y
 CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_READLINE=y
-CONFIG_NX=y
-CONFIG_NXFONTS_PACKEDMSFIRST=y
-CONFIG_NXFONT_SANS40X49B=y
-CONFIG_NX_BLOCKING=y
 CONFIG_RAM_SIZE=270336
 CONFIG_RAM_START=0x20000000
 CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_RP2040_SPI0=y
 CONFIG_RP2040_SPI0_GPIO=16
 CONFIG_RP2040_SPI=y
+CONFIG_RP2040_SPISD=y
 CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_WAITPID=y
 CONFIG_SDCLONE_DISABLE=y
-CONFIG_SPI_CMDDATA=y
 CONFIG_START_DAY=9
 CONFIG_START_MONTH=2
 CONFIG_START_YEAR=2021
-CONFIG_SYSLOG_CONSOLE=y
-CONFIG_SYSTEM_I2CTOOL=y
+CONFIG_SYSTEM_COMPOSITE=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_SYSTEM_SPITOOL=y
 CONFIG_TESTING_GETPRIME=y
 CONFIG_TESTING_OSTEST=y
 CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USBDEV=y
+CONFIG_USBDEV_BUSPOWERED=y
+CONFIG_USBDEV_COMPOSITE=y
+CONFIG_USBMSC=y
+CONFIG_USBMSC_COMPOSITE=y
+CONFIG_USBMSC_NOT_STALL_BULKEP=y
 CONFIG_USER_ENTRYPOINT="nsh_main"
-CONFIG_VIDEO_FB=y
diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
index ea72069..6a2e8f7 100644
--- a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
+++ b/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
@@ -5,6 +5,7 @@
 # You can then do "make savedefconfig" to generate a new defconfig file that includes your
 # modifications.
 #
+# CONFIG_DEV_CONSOLE is not set
 # CONFIG_EXAMPLES_NXLINES_DEFAULT_COLORS is not set
 # CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
 # CONFIG_LIBC_LONG_LONG is not set
@@ -29,6 +30,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARDCTL_RESET=y
 CONFIG_BOARD_LOOPSPERMSEC=10450
 CONFIG_BUILTIN=y
+CONFIG_CDCACM=y
+CONFIG_CDCACM_CONSOLE=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FULLOPT=y
@@ -70,6 +73,7 @@ CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_READLINE=y
+CONFIG_NSH_USBCONSOLE=y
 CONFIG_NX=y
 CONFIG_NXFONTS_PACKEDMSFIRST=y
 CONFIG_NXFONT_SANS40X49B=y
@@ -87,12 +91,12 @@ CONFIG_SPI_CMDDATA=y
 CONFIG_START_DAY=9
 CONFIG_START_MONTH=2
 CONFIG_START_YEAR=2021
-CONFIG_SYSLOG_CONSOLE=y
 CONFIG_SYSTEM_I2CTOOL=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_SYSTEM_SPITOOL=y
 CONFIG_TESTING_GETPRIME=y
 CONFIG_TESTING_OSTEST=y
-CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USBDEV=y
+CONFIG_USBDEV_BUSPOWERED=y
 CONFIG_USER_ENTRYPOINT="nsh_main"
 CONFIG_VIDEO_FB=y
diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig
similarity index 56%
copy from boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
copy to boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig
index ea72069..bfbe296 100644
--- a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
+++ b/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig
@@ -5,19 +5,17 @@
 # You can then do "make savedefconfig" to generate a new defconfig file that includes your
 # modifications.
 #
-# CONFIG_EXAMPLES_NXLINES_DEFAULT_COLORS is not set
 # CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
 # CONFIG_LIBC_LONG_LONG is not set
+# CONFIG_MMCSD_HAVE_CARDDETECT is not set
+# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
 # CONFIG_NSH_ARGCAT is not set
 # CONFIG_NSH_CMDOPT_HEXDUMP is not set
 # CONFIG_NSH_DISABLE_DATE is not set
 # CONFIG_NSH_DISABLE_LOSMART is not set
 # CONFIG_NSH_DISABLE_PRINTF is not set
 # CONFIG_NSH_DISABLE_TRUNCATE is not set
-# CONFIG_NXFONTS_DISABLE_16BPP is not set
-# CONFIG_NX_DISABLE_16BPP is not set
-# CONFIG_NX_PACKEDMSFIRST is not set
-# CONFIG_NX_WRITEONLY is not set
+# CONFIG_SPI_CALLBACK is not set
 # CONFIG_STANDARD_SERIAL is not set
 CONFIG_ARCH="arm"
 CONFIG_ARCH_BOARD="raspberrypi-pico"
@@ -29,70 +27,45 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARDCTL_RESET=y
 CONFIG_BOARD_LOOPSPERMSEC=10450
 CONFIG_BUILTIN=y
-CONFIG_DEBUG_ASSERTIONS=y
-CONFIG_DEBUG_FEATURES=y
+CONFIG_CDCACM=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DISABLE_POSIX_TIMERS=y
-CONFIG_DRIVERS_VIDEO=y
-CONFIG_EXAMPLES_FB=y
 CONFIG_EXAMPLES_HELLO=y
-CONFIG_EXAMPLES_NX=y
-CONFIG_EXAMPLES_NXDEMO=y
-CONFIG_EXAMPLES_NXDEMO_BPP=16
-CONFIG_EXAMPLES_NXHELLO=y
-CONFIG_EXAMPLES_NXHELLO_BPP=16
-CONFIG_EXAMPLES_NXLINES=y
-CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
-CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
-CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
-CONFIG_EXAMPLES_NXLINES_BPP=16
-CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
-CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
-CONFIG_EXAMPLES_NX_BPP=16
+CONFIG_EXAMPLES_USBSERIAL=y
+CONFIG_FAT_LCNAMES=y
+CONFIG_FAT_LFN=y
+CONFIG_FS_FAT=y
 CONFIG_FS_PROCFS=y
 CONFIG_FS_PROCFS_REGISTER=y
-CONFIG_I2C=y
-CONFIG_LCD=y
-CONFIG_LCD_DEV=y
-CONFIG_LCD_FRAMEBUFFER=y
-CONFIG_LCD_MAXCONTRAST=255
-CONFIG_LCD_NOGETRUN=y
-CONFIG_LCD_ST7789=y
-CONFIG_LCD_ST7789_FREQUENCY=64000000
-CONFIG_LCD_ST7789_XOFFSET=53
-CONFIG_LCD_ST7789_XRES=135
-CONFIG_LCD_ST7789_YOFFSET=40
-CONFIG_LCD_ST7789_YRES=240
 CONFIG_MAX_TASKS=8
-CONFIG_MQ_MAXMSGSIZE=64
+CONFIG_MMCSD=y
 CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_READLINE=y
-CONFIG_NX=y
-CONFIG_NXFONTS_PACKEDMSFIRST=y
-CONFIG_NXFONT_SANS40X49B=y
-CONFIG_NX_BLOCKING=y
 CONFIG_RAM_SIZE=270336
 CONFIG_RAM_START=0x20000000
 CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_RP2040_SPI0=y
 CONFIG_RP2040_SPI0_GPIO=16
 CONFIG_RP2040_SPI=y
+CONFIG_RP2040_SPISD=y
 CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_WAITPID=y
 CONFIG_SDCLONE_DISABLE=y
-CONFIG_SPI_CMDDATA=y
 CONFIG_START_DAY=9
 CONFIG_START_MONTH=2
 CONFIG_START_YEAR=2021
-CONFIG_SYSLOG_CONSOLE=y
-CONFIG_SYSTEM_I2CTOOL=y
+CONFIG_SYSTEM_CDCACM=y
 CONFIG_SYSTEM_NSH=y
 CONFIG_SYSTEM_SPITOOL=y
+CONFIG_SYSTEM_USBMSC=y
 CONFIG_TESTING_GETPRIME=y
 CONFIG_TESTING_OSTEST=y
 CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USBDEV=y
+CONFIG_USBDEV_BUSPOWERED=y
+CONFIG_USBMSC=y
+CONFIG_USBMSC_NOT_STALL_BULKEP=y
 CONFIG_USER_ENTRYPOINT="nsh_main"
-CONFIG_VIDEO_FB=y
diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig
similarity index 51%
copy from boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
copy to boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig
index ea72069..89de2d2 100644
--- a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig
+++ b/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig
@@ -5,7 +5,7 @@
 # You can then do "make savedefconfig" to generate a new defconfig file that includes your
 # modifications.
 #
-# CONFIG_EXAMPLES_NXLINES_DEFAULT_COLORS is not set
+# CONFIG_DEV_CONSOLE is not set
 # CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
 # CONFIG_LIBC_LONG_LONG is not set
 # CONFIG_NSH_ARGCAT is not set
@@ -14,11 +14,7 @@
 # CONFIG_NSH_DISABLE_LOSMART is not set
 # CONFIG_NSH_DISABLE_PRINTF is not set
 # CONFIG_NSH_DISABLE_TRUNCATE is not set
-# CONFIG_NXFONTS_DISABLE_16BPP is not set
-# CONFIG_NX_DISABLE_16BPP is not set
-# CONFIG_NX_PACKEDMSFIRST is not set
-# CONFIG_NX_WRITEONLY is not set
-# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_RP2040_UART0 is not set
 CONFIG_ARCH="arm"
 CONFIG_ARCH_BOARD="raspberrypi-pico"
 CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
@@ -29,70 +25,32 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARDCTL_RESET=y
 CONFIG_BOARD_LOOPSPERMSEC=10450
 CONFIG_BUILTIN=y
-CONFIG_DEBUG_ASSERTIONS=y
-CONFIG_DEBUG_FEATURES=y
+CONFIG_CDCACM=y
+CONFIG_CDCACM_CONSOLE=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DISABLE_POSIX_TIMERS=y
-CONFIG_DRIVERS_VIDEO=y
-CONFIG_EXAMPLES_FB=y
 CONFIG_EXAMPLES_HELLO=y
-CONFIG_EXAMPLES_NX=y
-CONFIG_EXAMPLES_NXDEMO=y
-CONFIG_EXAMPLES_NXDEMO_BPP=16
-CONFIG_EXAMPLES_NXHELLO=y
-CONFIG_EXAMPLES_NXHELLO_BPP=16
-CONFIG_EXAMPLES_NXLINES=y
-CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
-CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
-CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
-CONFIG_EXAMPLES_NXLINES_BPP=16
-CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
-CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
-CONFIG_EXAMPLES_NX_BPP=16
 CONFIG_FS_PROCFS=y
 CONFIG_FS_PROCFS_REGISTER=y
-CONFIG_I2C=y
-CONFIG_LCD=y
-CONFIG_LCD_DEV=y
-CONFIG_LCD_FRAMEBUFFER=y
-CONFIG_LCD_MAXCONTRAST=255
-CONFIG_LCD_NOGETRUN=y
-CONFIG_LCD_ST7789=y
-CONFIG_LCD_ST7789_FREQUENCY=64000000
-CONFIG_LCD_ST7789_XOFFSET=53
-CONFIG_LCD_ST7789_XRES=135
-CONFIG_LCD_ST7789_YOFFSET=40
-CONFIG_LCD_ST7789_YRES=240
 CONFIG_MAX_TASKS=8
-CONFIG_MQ_MAXMSGSIZE=64
 CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
 CONFIG_NSH_READLINE=y
-CONFIG_NX=y
-CONFIG_NXFONTS_PACKEDMSFIRST=y
-CONFIG_NXFONT_SANS40X49B=y
-CONFIG_NX_BLOCKING=y
+CONFIG_NSH_USBCONSOLE=y
 CONFIG_RAM_SIZE=270336
 CONFIG_RAM_START=0x20000000
 CONFIG_READLINE_CMD_HISTORY=y
-CONFIG_RP2040_SPI0=y
-CONFIG_RP2040_SPI0_GPIO=16
-CONFIG_RP2040_SPI=y
 CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_WAITPID=y
 CONFIG_SDCLONE_DISABLE=y
-CONFIG_SPI_CMDDATA=y
 CONFIG_START_DAY=9
 CONFIG_START_MONTH=2
 CONFIG_START_YEAR=2021
-CONFIG_SYSLOG_CONSOLE=y
-CONFIG_SYSTEM_I2CTOOL=y
 CONFIG_SYSTEM_NSH=y
-CONFIG_SYSTEM_SPITOOL=y
 CONFIG_TESTING_GETPRIME=y
 CONFIG_TESTING_OSTEST=y
-CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_USBDEV=y
+CONFIG_USBDEV_BUSPOWERED=y
 CONFIG_USER_ENTRYPOINT="nsh_main"
-CONFIG_VIDEO_FB=y