mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
Add configs/stm32f4discovery/usbnsh
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5572 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -4045,4 +4045,7 @@
|
||||
is started. This can be used to schedule C++ constructors to run
|
||||
automatically in the context of the new task.
|
||||
* binfmt/binfmt_execmodule: Execute constructors as a start hook.
|
||||
* sched/os_start.c: Fix ordering of group initialization.
|
||||
* configs/stm32f4discovery/usbnsh: Add an NSH STM32F4Discovery
|
||||
configuration that uses USB CDC/ACM for the NSH console.
|
||||
|
||||
|
||||
@@ -1473,6 +1473,56 @@ Where <subdir> is one of the following:
|
||||
3. By default, this project assumes that you are *NOT* using the DFU
|
||||
bootloader.
|
||||
|
||||
usbnsh:
|
||||
-------
|
||||
|
||||
This is another NSH example. If differs from other 'nsh' configurations
|
||||
in that this configurations uses a USB serial device for console I/O.
|
||||
Such a configuration is useful on the stm32f4discovery which has no
|
||||
builtin RS-232 drivers.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration uses the mconf-based configuration tool. To
|
||||
change this configuration using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
and misc/tools/
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. By default, this configuration uses the CodeSourcery toolchain
|
||||
for Windows and builds under Cygwin (or probably MSYS). That
|
||||
can easily be reconfigured, of course.
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Builds under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
|
||||
3. This configuration does have UART2 output enabled and set up as
|
||||
the system logging device:
|
||||
|
||||
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" : UART2 will be /dev/ttyS0
|
||||
|
||||
Debug, however, is not enable so in the default configuration nothing
|
||||
should appear on UART2 unless you enable some debug output.
|
||||
|
||||
4. By default, this project assumes that you are *NOT* using the DFU
|
||||
bootloader.
|
||||
|
||||
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=y : Disable the CDC/ACM serial device class
|
||||
CONFIG_CDCACM_CONSOLE=y : 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
|
||||
|
||||
winbuild:
|
||||
--------
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
############################################################################
|
||||
# configs/stm32f4discovery/usbnsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013 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
|
||||
|
||||
LDSCRIPT = ld.script
|
||||
|
||||
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/$(LDSCRIPT)}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
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/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(ARCROSSDEV)ar rcs
|
||||
NM = $(ARCROSSDEV)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
|
||||
else
|
||||
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
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# configs/stm32f4discovery/usbnsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2013 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 RIDE
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the RIDE toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/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"
|
||||
|
||||
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||
# at those locations as well.
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/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}"
|
||||
+17
-1
@@ -154,6 +154,14 @@ menuconfig PL2303
|
||||
This logic emulates the Prolific PL2303 serial/USB converter
|
||||
|
||||
if PL2303
|
||||
|
||||
config PL2303_CONSOLE
|
||||
bool "PL2303 console device"
|
||||
default n
|
||||
---help---
|
||||
Register the USB device as /dev/console so that is will be used
|
||||
as the console device.
|
||||
|
||||
config PL2303_EPINTIN
|
||||
int "Logical endpoint numbers"
|
||||
default 1
|
||||
@@ -218,8 +226,16 @@ menuconfig CDCACM
|
||||
Enables USB Modem (CDC ACM) support
|
||||
|
||||
if CDCACM
|
||||
|
||||
config CDCACM_CONSOLE
|
||||
bool "CDC/ACM console device"
|
||||
default n
|
||||
---help---
|
||||
Register the USB device as /dev/console so that is will be used
|
||||
as the console device.
|
||||
|
||||
config CDCACM_COMPOSITE
|
||||
bool "CDCACM composite support"
|
||||
bool "CDC/ACM composite support"
|
||||
default n
|
||||
depends on USBDEV_COMPOSITE
|
||||
---help---
|
||||
|
||||
+13
-10
@@ -24,23 +24,26 @@ config SYSLOG
|
||||
---help---
|
||||
Enables generic system logging features.
|
||||
|
||||
config SYSLOG_DEVPATH
|
||||
string "System log device"
|
||||
default "/dev/syslog"
|
||||
depends on SYSLOG
|
||||
---help---
|
||||
The full path to the system logging device. For the RAMLOG SYSLOG device,
|
||||
this is normally "/dev/ramlog". For character SYSLOG devices, it should be
|
||||
some other existing character device (or file) supported by the configuration
|
||||
(such as "/dev/ttyS1")/
|
||||
if SYSLOG
|
||||
|
||||
config SYSLOG_CHAR
|
||||
bool "System log character device support"
|
||||
default y
|
||||
depends on SYSLOG
|
||||
---help---
|
||||
Enable the generic character device for the SYSLOG. The full path to the
|
||||
SYSLOG device is provided by SYSLOG_DEVPATH. A valid character device (or
|
||||
file) must exist at this path. It will by opened by syslog_initialize.
|
||||
|
||||
Do not enable more than one SYSLOG device.
|
||||
|
||||
config SYSLOG_DEVPATH
|
||||
string "System log device"
|
||||
default "/dev/syslog"
|
||||
depends on SYSLOG_CHAR
|
||||
---help---
|
||||
The full path to the system logging device. For the RAMLOG SYSLOG device,
|
||||
this is normally "/dev/ramlog". For character SYSLOG devices, it should be
|
||||
some other existing character device (or file) supported by the configuration
|
||||
(such as "/dev/ttyS1")/
|
||||
|
||||
endif
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ int syslog_initialize(void)
|
||||
{
|
||||
/* The inode was not found. In this case, we will attempt to re-open
|
||||
* the device repeatedly. The assumption is that the device path is
|
||||
* value but that the driver has not yet been registered.
|
||||
* valid but that the driver has not yet been registered.
|
||||
*/
|
||||
|
||||
g_sysdev.sl_state = SYSLOG_REOPEN;
|
||||
|
||||
@@ -38,8 +38,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/* This interface can only be used from within the kernel */
|
||||
|
||||
@@ -37,8 +37,11 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
+15
-8
@@ -327,6 +327,12 @@ void os_start(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate the IDLE group and suppress child status. */
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
(void)group_allocate(&g_idletcb);
|
||||
#endif
|
||||
|
||||
/* Initialize the interrupt handling subsystem (if included) */
|
||||
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
@@ -439,20 +445,21 @@ void os_start(void)
|
||||
lib_initialize();
|
||||
}
|
||||
|
||||
/* Create the IDLE group and suppress child status */
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
(void)group_allocate(&g_idletcb);
|
||||
(void)group_initialize(&g_idletcb);
|
||||
g_idletcb.group->tg_flags = GROUP_FLAG_NOCLDWAIT;
|
||||
#endif
|
||||
|
||||
/* Create stdout, stderr, stdin on the IDLE task. These will be
|
||||
* inherited by all of the threads created by the IDLE task.
|
||||
*/
|
||||
|
||||
(void)group_setupidlefiles(&g_idletcb);
|
||||
|
||||
/* Complete initialization of the IDLE group. Suppress retention
|
||||
* of child status in the IDLE group.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
(void)group_initialize(&g_idletcb);
|
||||
g_idletcb.group->tg_flags = GROUP_FLAG_NOCLDWAIT;
|
||||
#endif
|
||||
|
||||
/* Create initial tasks and bring-up the system */
|
||||
|
||||
(void)os_bringup();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <queue.h>
|
||||
|
||||
Reference in New Issue
Block a user