Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ NuttShell configuration (console enabled in UART0, at 115200 bps) with support f
CDC/ACM with MSC USB composite driver. ``conn`` command enables the composite
device.

fastboot_usb
------------

Runs the USB fastboot daemon (``fastbootd``) on boot instead of NSH, exposed
as a USB composite device together with CDC/ACM (console enabled in USB
Port, at 115200 bps). On the host, ``fastboot devices``, ``fastboot getvar
<var>``, and ``fastboot reboot``/``fastboot reboot bootloader`` are
available. More details about the fastboot daemon are available at
`fastbootd — NuttX latest documentation
<https://nuttx.apache.org/docs/latest/applications/system/fastboot/index.html>`_.

nsh
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ the ``nuttx`` directory (again, consult the main :doc:`RP2040 documentation

$ ./tools/configure.sh waveshare-rp2040-zero:<configname>

fastboot_usb
------------

Runs the USB fastboot daemon (``fastbootd``) on boot instead of NSH, exposed
as a USB composite device together with CDC/ACM (console enabled in USB
Port, at 115200 bps). On the host, ``fastboot devices``, ``fastboot getvar
<var>``, and ``fastboot reboot``/``fastboot reboot bootloader`` are
available. More details about the fastboot daemon are available at
`fastbootd — NuttX latest documentation
<https://nuttx.apache.org/docs/latest/applications/system/fastboot/index.html>`_.

gpio
--------

Expand Down
20 changes: 14 additions & 6 deletions arch/arm/src/rp2040/rp2040_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,11 +1247,11 @@ static void rp2040_ep0setup(struct rp2040_usbdev_s *priv)
break;

case USB_REQ_SYNCHFRAME:
/* type: device-to-host; recipient = endpoint
* value: 0
* index: endpoint;
* len: 2; data = frame number
*/
/* type: device-to-host; recipient = endpoint
* value: 0
* index: endpoint;
* len: 2; data = frame number
*/

{
usbtrace(TRACE_INTDECODE(RP2040_TRACEINTID_SYNCHFRAME), 0);
Expand Down Expand Up @@ -1497,7 +1497,8 @@ static int rp2040_usbinterrupt(int irq, void *context, void *arg)
if (stat & RP2040_USBCTRL_REGS_INTR_BUFF_STATUS)
{
while (rp2040_usbintr_buffstat(priv))
;
{
}
}

if (stat & RP2040_USBCTRL_REGS_INTR_SETUP_REQ)
Expand Down Expand Up @@ -1972,6 +1973,13 @@ static struct usbdev_ep_s *rp2040_allocep(struct usbdev_s *dev,

usbtrace(TRACE_DEVALLOCEP, (uint16_t)eplog);

/* Some callers (e.g. usbdev_fs.c) pass a bare endpoint number in eplog
* and rely solely on 'in' for direction, so make eplog agree with 'in'
* before it is used by RP2040_EPINDEX()/RP2040_DPINDEX() below.
*/

eplog = in ? (USB_EPNO(eplog) | USB_DIR_IN) : USB_EPNO(eplog);
Comment thread
xiaoxiang781216 marked this conversation as resolved.

/* Ignore any direction bits in the logical address */

epphy = USB_EPNO(eplog);
Expand Down
45 changes: 44 additions & 1 deletion boards/arm/rp2040/common/src/rp2040_composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/cdcacm.h>
#include <nuttx/usb/usbmsc.h>
#include <nuttx/usb/adb.h>
#include <nuttx/usb/composite.h>

#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE)
Expand Down Expand Up @@ -192,7 +193,7 @@ void *board_composite_connect(int port, int configid)

if (configid == 0)
{
struct composite_devdesc_s dev[2];
struct composite_devdesc_s dev[3];
int ifnobase = 0;
int strbase = COMPOSITE_NSTRIDS;
int n = 0;
Expand Down Expand Up @@ -264,6 +265,48 @@ void *board_composite_connect(int port, int configid)
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;

/* Count up the base numbers. This used to be omitted here because
* CDC/ACM was always the last device in the composite; now that
* USB ADB/fastboot may follow it, the offsets must be propagated.
*/

ifnobase += dev[n].devinfo.ninterfaces;
strbase += dev[n].devinfo.nstrings;
n++;
#endif

#ifdef CONFIG_USBADB
/* Configure the USB ADB/fastboot device. With CONFIG_USBFASTBOOT
* selected this same driver exposes /dev/fastboot instead of
* /dev/adb0, so a single "fastboot" personality composite with
* CDC/ACM (console) is supported without any additional glue.
*/

/* Ask the adb/fastboot driver to fill in the constants we didn't
* know here.
*/

usbdev_adb_get_composite_devdesc(&dev[n]);

/* 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[USBADB_EP_BULKIN_IDX] = 6;
dev[n].devinfo.epno[USBADB_EP_BULKOUT_IDX] = 7;

/* Count up the base numbers */

ifnobase += dev[n].devinfo.ninterfaces;
strbase += dev[n].devinfo.nstrings;
n++;
#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="waveshare-rp2040-lcd-1.28"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_WAVESHARE_RP2040_LCD_1_28=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_COMPOSITE=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_COMPOSITE_PRODUCTID=0x2023
CONFIG_COMPOSITE_PRODUCTSTR="NuttX Fastboot Composite"
CONFIG_COMPOSITE_SERIALSTR="fastboot0"
CONFIG_COMPOSITE_VENDORID=0x03eb
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="fastbootd_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSTEM_FASTBOOTD=y
CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y
CONFIG_USBADB=y
CONFIG_USBADB_COMPOSITE=y
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_COMPOSITE=y
CONFIG_USBFASTBOOT=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="waveshare-rp2040-zero"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_WAVESHARE_RP2040_ZERO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_COMPOSITE=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_COMPOSITE_PRODUCTID=0x2023
CONFIG_COMPOSITE_PRODUCTSTR="NuttX Fastboot Composite"
CONFIG_COMPOSITE_SERIALSTR="fastboot0"
CONFIG_COMPOSITE_VENDORID=0x03eb
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="fastbootd_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSTEM_FASTBOOTD=y
CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL=y
CONFIG_USBADB=y
CONFIG_USBADB_COMPOSITE=y
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_COMPOSITE=y
CONFIG_USBFASTBOOT=y
Loading