SAM4E-EK: Add an NSH configuration that uses a USB CDC/ACM console

This commit is contained in:
Gregory Nutt 2014-03-22 09:27:43 -06:00
parent 474ab5226d
commit a32e0e2b30
6 changed files with 1347 additions and 16 deletions

View File

@ -688,12 +688,18 @@ USB Full-Speed Device
CONFIG_SYSTEM_CDCACM=y : Enable an CDC/ACM example
CONFIG_SYSTEM_CDCACM_DEVMINOR=0 : Use /dev/ttyUSB0
NOTE: You cannot have both the CDC/ACM and the MSC class drivers enabled
simultaneously in the way described here. If you want to use both, then
you will need to consider a USB "composite" devices that support supports
both interfaces. There are no instructures here for setting up the USB
composite device, but there are other examples in the NuttX board support
directories that can be used for reference.
NOTES:
1. You cannot have both the CDC/ACM and the MSC class drivers enabled
simultaneously in the way described here. If you want to use both, then
you will need to consider a USB "composite" devices that support supports
both interfaces. There are no instructures here for setting up the USB
composite device, but there are other examples in the NuttX board support
directories that can be used for reference.
2. Linux supports the CDC/ACM driver out of the box. Windows, on the other
than requires that you first install a serial driver (a .inf file). There
are example .inf files for NuttX in the nuttx/configs/spark directories.
Debugging USB Device
--------------------
@ -1056,8 +1062,7 @@ Configurations
NOTES:
1. NSH built-in applications are supported. However, there are
no built-in applications built with the default configuration.
1. NSH built-in applications are supported.
Binary Formats:
CONFIG_BUILTIN=y : Enable support for built-in programs
@ -1106,15 +1111,28 @@ Configurations
reconfigured (See see the configuration settings and usage notes
above in the section entitled "AT25 Serial FLASH").
To mount the AT25 Serial FLASH as a FAT file system:
nsh>mount -t vfat /dev/mtdblock0 /mnt/at25
STATUS:
2014-3-14: The DMA-based SPI appears to be functional and can be used
to support a FAT file system on the AT25 Serial FLASH.
5. To use USB, see the instructions above under "USB Full-Speed Device."
5. USB device support is not enabled in this configuration by default.
To add USB device support to this configuration, see the instructions
above under "USB Full-Speed Device."
STATUS:
2014-3-21: USB support is under development and only partially
functional. Additional test and integration is required.
2014-3-21: USB support is under development and USB MSC support is
only partially functional. Additional test and integration
is required.
2014-3-22: USB seems to work properly (there are not obvious errors
in a USB bus capture. However, the AT25 does not mount
on either the Linux or Windows host. Since there are no
USB errors, this could only be an issue with the USB MSC
protocol (not likely) or with the FAT format on the AT25
serial FLASH (likely).
6. This configuration can be used to verify the touchscreen on on the
SAM4E-EK LCD. See the instructions above in the paragraph entitled
@ -1129,3 +1147,75 @@ Configurations
STATUS:
2014-3-21: The HSMCI SD card slot has not yet been tested.
usbnsh:
This is another NSH example. If differs from the 'nsh' configuration
in that this configurations uses a USB serial device for console I/O.
NOTES:
1. See the NOTES in the description of the nsh configuration. Those
notes all apply here as well.
2. The configuration differences between this configuration and the
nsh configuration is:
a. USB device support is enabled as described in the paragraph
entitled "USB Full-Speed Device",
b. The CDC/ACM serial class is enabled as described in the paragraph
"CDC/ACM Serial Device Class"
c. The serial console is disabled:
RTOS Features:
CONFIG_DEV_CONSOLE=n : No console at boot time
Driver Support -> USB Device Driver Support
CONFIG_UART0_SERIAL_CONSOLE=n : UART0 is not the console
CONFIG_NO_SERIAL_CONSOLE=y : There is no serial console
Driver Support -> USB Device Driver Support
CONFIG_CDCACM_CONSOLE=y : USB CDC/ACM console
d. Support for debug output on UART0 is provided as described in the
next note.
3. This configuration does have UART0 output enabled and set up as
the system logging device:
File Systems -> Advanced SYSLOG Features
CONFIG_SYSLOG=y : Enable output to syslog, not console
CONFIG_SYSLOG_CHAR=y : Use a character device for system logging
CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" : UART0 will be /dev/ttyS0
However, there is nothing to generate SYLOG output in the default
configuration so nothing should appear on UART0 unless you enable
some debug output or enable the USB monitor.
NOTE: Using the SYSLOG to get debug output has limitations. Among
those are that you cannot get debug output from interrupt handlers.
So, in particularly, debug output is not a useful way to debug the
USB device controller driver. Instead, use the USB monitor with
USB debug off and USB trace on (see below).
4. Enabling USB monitor SYSLOG output. See the paragraph entitle
" Debugging USB Device" for a summary of the configuration settings
needed to enable the USB monitor and get USB debug data out UART0.
5. By default, this configuration uses the CDC/ACM serial device to
provide the USB console. This works out-of-the-box for Linux.
Windows, on the other hand, will require a CDC/ACM device driver
(.inf file). There is a sample .inf file in the nuttx/configs/spark
directories.
5. Using the Prolifics PL2303 Emulation
You could also use the non-standard PL2303 serial device instead of
the standard CDC/ACM serial device by changing:
CONFIG_CDCACM=n : Disable the CDC/ACM serial device class
CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console
CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console

View File

@ -347,9 +347,9 @@ CONFIG_RR_INTERVAL=200
CONFIG_TASK_NAME_SIZE=0
# CONFIG_SCHED_HAVE_PARENT is not set
# CONFIG_JULIAN_TIME is not set
CONFIG_START_YEAR=2009
CONFIG_START_MONTH=9
CONFIG_START_DAY=21
CONFIG_START_YEAR=2014
CONFIG_START_MONTH=3
CONFIG_START_DAY=10
CONFIG_DEV_CONSOLE=y
# CONFIG_MUTEX_TYPES is not set
# CONFIG_PRIORITY_INHERITANCE is not set

View File

@ -0,0 +1,110 @@
############################################################################
# configs/sam4e-ek/usbnsh/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
#!/bin/bash
# configs/sam4e-ek/usbnsh/setenv.sh
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$_" = "$0" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
WD=`pwd`
if [ ! -x "setenv.sh" ]; then
echo "This script must be executed from the top-level NuttX build directory"
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then
export PATH_ORIG="${PATH}"
fi
# This is the Cygwin path to the location where I installed the Atmel GCC
# toolchain under Windows. You will also have to edit this if you install
# this toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"

View File

@ -1592,7 +1592,7 @@ Where <subdir> is one of the following:
those are that you cannot get debug output from interrupt handlers.
So, in particularly, debug output is not a useful way to debug the
USB device controller driver. Instead, use the USB monitor with
USB debug off and USB trance on (see below).
USB debug off and USB trace on (see below).
4. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB
device will save encoded trace output in in-memory buffer; if the