mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 01:04:19 +08:00
+18
-3
@@ -434,7 +434,7 @@
|
||||
tests will now use a relative path to the program and expect the binfmt/
|
||||
logic to find the absolute path to the program using the PATH variable.
|
||||
|
||||
6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
6.25 2013-02-01 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* Makefiles: Removed dependency of distclean on clean in most top-level
|
||||
files. It makes sense for 'leaf' Makefiles to have this dependency,
|
||||
@@ -461,7 +461,7 @@
|
||||
the USB HID keyboard report data.
|
||||
* apps/examples/wlan: Remove non-functional example.
|
||||
* apps/examples/ostest/vfork.c: Added a test of vfork().
|
||||
* apps/exampes/posix_spawn: Added a test of poxis_spawn().
|
||||
* apps/exampes/posix_spawn: Added a test of posix_spawn().
|
||||
* apps/examples/ostest: Extend signal handler test to catch
|
||||
death-of-child signals (SIGCHLD).
|
||||
* apps/examples/ostest/waitpid.c: Add a test for waitpid(), waitid(),
|
||||
@@ -478,7 +478,7 @@
|
||||
* apps/include/builtin.h: Some of the content of
|
||||
apps/include/apps.h moved to include/nuttx/binfmt/builtin.h.
|
||||
apps/include/apps.h renamed builtin.h
|
||||
* apps/builtin/exec_builtins.c: Move utility builtin
|
||||
* apps/builtin/exec_builtins.c: Move builtin
|
||||
utility functions from apps/builtin/exec_builtins.c to
|
||||
binfmt/libbuiltin/libbuiltin_utils.c
|
||||
* apps/nshlib/nsh_mountcmds.c: The block driver/source
|
||||
@@ -492,3 +492,18 @@
|
||||
the entrypoint. Should be ftpd_main (from Yan T.)
|
||||
* apps/netutils/telnetd/telnetd_driver: Was stuck in a loop if
|
||||
recv[from]() ever returned a value <= 0.
|
||||
* apps/examples/nettest and poll: Complete Kconfig files.
|
||||
* apps/examples/ostest/waitpid.c: Need to use WEXITSTATUS()
|
||||
to decode the correct exit status.
|
||||
* apps/system/usbmonitor: A daemon that can be used to monitor USB
|
||||
trace outpout.
|
||||
* apps/nshlib/nsh_usbdev.c, nsh_consolemain.c, nsh_session.c, nsh_script.c:
|
||||
Add support for a login script. The init.d/rcS script will be executed
|
||||
once when NSH starts; the .nshrc script will be executed for each session:
|
||||
Once for serial, once for each USB connection, once for each Telnet
|
||||
session.
|
||||
* apps/system/readline: Correct readline() return value. Was not
|
||||
any returning special values when end-of-file or read errors
|
||||
occur (it would return an empty string which is not very useful).
|
||||
|
||||
6.26 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -309,7 +309,7 @@ static inline int builtin_startproxy(int index, FAR const char **argv,
|
||||
{
|
||||
struct sched_param param;
|
||||
pid_t proxy;
|
||||
int errcode;
|
||||
int errcode = OK;
|
||||
#ifdef CONFIG_SCHED_WAITPID
|
||||
int status;
|
||||
#endif
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# define message lowsyslog
|
||||
# else
|
||||
# define message printf
|
||||
# endif
|
||||
|
||||
@@ -675,8 +675,8 @@ examples/mount
|
||||
when CONFIG_EXAMPLES_MOUNT_DEVNAME is not defined. The
|
||||
default is zero (meaning that "/dev/ram0" will be used).
|
||||
|
||||
examples/netttest
|
||||
^^^^^^^^^^^^^^^^^
|
||||
examples/nettest
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This is a simple network test for verifying client- and server-
|
||||
functionality in a TCP/IP connection.
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -82,7 +82,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -299,11 +299,11 @@ static void show_buttons(uint8_t oldset, uint8_t newset)
|
||||
state = "released";
|
||||
}
|
||||
|
||||
/* Use lib_lowprintf() because we make be executing from an
|
||||
/* Use lowsyslog() because we make be executing from an
|
||||
* interrupt handler.
|
||||
*/
|
||||
|
||||
lib_lowprintf(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
|
||||
lowsyslog(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,8 +313,8 @@ static void button_handler(int id, int irq)
|
||||
{
|
||||
uint8_t newset = up_buttons();
|
||||
|
||||
lib_lowprintf("IRQ:%d Button %d:%s SET:%02x:\n",
|
||||
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
||||
lowsyslog("IRQ:%d Button %d:%s SET:%02x:\n",
|
||||
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
||||
show_buttons(g_oldset, newset);
|
||||
g_oldset = newset;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ int buttons_main(int argc, char *argv[])
|
||||
{
|
||||
maxbuttons = strtol(argv[1], NULL, 10);
|
||||
}
|
||||
lib_lowprintf("maxbuttons: %d\n", maxbuttons);
|
||||
lowsyslog("maxbuttons: %d\n", maxbuttons);
|
||||
#endif
|
||||
|
||||
/* Initialize the button GPIOs */
|
||||
@@ -423,11 +423,11 @@ int buttons_main(int argc, char *argv[])
|
||||
{
|
||||
xcpt_t oldhandler = up_irqbutton(i, g_buttoninfo[BUTTON_INDEX(i)].handler);
|
||||
|
||||
/* Use lib_lowprintf() for compatibility with interrrupt handler output. */
|
||||
/* Use lowsyslog() for compatibility with interrrupt handler output. */
|
||||
|
||||
lib_lowprintf("Attached handler at %p to button %d [%s], oldhandler:%p\n",
|
||||
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
||||
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
||||
lowsyslog("Attached handler at %p to button %d [%s], oldhandler:%p\n",
|
||||
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
||||
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
||||
|
||||
/* Some hardware multiplexes different GPIO button sources to the same
|
||||
* physical interrupt. If we register multiple such multiplexed button
|
||||
@@ -438,9 +438,9 @@ int buttons_main(int argc, char *argv[])
|
||||
|
||||
if (oldhandler != NULL)
|
||||
{
|
||||
lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
|
||||
"Button events may be lost or aliased!\n",
|
||||
oldhandler);
|
||||
lowsyslog("WARNING: oldhandler:%p is not NULL! "
|
||||
"Button events may be lost or aliased!\n",
|
||||
oldhandler);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -468,11 +468,11 @@ int buttons_main(int argc, char *argv[])
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Use lib_lowprintf() for compatibility with interrrupt handler
|
||||
/* Use lowsyslog() for compatibility with interrrupt handler
|
||||
* output.
|
||||
*/
|
||||
|
||||
lib_lowprintf("POLL SET:%02x:\n", newset);
|
||||
lowsyslog("POLL SET:%02x:\n", newset);
|
||||
show_buttons(g_oldset, newset);
|
||||
g_oldset = newset;
|
||||
irqrestore(flags);
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -97,7 +97,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -120,7 +120,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# define message lowsyslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -43,8 +43,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/init.h>
|
||||
|
||||
#include "ostest.h"
|
||||
@@ -264,6 +267,31 @@ static int user_main(int argc, char *argv[])
|
||||
}
|
||||
check_test_memory_usage();
|
||||
|
||||
/* If retention of child status is enable, then suppress it for this task.
|
||||
* This task may produce many, many children (especially if
|
||||
* CONFIG_EXAMPLES_OSTEST_LOOPS) and it does not harvest their exit status.
|
||||
* As a result, the test may fail inappropriately unless retention of
|
||||
* child exit status is disabled.
|
||||
*
|
||||
* So basically, this tests that child status can be disabled, but cannot
|
||||
* verify that status is retained correctly.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
|
||||
{
|
||||
struct sigaction sa;
|
||||
int ret;
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sa.sa_flags = SA_NOCLDWAIT;
|
||||
ret = sigaction(SIGCHLD, &sa, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("user_main: ERROR: sigaction failed: %d\n", errno);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check environment variables */
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
show_environment(true, true, true);
|
||||
|
||||
@@ -113,14 +113,14 @@ static void waitpid_last(void)
|
||||
printf("waitpid_last: ERROR: PID %d waitpid failed: %d\n",
|
||||
g_waitpids[NCHILDREN-1], errcode);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_last: ERROR: PID %d return status is %d, expected %d\n",
|
||||
g_waitpids[NCHILDREN-1], stat_loc, RETURN_STATUS);
|
||||
g_waitpids[NCHILDREN-1], WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%04x\n",
|
||||
g_waitpids[NCHILDREN-1], stat_loc);
|
||||
}
|
||||
}
|
||||
@@ -155,14 +155,14 @@ int waitpid_test(void)
|
||||
printf("waitpid_test: ERROR: PID %d wait returned PID %d\n",
|
||||
g_waitpids[0], ret);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
|
||||
g_waitpids[0], stat_loc, RETURN_STATUS);
|
||||
g_waitpids[0], WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%04x\n",
|
||||
g_waitpids[0], stat_loc);
|
||||
}
|
||||
|
||||
@@ -246,14 +246,14 @@ int waitpid_test(void)
|
||||
int errcode = errno;
|
||||
printf("waitpid_test: ERROR: wait failed: %d\n", errcode);
|
||||
}
|
||||
else if (stat_loc != RETURN_STATUS)
|
||||
else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
|
||||
{
|
||||
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
|
||||
ret, stat_loc, RETURN_STATUS);
|
||||
ret, WEXITSTATUS(stat_loc), RETURN_STATUS);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("waitpid_test: PID %d wait succeeded with stat_loc=%d\n",
|
||||
printf("waitpid_test: PID %d wait succeeded with stat_loc=%04x\n",
|
||||
ret, stat_loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,26 @@
|
||||
config EXAMPLES_POLL
|
||||
bool "Poll example"
|
||||
default n
|
||||
depends on !NSH_BUILTIN_APPS
|
||||
---help---
|
||||
Enable the poll example
|
||||
|
||||
if EXAMPLES_POLL
|
||||
|
||||
config EXAMPLES_POLL_NOMAC
|
||||
bool "Use Canned MAC Address"
|
||||
default n
|
||||
|
||||
config EXAMPLES_POLL_IPADDR
|
||||
hex "Target IP address"
|
||||
default 0x0a000002
|
||||
|
||||
config EXAMPLES_POLL_DRIPADDR
|
||||
hex "Default Router IP address (Gateway)"
|
||||
default 0x0a000001
|
||||
|
||||
config EXAMPLES_POLL_NETMASK
|
||||
hex "Network Mask"
|
||||
default 0xffffff00
|
||||
|
||||
endif
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
# undef HAVE_NETPOLL
|
||||
#endif
|
||||
|
||||
/* If debug is enabled, then use lib_rawprintf so that OS debug output and
|
||||
/* If debug is enabled, then use syslog so that OS debug output and
|
||||
* the test output are synchronized.
|
||||
*
|
||||
* These macros will differ depending upon if the toolchain supports
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -88,7 +88,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -100,7 +100,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -85,7 +85,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) syslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -97,7 +97,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message syslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
+58
-13
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/include/nsh.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -45,6 +45,31 @@
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* If a USB device is selected for the NSH console then we need to handle some
|
||||
* special start-up conditions.
|
||||
*/
|
||||
|
||||
#undef HAVE_USB_CONSOLE
|
||||
#if defined(CONFIG_USBDEV)
|
||||
|
||||
/* Check for a PL2303 serial console. Use console device "/dev/console". */
|
||||
|
||||
# if defined(CONFIG_PL2303) && defined(CONFIG_PL2303_CONSOLE)
|
||||
# define HAVE_USB_CONSOLE 1
|
||||
|
||||
/* Check for a CDC/ACM serial console. Use console device "/dev/console". */
|
||||
|
||||
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
||||
# define HAVE_USB_CONSOLE 1
|
||||
|
||||
/* Check for a generic USB console. In this case, the USB console device
|
||||
* must be provided in CONFIG_NSH_CONDEV.
|
||||
*/
|
||||
|
||||
# elif defined(CONFIG_NSH_USBCONSOLE)
|
||||
# define HAVE_USB_CONSOLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
# define SCHED_NSH SCHED_RR
|
||||
@@ -58,7 +83,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
@@ -83,35 +109,54 @@ extern "C" {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nsh_initialize(void);
|
||||
void nsh_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_consolemain
|
||||
*
|
||||
* Description:
|
||||
* This interfaces maybe to called or started with task_start to start a
|
||||
* single an NSH instance that operates on stdin and stdout (/dev/console).
|
||||
* This function does not return.
|
||||
* single an NSH instance that operates on stdin and stdout. This
|
||||
* function does not return.
|
||||
*
|
||||
* This function handles generic /dev/console character devices, or
|
||||
* special USB console devices. The USB console requires some special
|
||||
* operations to handle the cases where the session is lost when the
|
||||
* USB device is unplugged and restarted when the USB device is plugged
|
||||
* in again.
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task start-up arguements. These are not used. argc may be
|
||||
* Standard task start-up arguments. These are not used. argc may be
|
||||
* zero and argv may be NULL.
|
||||
*
|
||||
* Returned Values:
|
||||
* This function does not normally return. exit() is usually called to
|
||||
* terminate the NSH session. This function will return in the event of
|
||||
* an error. In that case, a nonzero value is returned (1).
|
||||
* an error. In that case, a nonzero value is returned (EXIT_FAILURE=1).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int nsh_consolemain(int argc, char *argv[]);
|
||||
int nsh_consolemain(int argc, char *argv[]);
|
||||
|
||||
/* nsh_telnetstart() starts a telnet daemon that will allow multiple
|
||||
* NSH connections via telnet. This function returns immediately after
|
||||
* the daemon has been started.
|
||||
*/
|
||||
/****************************************************************************
|
||||
* Name: nsh_telnetstart
|
||||
*
|
||||
* Description:
|
||||
* nsh_telnetstart() starts the Telnet daemon that will allow multiple
|
||||
* NSH connections via Telnet. This function returns immediately after
|
||||
* the daemon has been started.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None. All of the properties of the Telnet daemon are controlled by
|
||||
* NuttX configuration setting.
|
||||
*
|
||||
* Returned Values:
|
||||
* The task ID of the Telnet daemon was successfully started. A negated
|
||||
* errno value will be returned on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int nsh_telnetstart(void);
|
||||
int nsh_telnetstart(void);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* eched/env_dupenv.c
|
||||
* apps/include/usbmonitor.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* 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
|
||||
@@ -33,80 +33,64 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_INCLUDE_USBMONITOR_H
|
||||
#define __APPS_INCLUDE_USBMONITOR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: dupenv
|
||||
*
|
||||
* Description:
|
||||
* Copy the internal environment structure of a task. This is the action
|
||||
* that is performed when a new task is created: The new task has a private,
|
||||
* exact duplicate of the parent task's environment.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* A pointer to a newly allocated copy of the specified TCB's environment
|
||||
* structure with reference count equal to one.
|
||||
*
|
||||
* Assumptions:
|
||||
* Not called from an interrupt handler.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR environ_t *dupenv(FAR _TCB *ptcb)
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
environ_t *envp = NULL;
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* Pre-emption must be disabled throughout the following because the
|
||||
* environment may be shared.
|
||||
*/
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
sched_lock();
|
||||
/****************************************************************************
|
||||
* Name: usbmon_start and usbmon_stop
|
||||
*
|
||||
* Start and top the USB monitor daemon. These are normally controlled
|
||||
* from the USB command line, but the ability to control these
|
||||
* programmatically is also helpful (for example, so that the daemon is
|
||||
* running before NSH starts).
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task parameters. These can be called or spawned. Since the
|
||||
* return almost immediately, it is fine to just call the functions. The
|
||||
* parameters are not used so you can pass 0 and NULL, respectivley; this
|
||||
* is done this way so that these functions can be NSH builtin
|
||||
* applications.
|
||||
*
|
||||
* Returned values:
|
||||
* Standard task return values (zero meaning success).
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Does the parent task have an environment? */
|
||||
int usbmonitor_start(int argc, char **argv);
|
||||
int usbmonitor_stop(int argc, char **argv);
|
||||
|
||||
if (ptcb->envp)
|
||||
{
|
||||
/* Yes..The parent task has an environment, duplicate it */
|
||||
|
||||
size_t envlen = ptcb->envp->ev_alloc
|
||||
envp = (environ_t*)kmalloc(SIZEOF_ENVIRON_T( envlen ));
|
||||
if (envp)
|
||||
{
|
||||
envp->ev_crefs = 1;
|
||||
envp->ev_alloc = envlen;
|
||||
memcmp( envp->ev_env, ptcb->envp->ev_env, envlen );
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
return envp;
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
#endif /* CONFIG_SYSTEM_USBMONITOR */
|
||||
#endif /* __APPS_INCLUDE_USBMONITOR_H */
|
||||
+39
-3
@@ -292,6 +292,19 @@ config NSH_ROMFSETC
|
||||
endif
|
||||
|
||||
if NSH_ROMFSETC
|
||||
|
||||
config NSH_ROMFSRC
|
||||
bool "Support ROMFS login script"
|
||||
default n
|
||||
---help---
|
||||
The ROMFS start-up script will be executed excactly once. For
|
||||
simple, persistence consoles (like a serial console). But with
|
||||
other other kinds of consoles, there may be multiple, transient
|
||||
sessions (such as Telnet and USB consoles). In these cases, you
|
||||
may need another script that is executed at the beginning of each
|
||||
session. Selecting this option enables support for such a login
|
||||
script
|
||||
|
||||
config NSH_ROMFSMOUNTPT
|
||||
string "ROMFS mount point"
|
||||
default "/etc"
|
||||
@@ -308,6 +321,15 @@ config NSH_INITSCRIPT
|
||||
The default is init.d/rcS. This is a relative path and must not
|
||||
start with '/'.
|
||||
|
||||
config NSH_RCSCRIPT
|
||||
string "Relative path to login script"
|
||||
default ".nshrc"
|
||||
depends on NSH_ROMFSRC
|
||||
---help---
|
||||
This is the relative path to the login script within the mountpoint.
|
||||
The default is .nshrc. This is a relative path and must not
|
||||
start with '/'.
|
||||
|
||||
config NSH_ROMFSDEVNO
|
||||
int "ROMFS block device minor number"
|
||||
default 0
|
||||
@@ -406,7 +428,7 @@ config NSH_USBCONDEV
|
||||
readable/write-able USB driver such as:
|
||||
NSH_USBCONDEV="/dev/ttyACM0".
|
||||
|
||||
config UBSDEV_MINOR
|
||||
config USBDEV_MINOR
|
||||
int "USB console device minor number"
|
||||
default 0
|
||||
depends on NSH_USBCONSOLE
|
||||
@@ -414,8 +436,22 @@ config UBSDEV_MINOR
|
||||
If there are more than one USB devices, then a USB device
|
||||
minor number may also need to be provided. Default: 0
|
||||
|
||||
menu "USB Trace Support"
|
||||
comment "USB Trace Support"
|
||||
config NSH_USBDEV_TRACE
|
||||
bool "Enable Builtin USB Trace Support"
|
||||
default n
|
||||
depends on USBDEV && (DEBUG || USBDEV_TRACE)
|
||||
---help---
|
||||
Enable builtin USB trace support in NSH. If selected, buffered USB
|
||||
trace data will be presented each time a command is provided to NSH.
|
||||
The USB trace data will be sent to the console unless DEBUG set or
|
||||
unless you are using a USB console. In those cases, the trace data
|
||||
will go to the SYSLOG device.
|
||||
|
||||
If not enabled, the USB trace support can be provided by external
|
||||
logic such as apps/system/usbmonitor.
|
||||
|
||||
if NSH_USBDEV_TRACE
|
||||
|
||||
config NSH_USBDEV_TRACEINIT
|
||||
bool "Show initialization events"
|
||||
@@ -447,7 +483,7 @@ config NSH_USBDEV_TRACEINTERRUPTS
|
||||
---help---
|
||||
Show interrupt-related events
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
config NSH_CONDEV
|
||||
bool "Default console device"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# apps/nshlib/Makefile
|
||||
#
|
||||
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,9 +39,10 @@ include $(APPDIR)/Make.defs
|
||||
|
||||
# NSH Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \
|
||||
nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c
|
||||
ASRCS =
|
||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c nsh_session.c
|
||||
CSRCS += nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c
|
||||
CSRCS += nsh_dbgcmds.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
CSRCS += nsh_builtin.c
|
||||
|
||||
@@ -1025,12 +1025,16 @@ NSH-Specific Configuration Settings
|
||||
If there are more than one USB devices, then a USB device
|
||||
minor number may also need to be provided:
|
||||
|
||||
CONFIG_NSH_UBSDEV_MINOR
|
||||
CONFIG_NSH_USBDEV_MINOR
|
||||
The minor device number of the USB device. Default: 0
|
||||
|
||||
If USB tracing is enabled (CONFIG_USBDEV_TRACE), then NSH will
|
||||
initialize USB tracing as requested by the following. Default:
|
||||
Only USB errors are traced.
|
||||
CONFIG_NSH_USBDEV_TRACE
|
||||
If USB tracing is enabled (CONFIG_USBDEV_TRACE), then NSH can
|
||||
be configured to show the buffered USB trace data afer each
|
||||
NSH command:
|
||||
|
||||
If CONFIG_NSH_USBDEV_TRACE is selected, then USB trace data
|
||||
can be filtered as follows. Default: Only USB errors are traced.
|
||||
|
||||
CONFIG_NSH_USBDEV_TRACEINIT
|
||||
Show initialization events
|
||||
|
||||
+80
-43
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh.h
|
||||
*
|
||||
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -93,7 +93,9 @@
|
||||
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
||||
# define HAVE_USB_CONSOLE 1
|
||||
|
||||
/* Check for other USB console. USB console device must be provided in CONFIG_NSH_CONDEV */
|
||||
/* Check for a generic USB console. In this case, the USB console device
|
||||
* must be provided in CONFIG_NSH_CONDEV.
|
||||
*/
|
||||
|
||||
# elif defined(CONFIG_NSH_USBCONSOLE)
|
||||
# define HAVE_USB_CONSOLE 1
|
||||
@@ -106,8 +108,8 @@
|
||||
|
||||
/* The default USB console device minor number is 0*/
|
||||
|
||||
# ifndef CONFIG_NSH_UBSDEV_MINOR
|
||||
# define CONFIG_NSH_UBSDEV_MINOR 0
|
||||
# ifndef CONFIG_NSH_USBDEV_MINOR
|
||||
# define CONFIG_NSH_USBDEV_MINOR 0
|
||||
# endif
|
||||
|
||||
/* The default console device is always /dev/console */
|
||||
@@ -118,43 +120,53 @@
|
||||
|
||||
/* USB trace settings */
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACEINIT
|
||||
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
||||
#else
|
||||
# define TRACE_INIT_BITS (0)
|
||||
#endif
|
||||
# ifndef CONFIG_USBDEV_TRACE
|
||||
# undef CONFIG_NSH_USBDEV_TRACE
|
||||
# endif
|
||||
|
||||
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACEINIT
|
||||
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
||||
# else
|
||||
# define TRACE_INIT_BITS (0)
|
||||
# endif
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACECLASS
|
||||
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT)
|
||||
#else
|
||||
# define TRACE_CLASS_BITS (0)
|
||||
#endif
|
||||
# define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACETRANSFERS
|
||||
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\
|
||||
TRACE_WRITE_BIT|TRACE_COMPLETE_BIT)
|
||||
#else
|
||||
# define TRACE_TRANSFER_BITS (0)
|
||||
#endif
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACECLASS
|
||||
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|\
|
||||
TRACE_CLASSSTATE_BIT)
|
||||
# else
|
||||
# define TRACE_CLASS_BITS (0)
|
||||
# endif
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACECONTROLLER
|
||||
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||
#else
|
||||
# define TRACE_CONTROLLER_BITS (0)
|
||||
#endif
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACETRANSFERS
|
||||
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|\
|
||||
TRACE_READ_BIT|TRACE_WRITE_BIT|\
|
||||
TRACE_COMPLETE_BIT)
|
||||
# else
|
||||
# define TRACE_TRANSFER_BITS (0)
|
||||
# endif
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACEINTERRUPTS
|
||||
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT)
|
||||
#else
|
||||
# define TRACE_INTERRUPT_BITS (0)
|
||||
#endif
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACECONTROLLER
|
||||
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||
# else
|
||||
# define TRACE_CONTROLLER_BITS (0)
|
||||
# endif
|
||||
|
||||
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\
|
||||
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||
# ifdef CONFIG_NSH_USBDEV_TRACEINTERRUPTS
|
||||
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|\
|
||||
TRACE_INTEXIT_BIT)
|
||||
# else
|
||||
# define TRACE_INTERRUPT_BITS (0)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
# define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|\
|
||||
TRACE_CLASS_BITS|TRACE_TRANSFER_BITS|\
|
||||
TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||
|
||||
# endif /* CONFIG_NSH_USBDEV_TRACE */
|
||||
#endif /* HAVE_USB_CONSOLE */
|
||||
|
||||
/* If Telnet is selected for the NSH console, then we must configure
|
||||
* the resources used by the Telnet daemon and by the Telnet clients.
|
||||
@@ -232,40 +244,59 @@
|
||||
# error "Mountpoint support is disabled"
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
|
||||
# if CONFIG_NFILE_DESCRIPTORS < 4
|
||||
# error "Not enough file descriptors"
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_FS_ROMFS
|
||||
# error "ROMFS support not enabled"
|
||||
# undef CONFIG_NSH_ROMFSETC
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_NSH_ROMFSMOUNTPT
|
||||
# define CONFIG_NSH_ROMFSMOUNTPT "/etc"
|
||||
# endif
|
||||
# ifdef CONFIG_NSH_INIT
|
||||
# ifndef CONFIG_NSH_INITSCRIPT
|
||||
# define CONFIG_NSH_INITSCRIPT "init.d/rcS"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_NSH_INITSCRIPT
|
||||
# define CONFIG_NSH_INITSCRIPT "init.d/rcS"
|
||||
# endif
|
||||
|
||||
# undef NSH_INITPATH
|
||||
# define NSH_INITPATH CONFIG_NSH_ROMFSMOUNTPT "/" CONFIG_NSH_INITSCRIPT
|
||||
|
||||
# ifdef CONFIG_NSH_ROMFSRC
|
||||
# ifndef CONFIG_NSH_RCSCRIPT
|
||||
# define CONFIG_NSH_RCSCRIPT ".nshrc"
|
||||
# endif
|
||||
|
||||
# undef NSH_RCPATH
|
||||
# define NSH_RCPATH CONFIG_NSH_ROMFSMOUNTPT "/" CONFIG_NSH_RCSCRIPT
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_NSH_ROMFSDEVNO
|
||||
# define CONFIG_NSH_ROMFSDEVNO 0
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_NSH_ROMFSSECTSIZE
|
||||
# define CONFIG_NSH_ROMFSSECTSIZE 64
|
||||
# endif
|
||||
|
||||
# define NSECTORS(b) (((b)+CONFIG_NSH_ROMFSSECTSIZE-1)/CONFIG_NSH_ROMFSSECTSIZE)
|
||||
# define STR_RAMDEVNO(m) #m
|
||||
# define MKMOUNT_DEVNAME(m) "/dev/ram" STR_RAMDEVNO(m)
|
||||
# define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_NSH_ROMFSDEVNO)
|
||||
|
||||
#else
|
||||
|
||||
# undef CONFIG_NSH_ROMFSRC
|
||||
# undef CONFIG_NSH_ROMFSMOUNTPT
|
||||
# undef CONFIG_NSH_INIT
|
||||
# undef CONFIG_NSH_INITSCRIPT
|
||||
# undef CONFIG_NSH_RCSCRIPT
|
||||
# undef CONFIG_NSH_ROMFSDEVNO
|
||||
# undef CONFIG_NSH_ROMFSSECTSIZE
|
||||
|
||||
#endif
|
||||
|
||||
/* This is the maximum number of arguments that will be accepted for a
|
||||
@@ -474,6 +505,12 @@ int nsh_usbconsole(void);
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path);
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
int nsh_initscript(FAR struct nsh_vtbl_s *vtbl);
|
||||
#ifdef CONFIG_NSH_ROMFSRC
|
||||
int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Architecture-specific initialization */
|
||||
@@ -484,8 +521,10 @@ int nsh_archinitialize(void);
|
||||
# define nsh_archinitialize() (-ENOSYS)
|
||||
#endif
|
||||
|
||||
/* Message handler */
|
||||
/* Basic session and message handling */
|
||||
|
||||
struct console_stdio_s;
|
||||
int nsh_session(FAR struct console_stdio_s *pstate);
|
||||
int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline);
|
||||
|
||||
/* Application interface */
|
||||
@@ -515,10 +554,8 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, const char *msg,
|
||||
|
||||
/* USB debug support */
|
||||
|
||||
#if defined(CONFIG_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
void nsh_usbtrace(void);
|
||||
#else
|
||||
# define nsh_usbtrace()
|
||||
#endif
|
||||
|
||||
/* Shell command handlers */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_consolemain.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -47,6 +47,8 @@
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
#ifndef HAVE_USB_CONSOLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -76,21 +78,25 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_consolemain
|
||||
* Name: nsh_consolemain (Normal character device version)
|
||||
*
|
||||
* Description:
|
||||
* This interfaces maybe to called or started with task_start to start a
|
||||
* single an NSH instance that operates on stdin and stdout (/dev/console).
|
||||
* This function does not return.
|
||||
* single an NSH instance that operates on stdin and stdout. This
|
||||
* function does not normally return (see below).
|
||||
*
|
||||
* This version of nsh_consolmain handles generic /dev/console character
|
||||
* devices (see nsh_usbdev.c for another version for special USB console
|
||||
* devices).
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task start-up arguements. These are not used. argc may be
|
||||
* Standard task start-up arguments. These are not used. argc may be
|
||||
* zero and argv may be NULL.
|
||||
*
|
||||
* Returned Values:
|
||||
* This function does not normally return. exit() is usually called to
|
||||
* terminate the NSH session. This function will return in the event of
|
||||
* an error. In that case, a nonzero value is returned (1).
|
||||
* an error. In that case, a nonzero value is returned (EXIT_FAILURE=1).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -101,70 +107,26 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
DEBUGASSERT(pstate);
|
||||
|
||||
/* If we are using a USB serial console, then we will have to wait for the
|
||||
* USB to be connected to the host.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_USB_CONSOLE
|
||||
ret = nsh_usbconsole();
|
||||
DEBUGASSERT(ret == OK);
|
||||
#endif
|
||||
|
||||
/* Present a greeting */
|
||||
|
||||
fputs(g_nshgreeting, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
|
||||
/* Execute the startup script */
|
||||
/* Execute the start-up script */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
(void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
|
||||
(void)nsh_initscript(&pstate->cn_vtbl);
|
||||
#endif
|
||||
|
||||
/* Then enter the command line parsing loop */
|
||||
/* Initialize any USB tracing options that were requested */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* For the case of debugging the USB console... dump collected USB trace data */
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
#endif
|
||||
|
||||
nsh_usbtrace();
|
||||
/* Execute the session */
|
||||
|
||||
/* Display the prompt string */
|
||||
ret = nsh_session(pstate);
|
||||
|
||||
fputs(g_nshprompt, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
/* Exit upon return */
|
||||
|
||||
/* Get the next line of input */
|
||||
|
||||
ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN,
|
||||
INSTREAM(pstate), OUTSTREAM(pstate));
|
||||
if (ret > 0)
|
||||
{
|
||||
/* Parse process the command */
|
||||
|
||||
(void)nsh_parse(&pstate->cn_vtbl, pstate->cn_line);
|
||||
fflush(pstate->cn_outstream);
|
||||
}
|
||||
|
||||
/* Readline normally returns the number of characters read,
|
||||
* but will return 0 on end of file or a negative value
|
||||
* if an error occurs. Either will cause the session to
|
||||
* terminate.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(pstate->cn_outstream, g_fmtcmdfailed, "nsh_consolemain",
|
||||
"readline", NSH_ERRNO_OF(-ret));
|
||||
nsh_exit(&pstate->cn_vtbl, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. We do not get here, but this is necessary to keep some
|
||||
* compilers happy. But others will complain that this code is not
|
||||
* reachable.
|
||||
*/
|
||||
|
||||
nsh_exit(&pstate->cn_vtbl, 0);
|
||||
return OK;
|
||||
nsh_exit(&pstate->cn_vtbl, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_USB_CONSOLE */
|
||||
|
||||
@@ -545,7 +545,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dd.skip < 0 || dd.skip > dd.nsectors)
|
||||
if (dd.skip > dd.nsectors)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtarginvalid, g_dd);
|
||||
goto errout_with_paths;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_fscmds.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -1220,71 +1220,6 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_script
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path)
|
||||
{
|
||||
char *fullpath;
|
||||
FILE *stream;
|
||||
char *buffer;
|
||||
char *pret;
|
||||
int ret = ERROR;
|
||||
|
||||
/* The path to the script may be relative to the current working directory */
|
||||
|
||||
fullpath = nsh_getfullpath(vtbl, path);
|
||||
if (!fullpath)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Get a reference to the common input buffer */
|
||||
|
||||
buffer = nsh_linebuffer(vtbl);
|
||||
if (buffer)
|
||||
{
|
||||
/* Open the file containing the script */
|
||||
|
||||
stream = fopen(fullpath, "r");
|
||||
if (!stream)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, cmd, "fopen", NSH_ERRNO);
|
||||
nsh_freefullpath(fullpath);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Loop, processing each command line in the script file (or
|
||||
* until an error occurs)
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
/* Get the next line of input from the file */
|
||||
|
||||
fflush(stdout);
|
||||
pret = fgets(buffer, CONFIG_NSH_LINELEN, stream);
|
||||
if (pret)
|
||||
{
|
||||
/* Parse process the command. NOTE: this is recursive...
|
||||
* we got to cmd_sh via a call to nsh_parse. So some
|
||||
* considerable amount of stack may be used.
|
||||
*/
|
||||
|
||||
ret = nsh_parse(vtbl, buffer);
|
||||
}
|
||||
}
|
||||
while (pret && ret == OK);
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
nsh_freefullpath(fullpath);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_sh
|
||||
****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_script.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_script
|
||||
*
|
||||
* Description:
|
||||
* Execute the NSH script at path.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
FAR const char *path)
|
||||
{
|
||||
char *fullpath;
|
||||
FILE *stream;
|
||||
char *buffer;
|
||||
char *pret;
|
||||
int ret = ERROR;
|
||||
|
||||
/* The path to the script may be relative to the current working directory */
|
||||
|
||||
fullpath = nsh_getfullpath(vtbl, path);
|
||||
if (!fullpath)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Get a reference to the common input buffer */
|
||||
|
||||
buffer = nsh_linebuffer(vtbl);
|
||||
if (buffer)
|
||||
{
|
||||
/* Open the file containing the script */
|
||||
|
||||
stream = fopen(fullpath, "r");
|
||||
if (!stream)
|
||||
{
|
||||
nsh_output(vtbl, g_fmtcmdfailed, cmd, "fopen", NSH_ERRNO);
|
||||
nsh_freefullpath(fullpath);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Loop, processing each command line in the script file (or
|
||||
* until an error occurs)
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
/* Get the next line of input from the file */
|
||||
|
||||
fflush(stdout);
|
||||
pret = fgets(buffer, CONFIG_NSH_LINELEN, stream);
|
||||
if (pret)
|
||||
{
|
||||
/* Parse process the command. NOTE: this is recursive...
|
||||
* we got to cmd_sh via a call to nsh_parse. So some
|
||||
* considerable amount of stack may be used.
|
||||
*/
|
||||
|
||||
ret = nsh_parse(vtbl, buffer);
|
||||
}
|
||||
}
|
||||
while (pret && ret == OK);
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
nsh_freefullpath(fullpath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_initscript
|
||||
*
|
||||
* Description:
|
||||
* Attempt to execute the configured initialization script. This script
|
||||
* should be executed once when NSH starts. nsh_initscript is idempotent
|
||||
* and may, however, be called multiple times (the script will be executed
|
||||
* once.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
int nsh_initscript(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
static bool initialized;
|
||||
bool already;
|
||||
int ret = OK;
|
||||
|
||||
/* Atomic test and set of the initialized flag */
|
||||
|
||||
sched_lock();
|
||||
already = initialized;
|
||||
initialized = true;
|
||||
sched_unlock();
|
||||
|
||||
/* If we have not already executed the init script, then do so now */
|
||||
|
||||
if (!already)
|
||||
{
|
||||
ret = nsh_script(vtbl, "init", NSH_INITPATH);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_loginscript
|
||||
*
|
||||
* Description:
|
||||
* Attempt to execute the configured login script. This script
|
||||
* should be executed when each NSH session starts.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSRC
|
||||
int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl)
|
||||
{
|
||||
return nsh_script(vtbl, "login", NSH_RCPATH);
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_NSH_ROMFSETC */
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */
|
||||
@@ -0,0 +1,163 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_session.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-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 Gregory Nutt 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <apps/readline.h>
|
||||
|
||||
#include "nsh.h"
|
||||
#include "nsh_console.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_session
|
||||
*
|
||||
* Description:
|
||||
* This is the common session logic or any NSH session. This function
|
||||
* return when an error reading from the input stream occurs, presumably
|
||||
* signaling the end of the session.
|
||||
*
|
||||
* This function:
|
||||
* - Executes the NSH logic script
|
||||
* - Presents a greeting
|
||||
* - Then provides a prompt then gets and processes the command line.
|
||||
* - This continues until an error occurs, then the session returns.
|
||||
*
|
||||
* Input Parameters:
|
||||
* pstate - Abstracts the underlying session.
|
||||
*
|
||||
* Returned Values:
|
||||
* EXIT_SUCESS or EXIT_FAILURE is returned.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
{
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(pstate);
|
||||
|
||||
/* Present a greeting */
|
||||
|
||||
fputs(g_nshgreeting, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
|
||||
/* Execute the login script */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSRC
|
||||
(void)nsh_loginscript(&pstate->cn_vtbl);
|
||||
#endif
|
||||
|
||||
/* Then enter the command line parsing loop */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* For the case of debugging the USB console... dump collected USB trace data */
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
nsh_usbtrace();
|
||||
#endif
|
||||
|
||||
/* Display the prompt string */
|
||||
|
||||
fputs(g_nshprompt, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
|
||||
/* Get the next line of input */
|
||||
|
||||
ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN,
|
||||
INSTREAM(pstate), OUTSTREAM(pstate));
|
||||
if (ret > 0)
|
||||
{
|
||||
/* Parse process the command */
|
||||
|
||||
(void)nsh_parse(&pstate->cn_vtbl, pstate->cn_line);
|
||||
fflush(pstate->cn_outstream);
|
||||
}
|
||||
|
||||
/* Readline normally returns the number of characters read,
|
||||
* but will return 0 on end of file or a negative value
|
||||
* if an error occurs. Either will cause the session to
|
||||
* terminate.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(pstate->cn_outstream, g_fmtcmdfailed, "nsh_session",
|
||||
"readline", NSH_ERRNO_OF(-ret));
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* We do not get here, but this is necessary to keep some compilers happy.
|
||||
* But others will complain that this code is not reachable.
|
||||
*/
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_telnetd.c
|
||||
*
|
||||
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -198,15 +198,29 @@ int nsh_telnetmain(int argc, char *argv[])
|
||||
}
|
||||
#endif /* CONFIG_NSH_TELNET_LOGIN */
|
||||
|
||||
/* The following logic mostly the same as the login in nsh_session.c. It
|
||||
* differs only in that gets() is called to get the command instead of
|
||||
* readline().
|
||||
*/
|
||||
|
||||
/* Present the NSH greeting */
|
||||
|
||||
fputs(g_nshgreeting, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
|
||||
/* Execute the startup script */
|
||||
/* Execute the startup script. If standard console is also defined, then
|
||||
* we will not bother with the initscript here (although it is safe to
|
||||
* call nshinitscript multiple times).
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE)
|
||||
(void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH);
|
||||
(void)nsh_initscript(&pstate->cn_vtbl);
|
||||
#endif
|
||||
|
||||
/* Execute the login script */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSRC
|
||||
(void)nsh_loginscript(&pstate->cn_vtbl);
|
||||
#endif
|
||||
|
||||
/* Then enter the command line parsing loop */
|
||||
@@ -261,8 +275,8 @@ int nsh_telnetmain(int argc, char *argv[])
|
||||
* NuttX configuration setting.
|
||||
*
|
||||
* Returned Values:
|
||||
* Zero if the Telnet daemon was successfully started. A negated errno
|
||||
* value will be returned on failure.
|
||||
* The task ID of the Telnet daemon was successfully started. A negated
|
||||
* errno value will be returned on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -271,6 +285,15 @@ int nsh_telnetstart(void)
|
||||
struct telnetd_config_s config;
|
||||
int ret;
|
||||
|
||||
/* Initialize any USB tracing options that were requested. If standard
|
||||
* console is also defined, then we will defer this step to the standard
|
||||
* console.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NSH_USBDEV_TRACE) && !defined(CONFIG_NSH_CONSOLE)
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
#endif
|
||||
|
||||
/* Configure the telnet daemon */
|
||||
|
||||
config.d_port = HTONS(CONFIG_NSH_TELNETD_PORT);
|
||||
|
||||
+205
-57
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* apps/nshlib/nsh_usbdev.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -55,15 +55,20 @@
|
||||
#endif
|
||||
|
||||
#include "nsh.h"
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
#include "nsh_console.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Output USB trace data to the console device using printf() unless (1)
|
||||
* debug is enabled, then we want to keep the trace output in sync with the
|
||||
* debug output by using syslog()we are using a USB console. In that case,
|
||||
* we don't want the trace output on the USB console; let's try sending it
|
||||
* a SYSLOG device (hopefully one is set up!)
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
|
||||
# define trmessage lib_lowprintf
|
||||
#if defined(CONFIG_DEBUG) || defined(HAVE_USB_CONSOLE)
|
||||
# define trmessage syslog
|
||||
#else
|
||||
# define trmessage printf
|
||||
#endif
|
||||
@@ -92,7 +97,15 @@
|
||||
* Name: nsh_tracecallback
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV_TRACE
|
||||
/****************************************************************************
|
||||
* Name: nsh_tracecallback
|
||||
*
|
||||
* Description:
|
||||
* This is part of the USB trace logic
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
static int nsh_tracecallback(struct usbtrace_s *trace, void *arg)
|
||||
{
|
||||
usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value);
|
||||
@@ -101,27 +114,96 @@ static int nsh_tracecallback(struct usbtrace_s *trace, void *arg)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_usbconsole
|
||||
* Name: nsh_configstdio
|
||||
*
|
||||
* Description:
|
||||
* Configure standard I/O
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_USB_CONSOLE
|
||||
int nsh_usbconsole(void)
|
||||
static void nsh_configstdio(int fd)
|
||||
{
|
||||
/* Make sure the stdin, stdout, and stderr are closed */
|
||||
|
||||
(void)fclose(stdin);
|
||||
(void)fclose(stdout);
|
||||
(void)fclose(stderr);
|
||||
|
||||
/* Dup the fd to create standard fd 0-2 */
|
||||
|
||||
(void)dup2(fd, 0);
|
||||
(void)dup2(fd, 1);
|
||||
(void)dup2(fd, 2);
|
||||
|
||||
/* fdopen to get the stdin, stdout and stderr streams. The following logic depends
|
||||
* on the fact that the library layer will allocate FILEs in order. And since
|
||||
* we closed stdin, stdout, and stderr above, that is what we should get.
|
||||
*
|
||||
* fd = 0 is stdin (read-only)
|
||||
* fd = 1 is stdout (write-only, append)
|
||||
* fd = 2 is stderr (write-only, append)
|
||||
*/
|
||||
|
||||
(void)fdopen(0, "r");
|
||||
(void)fdopen(1, "a");
|
||||
(void)fdopen(2, "a");
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_nullstdio
|
||||
*
|
||||
* Description:
|
||||
* Use /dev/null for standard I/O
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_USB_CONSOLE
|
||||
static int nsh_nullstdio(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
/* Open /dev/null for read/write access */
|
||||
|
||||
fd = open("/dev/null", O_RDWR);
|
||||
if (fd >= 0)
|
||||
{
|
||||
/* Configure standard I/O to use /dev/null */
|
||||
|
||||
nsh_configstdio(fd);
|
||||
|
||||
/* We can close the original file descriptor now (unless it was one of
|
||||
* 0-2)
|
||||
*/
|
||||
|
||||
if (fd > 2)
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_waitusbready
|
||||
*
|
||||
* Description:
|
||||
* Wait for the USB console device to be ready
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_USB_CONSOLE
|
||||
static int nsh_waitusbready(void)
|
||||
{
|
||||
char inch;
|
||||
ssize_t nbytes;
|
||||
int nlc;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
/* Initialize any USB tracing options that were requested */
|
||||
|
||||
#ifdef CONFIG_USBDEV_TRACE
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
#endif
|
||||
|
||||
/* Don't start the NSH console until the console device is ready. Chances
|
||||
* are, we get here with no functional console. The USB console will not
|
||||
@@ -129,17 +211,6 @@ int nsh_usbconsole(void)
|
||||
* host-side application opens the connection.
|
||||
*/
|
||||
|
||||
/* Initialize the USB serial driver */
|
||||
|
||||
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
|
||||
#ifdef CONFIG_CDCACM
|
||||
ret = cdcacm_initialize(CONFIG_NSH_UBSDEV_MINOR, NULL);
|
||||
#else
|
||||
ret = usbdev_serialinitialize(CONFIG_NSH_UBSDEV_MINOR);
|
||||
#endif
|
||||
DEBUGASSERT(ret == OK);
|
||||
#endif
|
||||
|
||||
/* Open the USB serial device for read/write access */
|
||||
|
||||
do
|
||||
@@ -193,17 +264,9 @@ int nsh_usbconsole(void)
|
||||
}
|
||||
while (nlc < 3);
|
||||
|
||||
/* Make sure the stdin, stdout, and stderr are closed */
|
||||
/* Configure standard I/O */
|
||||
|
||||
(void)fclose(stdin);
|
||||
(void)fclose(stdout);
|
||||
(void)fclose(stderr);
|
||||
|
||||
/* Dup the fd to create standard fd 0-2 */
|
||||
|
||||
(void)dup2(fd, 0);
|
||||
(void)dup2(fd, 1);
|
||||
(void)dup2(fd, 2);
|
||||
nsh_configstdio(fd);
|
||||
|
||||
/* We can close the original file descriptor now (unless it was one of 0-2) */
|
||||
|
||||
@@ -212,32 +275,117 @@ int nsh_usbconsole(void)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
/* fdopen to get the stdin, stdout and stderr streams. The following logic depends
|
||||
* on the fact that the library layer will allocate FILEs in order. And since
|
||||
* we closed stdin, stdout, and stderr above, that is what we should get.
|
||||
*
|
||||
* fd = 0 is stdin (read-only)
|
||||
* fd = 1 is stdout (write-only, append)
|
||||
* fd = 2 is stderr (write-only, append)
|
||||
*/
|
||||
|
||||
(void)fdopen(0, "r");
|
||||
(void)fdopen(1, "a");
|
||||
(void)fdopen(2, "a");
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_USB_CONSOLE */
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_consolemain (USB console version)
|
||||
*
|
||||
* Description:
|
||||
* This interfaces maybe to called or started with task_start to start a
|
||||
* single an NSH instance that operates on stdin and stdout. This
|
||||
* function does not return.
|
||||
*
|
||||
* This function handles generic /dev/console character devices, or
|
||||
* special USB console devices. The USB console requires some special
|
||||
* operations to handle the cases where the session is lost when the
|
||||
* USB device is unplugged and restarted when the USB device is plugged
|
||||
* in again.
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard task start-up arguments. These are not used. argc may be
|
||||
* zero and argv may be NULL.
|
||||
*
|
||||
* Returned Values:
|
||||
* This function does not return nor does it ever exit (unless the user
|
||||
* executes the NSH exit command).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_USB_CONSOLE
|
||||
int nsh_consolemain(int argc, char *argv[])
|
||||
{
|
||||
FAR struct console_stdio_s *pstate = nsh_newconsole();
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(pstate);
|
||||
|
||||
/* Initialize any USB tracing options that were requested */
|
||||
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
#endif
|
||||
|
||||
/* Initialize the USB serial driver */
|
||||
|
||||
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
|
||||
#ifdef CONFIG_CDCACM
|
||||
ret = cdcacm_initialize(CONFIG_NSH_USBDEV_MINOR, NULL);
|
||||
#else
|
||||
ret = usbdev_serialinitialize(CONFIG_NSH_USBDEV_MINOR);
|
||||
#endif
|
||||
DEBUGASSERT(ret == OK);
|
||||
#endif
|
||||
|
||||
/* Configure to use /dev/null if we do not have a valid console. */
|
||||
|
||||
#ifndef CONFIG_DEV_CONSOLE
|
||||
(void)nsh_nullstdio();
|
||||
#endif
|
||||
|
||||
/* Execute the one-time start-up script (output may go to /dev/null) */
|
||||
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
(void)nsh_initscript(&pstate->cn_vtbl);
|
||||
#endif
|
||||
|
||||
/* Now loop, executing creating a session for each USB connection */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Wait for the USB to be connected to the host and switch
|
||||
* standard I/O to the USB serial device.
|
||||
*/
|
||||
|
||||
ret = nsh_waitusbready();
|
||||
DEBUGASSERT(ret == OK);
|
||||
|
||||
/* Execute the session */
|
||||
|
||||
(void)nsh_session(pstate);
|
||||
|
||||
/* Switch to /dev/null because we probably no longer have a
|
||||
* valid console device.
|
||||
*/
|
||||
|
||||
(void)nsh_nullstdio();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_usbtrace
|
||||
*
|
||||
* Description:
|
||||
* The function is called from the nsh_session() to dump USB data to the
|
||||
* SYSLOG device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Values:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
|
||||
#ifdef CONFIG_NSH_USBDEV_TRACE
|
||||
void nsh_usbtrace(void)
|
||||
{
|
||||
(void)usbtrace_enumerate(nsh_tracecallback, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_USBDEV */
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
@@ -56,7 +56,7 @@
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_rawprintf
|
||||
# define message lowsyslog
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
|
||||
@@ -144,7 +144,7 @@ mixer_tick(void)
|
||||
rc_channel_data[THROTTLE] = 1000;
|
||||
}
|
||||
|
||||
// lib_lowprintf("Tmin: %d Ttrim: %d Tmax: %d T: %d \n",
|
||||
// lowsyslog("Tmin: %d Ttrim: %d Tmax: %d T: %d \n",
|
||||
// (int)(system_state.rc_min[THROTTLE]), (int)(system_state.rc_trim[THROTTLE]),
|
||||
// (int)(system_state.rc_max[THROTTLE]), (int)(rc_channel_data[THROTTLE]));
|
||||
|
||||
@@ -156,7 +156,7 @@ mixer_tick(void)
|
||||
// XXX builtin failsafe would activate here
|
||||
control_count = 0;
|
||||
}
|
||||
//lib_lowprintf("R: %d P: %d Y: %d T: %d \n", control_values[0], control_values[1], control_values[2], control_values[3]);
|
||||
//lowsyslog("R: %d P: %d Y: %d T: %d \n", control_values[0], control_values[1], control_values[2], control_values[3]);
|
||||
|
||||
/* this is for multicopters, etc. where manual override does not make sense */
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ int user_start(int argc, char *argv[])
|
||||
hrt_init();
|
||||
|
||||
/* print some startup info */
|
||||
lib_lowprintf("\nPX4IO: starting\n");
|
||||
lowsyslog("\nPX4IO: starting\n");
|
||||
|
||||
/* default all the LEDs to off while we start */
|
||||
LED_AMBER(false);
|
||||
@@ -98,7 +98,7 @@ int user_start(int argc, char *argv[])
|
||||
|
||||
|
||||
struct mallinfo minfo = mallinfo();
|
||||
lib_lowprintf("free %u largest %u\n", minfo.mxordblk, minfo.fordblks);
|
||||
lowsyslog("free %u largest %u\n", minfo.mxordblk, minfo.fordblks);
|
||||
|
||||
/* we're done here, go run the communications loop */
|
||||
comms_main();
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <debug.h>
|
||||
# define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args)
|
||||
# define debug(fmt, args...) lowsyslog(fmt "\n", ##args)
|
||||
#else
|
||||
# define debug(fmt, args...) do {} while(0)
|
||||
#endif
|
||||
|
||||
@@ -34,3 +34,7 @@ endmenu
|
||||
menu "Sysinfo"
|
||||
source "$APPSDIR/system/sysinfo/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "USB Monitor"
|
||||
source "$APPSDIR/system/usbmonitor/Kconfig"
|
||||
endmenu
|
||||
|
||||
@@ -66,3 +66,6 @@ ifeq ($(CONFIG_SYSTEM_SYSINFO),y)
|
||||
CONFIGURED_APPS += system/sysinfo
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SYSTEM_USBMONITOR),y)
|
||||
CONFIGURED_APPS += system/usbmonitor
|
||||
endif
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
# Sub-directories containing system task
|
||||
|
||||
SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo
|
||||
SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo usbmonitor
|
||||
|
||||
# Create the list of installed runtime modules (INSTALLED_DIRS)
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
This application provides UNIX style memory free information.
|
||||
|
||||
Source: NuttX
|
||||
Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
Date: 17. March 2011
|
||||
@@ -132,23 +132,33 @@ static inline int readline_rawgetc(int infd)
|
||||
|
||||
nread = read(infd, &buffer, 1);
|
||||
|
||||
/* Return EOF if the end of file (0) or error (-1) occurs. */
|
||||
/* Check for end-of-file. */
|
||||
|
||||
if (nread < 1)
|
||||
if (nread == 0)
|
||||
{
|
||||
/* Return zero on end-of-file */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if an error occurred */
|
||||
|
||||
else if (nread < 0)
|
||||
{
|
||||
/* EINTR is not really an error; it simply means that a signal we
|
||||
* received while watiing for intput.
|
||||
*/
|
||||
|
||||
if (nread == 0 || errno != EINTR)
|
||||
int errcode = errno;
|
||||
if (errcode != EINTR)
|
||||
{
|
||||
return EOF;
|
||||
return -errcode;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (nread < 1);
|
||||
|
||||
/* On success, returnt he character that was read */
|
||||
/* On success, return the character that was read */
|
||||
|
||||
return (int)buffer;
|
||||
}
|
||||
@@ -275,9 +285,29 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
||||
|
||||
int ch = readline_rawgetc(infd);
|
||||
|
||||
/* Check for end-of-file or read error */
|
||||
|
||||
if (ch <= 0)
|
||||
{
|
||||
/* Did we already received some data? */
|
||||
|
||||
if (nch > 0)
|
||||
{
|
||||
/* Yes.. Terminate the line (which might be zero length)
|
||||
* and return the data that was received. The end-of-file
|
||||
* or error condition will be reported next time.
|
||||
*/
|
||||
|
||||
buf[nch] = '\0';
|
||||
return nch;
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* Are we processing a VT100 escape sequence */
|
||||
|
||||
if (escape)
|
||||
else if (escape)
|
||||
{
|
||||
/* Yes, is it an <esc>[, 3 byte sequence */
|
||||
|
||||
@@ -366,16 +396,6 @@ ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream)
|
||||
return nch;
|
||||
}
|
||||
|
||||
/* Check for end-of-file */
|
||||
|
||||
else if (ch == EOF)
|
||||
{
|
||||
/* Terminate the line (which might be zero length) */
|
||||
|
||||
buf[nch] = '\0';
|
||||
return nch;
|
||||
}
|
||||
|
||||
/* Otherwise, check if the character is printable and, if so, put the
|
||||
* character in the line buffer
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
config SYSTEM_USBMONITOR
|
||||
bool "USB Monitor"
|
||||
default n
|
||||
depends on USBDEV && USBDEV_TRACE && SYSLOG
|
||||
---help---
|
||||
If USB device tracing is enabled (USBDEV_TRACE), then this option
|
||||
will select the USB monitor. The USB monitor is a daemon that will
|
||||
periodically collect the buffered USB trace data and dump it to the
|
||||
SYSLOG device.
|
||||
|
||||
if SYSTEM_USBMONITOR
|
||||
|
||||
config SYSTEM_USBMONITOR_STACKSIZE
|
||||
int "USB Monitor daemon stack size"
|
||||
default 2048
|
||||
---help---
|
||||
The stack size to use the the USB monitor daemon. Default: 2048
|
||||
|
||||
config SYSTEM_USBMONITOR_PRIORITY
|
||||
int "USB Monitor daemon priority"
|
||||
default 50
|
||||
---help---
|
||||
The priority to use the the USB monitor daemon. Default: 50
|
||||
|
||||
config SYSTEM_USBMONITOR_INTERVAL
|
||||
int "USB Monitor dump frequency"
|
||||
default 2
|
||||
---help---
|
||||
The rate in seconds that the USB monitor will wait before dumping
|
||||
the next set of buffered USB trace data. Default: 2 seconds.
|
||||
|
||||
config SYSTEM_USBMONITOR_TRACEINIT
|
||||
bool "Show initialization events"
|
||||
default n
|
||||
---help---
|
||||
Show initialization events
|
||||
|
||||
config SYSTEM_USBMONITOR_TRACECLASS
|
||||
bool "Show class driver events"
|
||||
default n
|
||||
---help---
|
||||
Show class driver events
|
||||
|
||||
config SYSTEM_USBMONITOR_TRACETRANSFERS
|
||||
bool "Show data transfer events"
|
||||
default n
|
||||
---help---
|
||||
Show data transfer events
|
||||
|
||||
config SYSTEM_USBMONITOR_TRACECONTROLLER
|
||||
bool "Show controller events"
|
||||
default n
|
||||
---help---
|
||||
Show controller events
|
||||
|
||||
config SYSTEM_USBMONITOR_TRACEINTERRUPTS
|
||||
bool "Show interrupt-related events"
|
||||
default n
|
||||
---help---
|
||||
Show interrupt-related events
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
############################################################################
|
||||
# apps/system/usbmonitor/Makefile
|
||||
#
|
||||
# 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)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
INCDIROPT = -w
|
||||
endif
|
||||
|
||||
# USB Monitor Application
|
||||
|
||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||
STACKSIZE = 768
|
||||
|
||||
ASRCS =
|
||||
CSRCS = usbmonitor.c
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
ROOTDEPPATH = --dep-path .
|
||||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
# Register application
|
||||
|
||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||
$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat: $(DEPCONFIG) Makefile
|
||||
$(call REGISTER,"usbmon_start",$(PRIORITY),$(STACKSIZE),usbmonitor_start)
|
||||
|
||||
$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat: $(DEPCONFIG) Makefile
|
||||
$(call REGISTER,"usbmon_stop",$(PRIORITY),$(STACKSIZE),usbmonitor_stop)
|
||||
|
||||
context: $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat
|
||||
else
|
||||
context:
|
||||
endif
|
||||
|
||||
# Create dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
@@ -0,0 +1,234 @@
|
||||
/****************************************************************************
|
||||
* apps/system/usbmonitor/usbmonitor.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/progmem.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define USBMON_PREFIX "USB Monitor: "
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_SYSTEM_USBMONITOR_STACKSIZE
|
||||
# define CONFIG_SYSTEM_USBMONITOR_STACKSIZE 2048
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SYSTEM_USBMONITOR_PRIORITY
|
||||
# define CONFIG_SYSTEM_USBMONITOR_PRIORITY 50
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SYSTEM_USBMONITOR_INTERVAL
|
||||
# define CONFIG_SYSTEM_USBMONITOR_INTERVAL 2
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINIT
|
||||
# define TRACE_INIT_BITS (TRACE_INIT_BIT)
|
||||
#else
|
||||
# define TRACE_INIT_BITS (0)
|
||||
#endif
|
||||
|
||||
#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACECLASS
|
||||
# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|\
|
||||
TRACE_CLASSSTATE_BIT)
|
||||
#else
|
||||
# define TRACE_CLASS_BITS (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS
|
||||
# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|\
|
||||
TRACE_READ_BIT|TRACE_WRITE_BIT|\
|
||||
TRACE_COMPLETE_BIT)
|
||||
#else
|
||||
# define TRACE_TRANSFER_BITS (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER
|
||||
# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT)
|
||||
#else
|
||||
# define TRACE_CONTROLLER_BITS (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS
|
||||
# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|\
|
||||
TRACE_INTEXIT_BIT)
|
||||
#else
|
||||
# define TRACE_INTERRUPT_BITS (0)
|
||||
#endif
|
||||
|
||||
#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|\
|
||||
TRACE_CLASS_BITS|TRACE_TRANSFER_BITS|\
|
||||
TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct usbmon_state_s
|
||||
{
|
||||
volatile bool started;
|
||||
volatile bool stop;
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct usbmon_state_s g_usbmonitor;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static int usbmonitor_tracecallback(struct usbtrace_s *trace, void *arg)
|
||||
{
|
||||
usbtrace_trprintf((trprintf_t)syslog, trace->event, trace->value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int usbmonitor_daemon(int argc, char **argv)
|
||||
{
|
||||
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
|
||||
|
||||
/* Loop until we detect that there is a request to stop. */
|
||||
|
||||
while (!g_usbmonitor.stop)
|
||||
{
|
||||
sleep(CONFIG_SYSTEM_USBMONITOR_INTERVAL);
|
||||
(void)usbtrace_enumerate(usbmonitor_tracecallback, NULL);
|
||||
}
|
||||
|
||||
/* Stopped */
|
||||
|
||||
g_usbmonitor.stop = false;
|
||||
g_usbmonitor.started = false;
|
||||
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int usbmonitor_start(int argc, char **argv)
|
||||
{
|
||||
/* Has the monitor already started? */
|
||||
|
||||
sched_lock();
|
||||
if (!g_usbmonitor.started)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* No.. start it now */
|
||||
|
||||
/* First, initialize any USB tracing options that were requested */
|
||||
|
||||
usbtrace_enable(TRACE_BITSET);
|
||||
|
||||
/* Then start the USB monitoring daemon */
|
||||
|
||||
g_usbmonitor.started = true;
|
||||
g_usbmonitor.stop = false;
|
||||
|
||||
ret = TASK_CREATE("USB Monitor", CONFIG_SYSTEM_USBMONITOR_PRIORITY,
|
||||
CONFIG_SYSTEM_USBMONITOR_STACKSIZE,
|
||||
(main_t)usbmonitor_daemon, (const char **)NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
syslog(USBMON_PREFIX
|
||||
"ERROR: Failed to start the USB monitor: %d\n",
|
||||
errcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_usbmonitor.pid = ret;
|
||||
syslog(USBMON_PREFIX "Started: %d\n", g_usbmonitor.pid);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
syslog(USBMON_PREFIX "%s: %d\n",
|
||||
g_usbmonitor.stop ? "Stopping" : "Running", g_usbmonitor.pid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usbmonitor_stop(int argc, char **argv)
|
||||
{
|
||||
/* Has the monitor already started? */
|
||||
|
||||
if (g_usbmonitor.started)
|
||||
{
|
||||
/* Stop the USB monitor. The next time the monitor wakes up,
|
||||
* it will see the the stop indication and will exist.
|
||||
*/
|
||||
|
||||
syslog(USBMON_PREFIX "Stopping: %d\n", g_usbmonitor.pid);
|
||||
g_usbmonitor.stop = true;
|
||||
|
||||
/* We may as well disable tracing since there is no listener */
|
||||
|
||||
usbtrace_enable(0);
|
||||
}
|
||||
|
||||
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_USBMONITOR */
|
||||
@@ -85,17 +85,17 @@ warnerr_core(int errcode, const char *fmt, va_list args)
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
#elif CONFIG_ARCH_LOWPUTC
|
||||
lib_lowprintf("%s: ", getprogname());
|
||||
lib_lowvprintf(fmt, args);
|
||||
lowsyslog("%s: ", getprogname());
|
||||
lowvyslog(fmt, args);
|
||||
|
||||
/* convenience as many parts of NuttX use negative errno */
|
||||
if (errcode < 0)
|
||||
errcode = -errcode;
|
||||
|
||||
if (errcode < NOCODE)
|
||||
lib_lowprintf(": %s", strerror(errcode));
|
||||
lowsyslog(": %s", strerror(errcode));
|
||||
|
||||
lib_lowprintf("\n");
|
||||
lowsyslog("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#define debug(fmt, args...) do { } while(0)
|
||||
//#define debug(fmt, args...) do { printf("[mixer] " fmt "\n", ##args); } while(0)
|
||||
//#include <debug.h>
|
||||
//#define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args)
|
||||
//#define debug(fmt, args...) lowsyslog(fmt "\n", ##args)
|
||||
|
||||
MixerGroup::MixerGroup(ControlCallback control_cb, uintptr_t cb_handle) :
|
||||
Mixer(control_cb, cb_handle),
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#define debug(fmt, args...) do { } while(0)
|
||||
//#define debug(fmt, args...) do { printf("[mixer] " fmt "\n", ##args); } while(0)
|
||||
//#include <debug.h>
|
||||
//#define debug(fmt, args...) lib_lowprintf(fmt "\n", ##args)
|
||||
//#define debug(fmt, args...) lowsyslog(fmt "\n", ##args)
|
||||
|
||||
/*
|
||||
* Clockwise: 1
|
||||
@@ -217,11 +217,11 @@ unsigned
|
||||
MultirotorMixer::mix(float *outputs, unsigned space)
|
||||
{
|
||||
float roll = get_control(0, 0) * _roll_scale;
|
||||
//lib_lowprintf("roll: %d, get_control0: %d, %d\n", (int)(roll), (int)(get_control(0, 0)), (int)(_roll_scale));
|
||||
//lowsyslog("roll: %d, get_control0: %d, %d\n", (int)(roll), (int)(get_control(0, 0)), (int)(_roll_scale));
|
||||
float pitch = get_control(0, 1) * _pitch_scale;
|
||||
float yaw = get_control(0, 2) * _yaw_scale;
|
||||
float thrust = get_control(0, 3);
|
||||
//lib_lowprintf("thrust: %d, get_control3: %d\n", (int)(thrust), (int)(get_control(0, 3)));
|
||||
//lowsyslog("thrust: %d, get_control3: %d\n", (int)(thrust), (int)(get_control(0, 3)));
|
||||
float max = 0.0f;
|
||||
float fixup_scale;
|
||||
|
||||
|
||||
+90
-9
@@ -3800,7 +3800,7 @@
|
||||
* configs/stm32f4discovery/elf: Enable support/test of the PATH
|
||||
to find executables using a relative path.
|
||||
|
||||
6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
6.25 2013-02-01 Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* graphics/: Adds 5x8 monospace font. This tiny font is useful for graph
|
||||
labels and for small bitmapped display. Contributed by Petteri
|
||||
@@ -3833,7 +3833,7 @@
|
||||
* drivers/usbhost/usbhost_hidkbd.c: Correct a logic error in how
|
||||
tasks waiting for read data are awakened.
|
||||
* libc/misc/lib_kbdencode.c and lib_kbddecode.c: Now handles keypress
|
||||
events too. However, the USB HID keyboard drier has not yet been
|
||||
events too. However, the USB HID keyboard driver has not yet been
|
||||
updated to detect key release events. That is kind of tricky in
|
||||
the USB HID keyboard report data.
|
||||
* configs/mcu123-214x/nsh: Converted to use the kconfig-frontends
|
||||
@@ -3857,7 +3857,7 @@
|
||||
buildroot toolchains: They may be EABI or OABI.
|
||||
* include/nuttx/progmem and arch/arm/src/stm32/stm32_flash.c:
|
||||
Fix a counting bug plus change interface to use either relative
|
||||
or absolut FLASH addressing (from Freddie Chopin).
|
||||
or absolute FLASH addressing (from Freddie Chopin).
|
||||
* libc/misc/Make.defs: Fix error in conditional for KBD CODEC.
|
||||
* libc/Kconfig and configs/*/defconfig (several): The default
|
||||
setting should be CONFIG_LIB_KBDCODEC=n
|
||||
@@ -3868,7 +3868,7 @@
|
||||
* tools/configure.bat: configure.bat is a small Windows batch
|
||||
file that can be used as a replacement for configure.sh in a
|
||||
Windows native environment. configure.bat is actually just a
|
||||
thin layer that execuates configure.exe if it is available. If
|
||||
thin layer that executes configure.exe if it is available. If
|
||||
configure.exe is not available, then configure.bat will attempt
|
||||
to build it first.
|
||||
* arch/arm/src/lpc17xx/lpc17_syscon.h: Correct some typos in bit
|
||||
@@ -3918,12 +3918,12 @@
|
||||
the scenario: (1) sched_lock() is called increments the lockcount
|
||||
on the current TCB (i.e., the one at the head of the ready to run
|
||||
list), (2) sched_mergepending is called which may change the task
|
||||
at the head of the readytorun list, then (2) sched_unlock() is called
|
||||
at the head of the ready-to-run list, then (3) sched_unlock() is called
|
||||
which decrements the lockcount on the wrong TCB. The failure case
|
||||
that I saw was that pre-emption got disabled in the IDLE thread,
|
||||
locking up the whole system.
|
||||
* sched/sched_waitpid.c: Use SIGCHLD instead of a semaphore. This
|
||||
is a much more spec-compliant implemenation. However, there are
|
||||
is a much more spec-compliant implementation. However, there are
|
||||
some issues with overruning signals because NuttX does not support
|
||||
queueing of signals (POSIX does not require it). I think it may
|
||||
need to.
|
||||
@@ -3959,7 +3959,7 @@
|
||||
CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS
|
||||
* include/nuttx/binfmt/builtin.h: Some of the content of
|
||||
apps/include/apps.h moved to include/nuttx/binfmt/builtin.h
|
||||
* binfmt/libbuiltin/libbuiltin_utils.c: Move utility builtin
|
||||
* binfmt/libbuiltin/libbuiltin_utils.c: Move builtin
|
||||
utility functions from apps/builtin/exec_builtins.c to
|
||||
binfmt/libbuiltin/libbuiltin_utils.c
|
||||
* binfmt/builtin.c and binfmt/libbuiltin: Add a binary "loader"
|
||||
@@ -3985,7 +3985,7 @@
|
||||
* arch/arm/src/[many]: More LPC1788 definitions from Rommel
|
||||
Marcelo incorporated.
|
||||
* configs/open1788: Board configuration for the Wave Share
|
||||
Open1788 board. Still fragmentary (contribnuted by Rommel
|
||||
Open1788 board. Still fragmentary (contributed by Rommel
|
||||
Marcelo, adapted to use kconfig-frontends.
|
||||
* net/send(): Add logic to work around delayed ACKs by splitting
|
||||
packets (contributed by Yan T.).
|
||||
@@ -4011,11 +4011,92 @@
|
||||
* arch/armv7-m/up_hardfault.c: Fail if a hardfault occurs
|
||||
while CONFIG_ARM7VM_USEBASEPRI=y.
|
||||
* arch/arm/src/stm32/stm32_serial.c: Add support for USART
|
||||
single wire more (Contributed by the PX4 team).
|
||||
single wire mode (Contributed by the PX4 team).
|
||||
* sched/: Implement support for retaining child task status after
|
||||
the child task exists. This is behavior required by POSIX.
|
||||
But in NuttX is only enabled with CONFIG_SCHED_HAVE_PARENT and
|
||||
CONFIG_SCHED_CHILD_STATUS
|
||||
* Add support for keyboard encode to the keypad test (from
|
||||
Denis Carikli).
|
||||
* configs/olimex-lpc1766stk/nettest: Configuration converted to
|
||||
use the kconfig-frontends tools.
|
||||
* net/net_poll.c: Split net_poll() to create psock_poll() too.
|
||||
* net/net_poll.c: Fix poll/select issure reported by Qiang:
|
||||
poll_interrupt() must call net_lostconnection() when a
|
||||
loss of connection is reported. Otherwise, the system will
|
||||
not know that the connection has been lost.
|
||||
* sched/group_create.c, group_join.c, and group_leave.c: Add
|
||||
support for task groups.
|
||||
* sched/group_signal.c and task_exithook.c: Send signal to all
|
||||
members for the parent task group.
|
||||
* include/nuttx/sched.h and sched/env_*.c: Move environment
|
||||
variables into task group structure.
|
||||
* sched/: Lots of file changed. Don't keep the parent task's
|
||||
task ID in the child task's TCB. Instead, keep the parent
|
||||
task group IN the child task's task group.
|
||||
* fs/, sched/, include/nuttx/sched.h, and include/nutts/fs/fs.h:
|
||||
Move file data from the TCB to the task group structure.
|
||||
* libc/stdio/, sched/, include/nuttx/lib.h, and include/nutts/fs/fs.h:
|
||||
Move stream data from the TCB to the task group structure.
|
||||
* net/, sched/, and include/nuttx/net/net.h: Move socket data
|
||||
from the TCB to the task group structure.
|
||||
* sched/task_starthook.c, sched/task_start.c, and include/nuttx/sched.h:
|
||||
Add a task start hook that will be called before the task main
|
||||
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.
|
||||
* configs/stm32f4discovery/nsh: Converted to use the kconfig-frontends
|
||||
tools.
|
||||
* configs/*/src/up_userleds.c: Fix a error that was cloned into
|
||||
all STM32 user LED code. The wrong definitions were being used
|
||||
to set LEDs on or off.
|
||||
* arch/*/common/up_internal.h and arch/*/common/up_initialize.c:
|
||||
Serial was driver was not being built if there is no console
|
||||
device. Obviously, the serial driver may be needed even in
|
||||
this case.
|
||||
* arch/arm/src/stm32/stm32_serial.c: If there is a serial console,
|
||||
it would be ttyS0 and the others would be ttyS1-5. If there
|
||||
is not serial console, was labeling them ttyS1-6; now labels them
|
||||
ttyS0-5.
|
||||
* fs/fs_syslog.c: Can't handle SYSLOG output to character device from
|
||||
the IDLE task (because it can't block). syslog_putc now returns EOF
|
||||
on failure and sets errno. Fixed some errors in error handling.
|
||||
* libc/stdio/lib_syslogstream.c: Checking of return value from
|
||||
syslog_putc was bogus. Switching to EOF for all errors solves
|
||||
this.
|
||||
* arch/arm/src/lm/chip/lm4f_memorymap.h: More LM4F changes from
|
||||
Jose Pablo Carballo.
|
||||
* drivers/serial/serial.c, include/nuttx/serial/serial.h,
|
||||
drivers/usbdev/cdcacm.c, and drivers/pl2303.c: Add support for
|
||||
removable serial devices (like USB serial). This support is enabled
|
||||
by CONFIG_SERIAL_REMOVABLE.
|
||||
* arch/*/src/*/Toolchain.defs: Change assignment so that we can
|
||||
override CROSSDEV with a make command line argument.
|
||||
* include/assert.h: Mark assertion functions as non-returning.
|
||||
* arch/*/src/*/up_assert.h: Mark _up_assert() as non-returning.
|
||||
* drivers/mtd/at25.c: When the AT25 device was not available the
|
||||
initialization did not fail like it should. From Petteri Aimonen.
|
||||
* fs/fat/fs_configfat.c: Fix some errors in FAT formatting logic
|
||||
for large devices and for FAT32. From Petteri Aimonen.
|
||||
* fs/fat/fs_fat32util.c: Fix an initialization error found by
|
||||
Petteri Aimonen. freecount and next freecount initialization were
|
||||
reversed.
|
||||
* drivers/mmcsd/mmcsd_spi.c: Some SD cards will appear busy until
|
||||
switched to SPI mode for first time. Having a pull-up resistor on
|
||||
MISO may avoid this problem, but this patch makes it work also
|
||||
without pull-up. From Petteri Aimonen.
|
||||
* fs/fat/fs_fat32.c: Fix a compilation error when FAT_DMAMEMORY=y.
|
||||
From Petteri Aimonen.
|
||||
* arch/arm/src/stm32/chip/stm32_spi.h: STM32F4 max SPI clock freq is
|
||||
37.5 MHz. Patch from Petteri Aimonen.
|
||||
* arch/arm/src/stm32/stm32_spi.c: Fixes for SPI DMA work on the
|
||||
STM32F4. Includes untested additions for the F1 implementation as
|
||||
well. From Petteri Aimonen.
|
||||
|
||||
6.26 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* drivers/serial/serial.c: Correct some race conditions when checking
|
||||
for disconnection of a removable serial device.
|
||||
|
||||
+25
-30
@@ -297,26 +297,21 @@ config DEBUG
|
||||
---help---
|
||||
Enables built-in debug features. Selecting this option will (1) Enable
|
||||
debug assertions in the code, (2) enable extended parameter testing in
|
||||
many functions, and (3) enable support for debug output. Note that enabling
|
||||
this option by itself does not produce debug output. Debug output must
|
||||
also be selected on a subsystem-by-subsystem basis.
|
||||
many functions, and (3) enable support for debug output to the SYSLOG.
|
||||
Note that enabling this option by itself does not produce debug output.
|
||||
Debug output must also be selected on a subsystem-by-subsystem basis.
|
||||
|
||||
if DEBUG
|
||||
config DEBUG_VERBOSE
|
||||
bool "Enable Debug Verbose Output"
|
||||
default n
|
||||
---help---
|
||||
Enables verbose debug output (assuming debug output is enabled). As a
|
||||
general rule, when DEBUG is enabled only errors will be reported in the debug
|
||||
output. But if you also enable DEBUG_VERBOSE, then very chatty (and
|
||||
often annoying) output will be generated. This means there are two levels
|
||||
of debug output: errors-only and everything.
|
||||
|
||||
config DEBUG_ENABLE
|
||||
bool "Enable Debug Controls"
|
||||
default n
|
||||
---help---
|
||||
Support an interface to dynamically enable or disable debug output.
|
||||
Enables verbose debug output (assuming debug featurses are enabled).
|
||||
As a general rule, when DEBUG is enabled only errors will be
|
||||
reported in the debug SYSLOG output. But if you also enable
|
||||
DEBUG_VERBOSE, then very chatty (and often annoying) output will be
|
||||
generated. This means there are two levels of debug output:
|
||||
errors-only and everything.
|
||||
|
||||
comment "Subsystem Debug Options"
|
||||
|
||||
@@ -324,58 +319,58 @@ config DEBUG_MM
|
||||
bool "Enable Memory Manager Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable memory management debug output (disabled by default)
|
||||
Enable memory management debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_SCHED
|
||||
bool "Enable Scheduler Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable OS debug output (disabled by default)
|
||||
Enable OS debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_PAGING
|
||||
bool "Enable Demand Paging Debug Output"
|
||||
default n
|
||||
depends on PAGING
|
||||
---help---
|
||||
Enable demand paging debug output (disabled by default)
|
||||
Enable demand paging debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_NET
|
||||
bool "Enable Network Debug Output"
|
||||
default n
|
||||
depends on NET
|
||||
---help---
|
||||
Enable network debug output (disabled by default)
|
||||
Enable network debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_USB
|
||||
bool "Enable USB Debug Output"
|
||||
default n
|
||||
depends on USBDEV || USBHOST
|
||||
---help---
|
||||
Enable usb debug output (disabled by default)
|
||||
Enable usb debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_FS
|
||||
bool "Enable File System Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable file system debug output (disabled by default)
|
||||
Enable file system debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_LIB
|
||||
bool "Enable C Library Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable C library debug output (disabled by default)
|
||||
Enable C library debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_BINFMT
|
||||
bool "Enable Binary Loader Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable binary loader debug output (disabled by default)
|
||||
Enable binary loader debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_GRAPHICS
|
||||
bool "Enable Graphics Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable NX graphics debug output (disabled by default)
|
||||
Enable NX graphics debug SYSLOG output (disabled by default)
|
||||
|
||||
comment "Driver Debug Options"
|
||||
|
||||
@@ -384,21 +379,21 @@ config DEBUG_LCD
|
||||
default n
|
||||
depends on LCD
|
||||
---help---
|
||||
Enable low level debug output from the LCD driver (disabled by default)
|
||||
Enable low level debug SYSLOG output from the LCD driver (disabled by default)
|
||||
|
||||
config DEBUG_INPUT
|
||||
bool "Enable Input Device Debug Output"
|
||||
default n
|
||||
depends on INPUT
|
||||
---help---
|
||||
Enable low level debug output from the input device drivers such as
|
||||
Enable low level debug SYSLOG output from the input device drivers such as
|
||||
mice and touchscreens (disabled by default)
|
||||
|
||||
config DEBUG_ANALOG
|
||||
bool "Enable Analog Device Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable low level debug output from the analog device drivers such as
|
||||
Enable low level debug SYSLOG output from the analog device drivers such as
|
||||
A/D and D/A converters (disabled by default)
|
||||
|
||||
config DEBUG_I2C
|
||||
@@ -406,27 +401,27 @@ config DEBUG_I2C
|
||||
default n
|
||||
depends on I2C
|
||||
---help---
|
||||
Enable I2C driver debug output (disabled by default)
|
||||
Enable I2C driver debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_SPI
|
||||
bool "Enable SPI Debug Output"
|
||||
default n
|
||||
depends on SPI
|
||||
---help---
|
||||
Enable I2C driver debug output (disabled by default)
|
||||
Enable I2C driver debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_DMA
|
||||
bool "Enable DMA Debug Output"
|
||||
default n
|
||||
---help---
|
||||
Enable DMA-releated debug output (disabled by default)
|
||||
Enable DMA-releated debug SYSLOG output (disabled by default)
|
||||
|
||||
config DEBUG_WATCHDOG
|
||||
bool "Enable Watchdog Timer Debug Output"
|
||||
default n
|
||||
depends on WATCHDOG
|
||||
---help---
|
||||
Enable watchdog timer debug output (disabled by default)
|
||||
Enable watchdog timer debug SYSLOG output (disabled by default)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
+41
-14
@@ -280,8 +280,14 @@ NuttX Configuration Tool
|
||||
|
||||
make menuconfig
|
||||
|
||||
This make target will bring up NuttX configuration menus. The
|
||||
'menuconfig' target depends on two things:
|
||||
This make target will bring up NuttX configuration menus.
|
||||
|
||||
WARNING: Never do 'make menuconfig' on a configuration that has
|
||||
not been converted to use the kconfig-frontends tools! This will
|
||||
damage your configuration (see
|
||||
http://www.nuttx.org/doku.php?id=wiki:howtos:convertconfig).
|
||||
|
||||
The 'menuconfig' make target depends on two things:
|
||||
|
||||
1. The Kconfig configuration data files that appear in almost all
|
||||
NuttX directories. These data files are the part that is still
|
||||
@@ -319,6 +325,22 @@ NuttX Configuration Tool
|
||||
This is pretty straight forward for creating new configurations
|
||||
but may be less intuitive for modifying existing configurations.
|
||||
|
||||
Refreshing Configurations with 'make oldconfig'
|
||||
-----------------------------------------------
|
||||
|
||||
Whenever you use a configuration, you really should always do
|
||||
the following *before* you make NuttX:
|
||||
|
||||
make oldconfig
|
||||
|
||||
This will make sure that the configuration is up-to-date in
|
||||
the event that it has lapsed behind the current NuttX development.
|
||||
|
||||
WARNING: Never do 'make oldconfig' (OR 'make menuconfig') on a
|
||||
configuration that has not been converted to use the kconfig-frontends
|
||||
tools! This will damage your configuration (see
|
||||
http://www.nuttx.org/doku.php?id=wiki:howtos:convertconfig).
|
||||
|
||||
Incompatibilities with Older Configurations
|
||||
-------------------------------------------
|
||||
|
||||
@@ -501,8 +523,21 @@ NuttX Buildroot Toolchain
|
||||
|
||||
Disadvantages: This tool chain is not was well supported as some other
|
||||
toolchains. GNU tools are not my priority and so the buildroot tools
|
||||
often get behind. For example, the is still no EABI support in the
|
||||
NuttX buildroot toolchain for ARM.
|
||||
often get behind. For example, until recently there was no EABI support
|
||||
in the NuttX buildroot toolchain for ARM.
|
||||
|
||||
NOTE: For Cortex-M3/4, there are OABI and EABI versions of the buildroot
|
||||
toolchains. If you are using the older OABI toolchain the prefix for
|
||||
the tools will be arm-nuttx-elf-; for the EABI toolchin the prefix will
|
||||
be arm-nuttx-eabi-. If you are using the older OABI toolchain with
|
||||
an ARM Cortex-M3/4, you will need to set CONFIG_ARMV7M_OABI_TOOLCHAIN
|
||||
in the .config file in order to pick the right tool prefix.
|
||||
|
||||
If the make system ever picks the wrong prefix for your toolchain, you
|
||||
can always specify the prefix on the command to override the default
|
||||
like:
|
||||
|
||||
make CROSSDEV=arm-nuttx-elf
|
||||
|
||||
SHELLS
|
||||
^^^^^^
|
||||
@@ -1159,17 +1194,9 @@ apps
|
||||
|- NxWidgets/
|
||||
| `- README.txt
|
||||
|- system/
|
||||
| |- i2c/README.txt
|
||||
| |- free/README.txt
|
||||
| |- install
|
||||
| |- i2c
|
||||
| | `- README.txt
|
||||
| |- poweroff
|
||||
| | `- README.txt
|
||||
| |- ramtron
|
||||
| | `- README.txt
|
||||
| |- sdcard
|
||||
| | `- README.txt
|
||||
| `- sysinfo
|
||||
| `- install
|
||||
| `- README.txt
|
||||
`- README.txt
|
||||
|
||||
|
||||
@@ -3440,3 +3440,323 @@ Bugfixes (see the change log for details). Some of these are very important
|
||||
* Applications: Modbus fixes from Freddie Chopin.
|
||||
|
||||
As well as other, less critical bugs (see the ChangeLog for details)
|
||||
|
||||
NuttX-6.25
|
||||
^^^^^^^^^^
|
||||
|
||||
The 92nd release of NuttX, Version 6.25, was made on February 1, 2013,
|
||||
and is available for download from the SourceForge website. Note
|
||||
that release consists of two tarballs: nuttx-6.25.tar.gz and
|
||||
apps-6.25.tar.gz. Both may be needed (see the top-level nuttx/README.txt
|
||||
file for build information).
|
||||
|
||||
This release corresponds with SVN release number: r5595
|
||||
|
||||
Note that all SVN information has been stripped from the tarballs. If you
|
||||
need the SVN configuration information, you should check out directly from
|
||||
SVN. Revision r5595 should equivalent to release 6.25 of NuttX:
|
||||
|
||||
svn checkout -r5595 svn://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Or (HTTP):
|
||||
|
||||
svn checkout -r5595 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
|
||||
|
||||
Additional new features and extended functionality:
|
||||
|
||||
* OS Initialization
|
||||
|
||||
- Removed support for CONFIG_BUILTIN_APP_START. This is not really a
|
||||
useful feature and creates a violation of the OS layered
|
||||
architecture.
|
||||
|
||||
* Task Creation:
|
||||
|
||||
- Implement a simple vfork(). In NuttX-6.25, this interface is
|
||||
available only for ARM7/9, ARMv7-M (Cortext-M3/4), and MIPS32
|
||||
(PIC32MX) platforms.
|
||||
- exec() now sets the priority of the new task to the same priority as
|
||||
the parent task (instead of the arbirtrary value of 50).
|
||||
- New, partially complient implementations of execv() and execl().
|
||||
These are only partially compliant because they do not overlay any
|
||||
existing "process space" but rather create the new task and exit().
|
||||
- Add a complete implementation of posix_spawn(). This standard
|
||||
interface is a better match for an MMU-less architecture than are
|
||||
vfork() plus execv() or execl().
|
||||
- Add a task start hook that will be called before the task main
|
||||
is started. This can be used, for example, to schedule C++
|
||||
static constructors to run automatically in the context of the
|
||||
new task.
|
||||
|
||||
* Task Parentage
|
||||
|
||||
- Repartitioned tasking data structures. All shared resources are now
|
||||
collected together in a "task group". A task group includes the
|
||||
original task plus all of the pthreads created by the task.
|
||||
- Added support for remember the parent "task group" when a new task is
|
||||
started.
|
||||
- Added optional support to record the membership of each thread in
|
||||
the "task group".
|
||||
- Implement support for retaining child task status in the "task group"
|
||||
after the child task exists. This is behavior required by POSIX.
|
||||
But in NuttX is only enabled with CONFIG_SCHED_HAVE_PARENT and
|
||||
CONFIG_SCHED_CHILD_STATUS
|
||||
- Add internal logic to "reparent" a task. This is useful,
|
||||
for example, where the child task is created through a trampoline
|
||||
task that redirects I/O. Reparenting allows the caller of posix_spawn()
|
||||
to be reparented for the eventual child thread.
|
||||
- Added support for SIGCHLD. Sent to all members of the parent task
|
||||
group when the file member of the child task group exits.
|
||||
- If SIGCHLD and retention of child task exist status are enabled, then
|
||||
a more spec-compliant version of waitpid() is enabled.
|
||||
- New interfaces waitid() and wait() are also enabled when SIGCHLD
|
||||
is enabled.
|
||||
|
||||
* File System
|
||||
|
||||
- dup() and dup2() can new be used with opened files in a mounted file
|
||||
system. This supports re-direction of output in NSH to files.
|
||||
- The binfs file system was moved from apps/builtin to fs/binfs. The
|
||||
binfs file system was extended to support execution of "builtin
|
||||
applications" using exec(), execv(), execl(), or posix_spawn().
|
||||
- Added logic based on SIGCHLD to automatically unload and clean-up
|
||||
after running a task that was loaded into memory.
|
||||
|
||||
* Binary Formats
|
||||
|
||||
- Much of the logic for "builtin applications" was moved from
|
||||
apps/builtin to nuttx/binfmt/libbuiltin. Includes some extensions
|
||||
contributed by Mike Smith.
|
||||
- A binary loader was added for builtin applications to support
|
||||
execution of "builtin applications" using exec(), execv(),
|
||||
execl(), or posix_spawn().
|
||||
|
||||
* Drivers:
|
||||
|
||||
- Added logic to marshal and serialized "out-of-band" keyboard
|
||||
commands (such as cursor controls and key release events) intermixed
|
||||
with normal ASCII keypress data. The encoding is partially integrated
|
||||
in the HID keyboard driver and the decoding full integrated into the
|
||||
apps/examples hidkbd and keypadtest (the latter contributed by Denis
|
||||
Carlikli).
|
||||
- Driver for the UG-2864HSWEG01 OLED contributed by Darcy Gong.
|
||||
- Add support for removable serial devices (like USB serial). This
|
||||
support is enabled by CONFIG_SERIAL_REMOVABLE.
|
||||
|
||||
* ARMv7-M:
|
||||
|
||||
- Added an option to use the BASEPRI register to disable interrupts
|
||||
(instead of the PRIMASK). This eliminates some innocuous hardfaults
|
||||
that interfere with some debug tools. You need to switch to the
|
||||
BASEPRI method only if you have such tool interference.
|
||||
|
||||
* STM32 Drivers
|
||||
|
||||
- Bring STM32 F1 DMA capabilities up to par with the STM32 F2/F4
|
||||
(contributed by Mike Smith).
|
||||
- Add support for USART single wire mode (Contributed by the PX4
|
||||
team).
|
||||
- Updates to support for SPI DMA on the STM32 F1/F2/F4. From
|
||||
Petteri Aimonen.
|
||||
|
||||
* STM32 Boards:
|
||||
|
||||
- New configuration to support the UG-2864HSWEG01 OLED on the
|
||||
STM32F4Discovery board.
|
||||
- Added a posix_spawn() test configuration for the STM32F4Discovery.
|
||||
|
||||
* LM3S/LM4F
|
||||
|
||||
- Files and directories repartitioned to support both LM3S and LM4F
|
||||
using the STM32 organization as a model.
|
||||
- Partial definitions for the LM4F contributed by Jose Pablo Carballo
|
||||
(this is still a work in progress).
|
||||
|
||||
* LM3S Boards
|
||||
|
||||
- Added scripts and documentation to use OpenOCD with the LM3S (from
|
||||
Jose Pablo Carballo).
|
||||
|
||||
* LPC176x/LPC178x
|
||||
|
||||
- Files and directories repartitioned to support both LPC175x/LPC176x
|
||||
and the LPC177x/LPC178x families using the STM32 organization as a
|
||||
model. The LPC1788 port is a work in progress by Rommel Marcelo.
|
||||
|
||||
* LPC176x/LPC178x Boards:
|
||||
|
||||
- Added a configuration to support the Wave Share Open1788 board.
|
||||
This is still a work in progress by Rommel Marcelo.
|
||||
|
||||
* LPC2148 Boards:
|
||||
|
||||
- Add basic support for the The0.net ZP213x/4xPA board (with the LPC2148
|
||||
and the UG_2864AMBAG01 OLED).
|
||||
- Add an nxlines configuration for the ZP213x/4xPA (with the LPC2148
|
||||
and the UG_2864AMBAG01).
|
||||
|
||||
* Simulator:
|
||||
|
||||
- Add an nxlines configuration for the simulator.
|
||||
|
||||
* Networking:
|
||||
|
||||
- Add logic to work around delayed ACKs by splitting packets
|
||||
(contributed by Yan T.).
|
||||
- Split net_poll() to create the internal interface psock_poll().
|
||||
|
||||
* LCDs:
|
||||
|
||||
- Added support for LCD1602 alphanumeric LCD (HD4468OU controller).
|
||||
|
||||
* Graphics:
|
||||
|
||||
- Added 5x8 monospace font. This tiny font is useful for graph
|
||||
labels and for small bitmapped display. Contributed by Petteri
|
||||
Aimonen.
|
||||
|
||||
* Build System:
|
||||
|
||||
- Add an options to better manage toolchain prefixes.
|
||||
- Redesigned how the context targer works in the apps/ directory.
|
||||
The old design caused lots of problems when changing configurations
|
||||
because there is no easy way to get the system to rebuild the
|
||||
context. This change should solve most the problems and eliminate
|
||||
questions like "Why don't I see my builtin application in NSH?"
|
||||
|
||||
* Kconfig Files:
|
||||
|
||||
- There are several new configurations that use the kconfig-frontends
|
||||
tools and several older configurations that have been converted to
|
||||
use these tools. There is still a long way to go before the conversion
|
||||
is complete:
|
||||
|
||||
configs/sim/nxwm
|
||||
configs/sim/nsh
|
||||
configs/stm3220g-eval/nxwm
|
||||
configs/stm32f4discovery/posix_spawn
|
||||
configs/olimex-lpc1766stk/nsh
|
||||
configs/olimex-lpc1766stk/hidkbd
|
||||
configs/olimex-lpc1766stk/nettest
|
||||
configs/open1788/ostest
|
||||
configs/stm32f4discovery/nsh
|
||||
configs/stm32f4discovery/usbnsh
|
||||
configs/lm326965-ek (all configurations)
|
||||
configs/mcu123-214x/nsh
|
||||
configs/ubw32/ostest
|
||||
|
||||
* Tools:
|
||||
|
||||
- tools/kconfig.bat: Kludge to run kconfig-frontends from a DOS shell.
|
||||
- tools/configure.c: configure.c can be used to build a work-alike
|
||||
program as a replacement for configure.sh. This work-alike
|
||||
program would be used in environments that do not support Bash
|
||||
scripting (such as the Windows native environment).
|
||||
- tools/configure.bat: configure.bat is a small Windows batch
|
||||
file that can be used as a replacement for configure.sh in a
|
||||
Windows native environment. configure.bat is actually just a
|
||||
thin layer that executes configure.exe if it is available. If
|
||||
configure.exe is not available, then configure.bat will attempt
|
||||
to build it first.
|
||||
|
||||
* Applications:
|
||||
|
||||
- New and modified examples:
|
||||
|
||||
apps/examples/wlan: Remove non-functional example.
|
||||
apps/examples/ostest: Added a test of vfork(). Extend signal
|
||||
handler test to catch death-of-child signals (SIGCHLD). Add a
|
||||
test for waitpid(), waitid(), and wait().
|
||||
apps/exampes/posix_spawn: Added a test of posix_spawn().
|
||||
|
||||
- NSH:
|
||||
|
||||
NSH now supports re-direction of I/O to files (but still not from).
|
||||
The block driver source argument to the mount command is now
|
||||
optional for file systems that do not require a block driver.
|
||||
NSH can now execute a program from a file system using posix_spawn().
|
||||
Added support for a login script. The init.d/rcS script will be
|
||||
executed once when NSH starts; the .nshrc script will be executed
|
||||
for each session: Once for serial, once for each USB connection,
|
||||
once for each Telnet session.
|
||||
|
||||
- Supports a new daemon that can be used to monitor USB trace outpout.
|
||||
- Removed non-functional wlan example.
|
||||
|
||||
Bugfixes (see the ChangeLog for details). Some of these are very important:
|
||||
|
||||
* Tasking:
|
||||
|
||||
- Fixed a *critical* task exit bug. Here is the failure scenario:
|
||||
(1) sched_lock() is called increments the lockcount on the current
|
||||
TCB (i.e., the one at the head of the ready to run list), (2)
|
||||
sched_mergepending is called which may change the task at the head
|
||||
of the ready-to-run list, then (3) sched_unlock() is called which
|
||||
decrements the lockcount on the wrong TCB. The failure case that
|
||||
I saw was that pre-emption got disabled in the IDLE thread, locking
|
||||
up the whole system.
|
||||
|
||||
* Signals:
|
||||
|
||||
- sigtimedwait() would return a bad signal number if the signal was
|
||||
already pending when the function was called.
|
||||
|
||||
* Drivers:
|
||||
|
||||
- Some SD cards will appear busy until switched to SPI mode for
|
||||
first time. Having a pull-up resistor on MISO may avoid this
|
||||
problem, but this fix from Petteri Aimonen makes it work also
|
||||
without pull-up.
|
||||
|
||||
* STM32 Drivers:
|
||||
|
||||
- STM32 FLASH driver counting error (from Freddie Chopin).
|
||||
- STM32 F4 maximum SPI frequency was wrong (corrected by Petteri
|
||||
Aimonen).
|
||||
|
||||
* STM32 Boards
|
||||
|
||||
- Due to cloning of untested code, the logic to control on-board
|
||||
LEDs did not work on any STM32 boards.
|
||||
- Serial devices number /dev/ttyS0-5 is there is a serial console,
|
||||
but /dev/ttyS1-6 if there is no serial console.
|
||||
|
||||
* Binary Formats
|
||||
|
||||
- C++ static constructors execute now using a start taskhook
|
||||
so that they execute in the context of the child task (instead
|
||||
of in the context of the parent task).
|
||||
|
||||
* File Systems:
|
||||
|
||||
- Several FAT-related bugs fixed by Petteri Aimonen.
|
||||
|
||||
* Networking:
|
||||
|
||||
- Fix poll/select issure reported by Qiang: poll_interrupt() must call
|
||||
net_lostconnection() when a loss of connection is reported. Otherwise,
|
||||
the system will not remember that the connection has been lost and will
|
||||
hang waiting on a unconnected socket later.
|
||||
- Similar issues corrected for recvfrom() and send().
|
||||
- Telnetd would hang in a loop if recv() ever returned a value <= 0.
|
||||
|
||||
* Libraries:
|
||||
|
||||
- fread() could hang on certain error conditions.
|
||||
- Can't handle SYSLOG output to a character device from the IDLE task
|
||||
(because the IDLE task can't block).
|
||||
|
||||
* Build System:
|
||||
|
||||
- Serial was driver was not being built if there is no console
|
||||
device. Obviously, the serial driver may be needed even in
|
||||
this case.
|
||||
|
||||
* Additional Bugfixes:
|
||||
|
||||
- sig_timedwait() and clock_time2ticks.c: Timing "rounding" logic
|
||||
- ARM9 Compilation issue with low vectors.
|
||||
- readline() return value
|
||||
- Others as detailed in the ChangeLog: HID keyboard, LPC17xx bit
|
||||
definitions, strndup(), PL2303, SYSLOG error handling, AT25,
|
||||
apps/examples.
|
||||
|
||||
+30
-56
@@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated January 23, 2013)
|
||||
NuttX TODO List (Last updated January 30, 2013)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
@@ -7,14 +7,14 @@ standards, things that could be improved, and ideas for enhancements.
|
||||
nuttx/
|
||||
|
||||
(11) Task/Scheduler (sched/)
|
||||
(1) Memory Managment (mm/)
|
||||
(2) Memory Managment (mm/)
|
||||
(3) Signals (sched/, arch/)
|
||||
(2) pthreads (sched/)
|
||||
(2) C++ Support
|
||||
(6) Binary loaders (binfmt/)
|
||||
(17) Network (net/, drivers/net)
|
||||
(16) Network (net/, drivers/net)
|
||||
(4) USB (drivers/usbdev, drivers/usbhost)
|
||||
(12) Libraries (libc/, )
|
||||
(11) Libraries (libc/, )
|
||||
(9) File system/Generic drivers (fs/, drivers/)
|
||||
(5) Graphics subystem (graphics/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
@@ -161,25 +161,6 @@ o Task/Scheduler (sched/)
|
||||
Status: Open
|
||||
Priority: Medium Low for now
|
||||
|
||||
Title: IMPROVED TASK CONTROL BLOCK STRUCTURE
|
||||
Description: All task resources that are shared amongst threads have
|
||||
their own "break-away", reference-counted structure. The
|
||||
Task Control Block (TCB) of each thread holds a reference
|
||||
to each breakaway structure (see include/nuttx/sched.h).
|
||||
It would be more efficent to have one reference counted
|
||||
structure that holds all of the shared resources.
|
||||
|
||||
These are the current shared structures:
|
||||
- Environment varaibles (struct environ_s)
|
||||
- PIC data space and address environments (struct dspace_s)
|
||||
- File descriptors (struct filelist)
|
||||
- FILE streams (struct streamlist)
|
||||
- Sockets (struct socketlist)
|
||||
Status: Open
|
||||
Priority: Low. This is an enhancement. It would slight reduce
|
||||
memory usage but would also increase coupling. These
|
||||
resources are nicely modular now.
|
||||
|
||||
Title: ISSUES WITH atexit() AND on_exit()
|
||||
Description: These functions execute with the following bad properties:
|
||||
|
||||
@@ -212,6 +193,16 @@ o Task/Scheduler (sched/)
|
||||
Status: Open
|
||||
Priority: Low (it might as well be low since it isn't going to be fixed).
|
||||
|
||||
Title: errno IS NOT SHARED AMONG THREADS
|
||||
Description: In NuttX, the errno value is unique for each thread. But for
|
||||
bug-for-bug compatibility, the same errno should be shared by
|
||||
the task and each thread that it creates. It is *very* easy
|
||||
to make this change: Just move the pterrno field from
|
||||
_TCB to struct task_group_s. However, I am still not sure
|
||||
if this should be done or not.
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
o Memory Managment (mm/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -278,6 +269,19 @@ o Memory Managment (mm/)
|
||||
Priority: Medium/Low, a good feature to prevent memory leaks but would
|
||||
have negative impact on memory usage and code size.
|
||||
|
||||
Title: CONTAINER ALLOCATOR
|
||||
Description: There are several places where the logic requires allocation of
|
||||
a tiny structure that just contains pointers to other things or
|
||||
small amounts of data that needs to be bundled together. There
|
||||
are examples net/net_poll.c and numerous other places.
|
||||
|
||||
I am wondering if it would not be good create a pool of generic
|
||||
containers (say void *[4]). There re-use these when we need
|
||||
small containers. The code in sched/task_childstatus.c might
|
||||
be generalized for this purpose.
|
||||
Status: Open
|
||||
Priority: Very low (I am not even sure that this is a good idea yet).
|
||||
|
||||
o Signals (sched/, arch/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -413,6 +417,9 @@ o Binary loaders (binfmt/)
|
||||
Description: Not all of the NXFLAT test under apps/examples/nxflat are working.
|
||||
Most simply do not compile yet. tests/mutex runs okay but
|
||||
outputs garbage on completion.
|
||||
|
||||
Update: 13-27-1, tests/mutex crashed with a memory corruption
|
||||
problem the last time that I ran it.
|
||||
Status: Open
|
||||
Priority: High
|
||||
|
||||
@@ -667,21 +674,6 @@ o Network (net/, drivers/net)
|
||||
Status: Open
|
||||
Priority: Low... fix defconfig files as necessary.
|
||||
|
||||
Title: net_poll() DOES NOT HANDLE LOSS-OF-CONNECTION CORRECTLY
|
||||
Description: When a loss of connection is detected by any logic waiting on the
|
||||
networking events, the function net_lostconnection() must be called.
|
||||
That function just sets some bits in the socket structure so that
|
||||
it remembers that the connection is lost.
|
||||
|
||||
That is currently done in recvfrom(), send(), and net_monitor.c. But
|
||||
it is not done in the net_poll() logic; that logic correctly sets
|
||||
the POLLHUP status, but it does not call net_lostconnection(). As a
|
||||
result, if recv() is called after the poll() or select(), the system
|
||||
will hang because the recv() does not know that the connection has
|
||||
been lost.
|
||||
Status: Open
|
||||
Priority: High
|
||||
|
||||
o USB (drivers/usbdev, drivers/usbhost)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -820,19 +812,6 @@ o Libraries (libc/)
|
||||
Status: Open
|
||||
Priority: ??
|
||||
|
||||
Title: SYSLOG INTEGRATION
|
||||
Description: There are the beginnings of some system logging capabilities (see
|
||||
drivers/syslog, fs/fs_syslog.c, and libc/stdio/lib_librawprintf.c and
|
||||
lib_liblowprintf.c. For NuttX, SYSLOG is a concept and includes,
|
||||
extends, and replaces the legacy NuttX debug ouput. Some additional
|
||||
integration is required to formalized this. For example:
|
||||
|
||||
o lib_rawprintf() shjould be renamed syslog().
|
||||
o debug.h should be renamed syslog.h
|
||||
o And what about lib_lowprintf()? llsyslog?
|
||||
Status: Open
|
||||
Priority: Low -- more of a roadmap
|
||||
|
||||
Title: FLOATING POINT FORMATS
|
||||
Description: Only the %f floating point format is supported. Others are accepted
|
||||
but treated like %f.
|
||||
@@ -1526,11 +1505,6 @@ o ARM/STM32 (arch/arm/src/stm32/)
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
Title: STM32 F4 USB OTG FS DEVICE-SIDE DRIVER
|
||||
Description: This driver is reported to be buggy and to need some TLC.
|
||||
Status: Open
|
||||
Priority: High
|
||||
|
||||
o AVR (arch/avr)
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# arch/arm/src/armv7-m/Toolchain.defs
|
||||
#
|
||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -141,8 +141,8 @@ endif
|
||||
# Atollic toolchain under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC)
|
||||
CROSSDEV = arm-atollic-eabi-
|
||||
ARCROSSDEV = arm-atollic-eabi-
|
||||
CROSSDEV ?= arm-atollic-eabi-
|
||||
ARCROSSDEV ?= arm-atollic-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
@@ -161,12 +161,12 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),BUILDROOT)
|
||||
ifeq ($(CONFIG_ARMV7M_OABI_TOOLCHAIN),y)
|
||||
CROSSDEV = arm-nuttx-elf-
|
||||
ARCROSSDEV = arm-nuttx-elf-
|
||||
CROSSDEV ?= arm-nuttx-elf-
|
||||
ARCROSSDEV ?= arm-nuttx-elf-
|
||||
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
|
||||
else
|
||||
CROSSDEV = arm-nuttx-eabi-
|
||||
ARCROSSDEV = arm-nuttx-eabi-
|
||||
CROSSDEV ?= arm-nuttx-eabi-
|
||||
ARCROSSDEV ?= arm-nuttx-eabi-
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
endif
|
||||
MAXOPTIMIZATION = -Os
|
||||
@@ -175,8 +175,8 @@ endif
|
||||
# Code Red RedSuite under Linux
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDL)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
@@ -191,8 +191,8 @@ endif
|
||||
# Code Red RedSuite under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
@@ -210,8 +210,8 @@ endif
|
||||
# CodeSourcery under Linux
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYL)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O2
|
||||
endif
|
||||
@@ -219,8 +219,8 @@ endif
|
||||
# CodeSourcery under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYW)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
@@ -230,8 +230,8 @@ endif
|
||||
# devkitARM under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),DEVKITARM)
|
||||
CROSSDEV = arm-eabi-
|
||||
ARCROSSDEV = arm-eabi-
|
||||
CROSSDEV ?= arm-eabi-
|
||||
ARCROSSDEV ?= arm-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
@@ -241,8 +241,8 @@ endif
|
||||
# Generic GNU EABI toolchain on OS X, Linux or any typical Posix system
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),GNU_EABI)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
MAXOPTIMIZATION = -O3
|
||||
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
@@ -258,8 +258,8 @@ endif
|
||||
# Raisonance RIDE7 under Windows
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),RAISONANCE)
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCROSSDEV = arm-none-eabi-
|
||||
CROSSDEV ?= arm-none-eabi-
|
||||
ARCROSSDEV ?= arm-none-eabi-
|
||||
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
WINTOOL = y
|
||||
endif
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
# define lldbg lowsyslog
|
||||
#endif
|
||||
|
||||
/* The following is just intended to keep some ugliness out of the mainline
|
||||
@@ -70,7 +70,7 @@
|
||||
*
|
||||
* CONFIG_TASK_NAME_SIZE > 0 && <-- The task has a name
|
||||
* (defined(CONFIG_DEBUG) || <-- And the debug is enabled (lldbg used)
|
||||
* defined(CONFIG_ARCH_STACKDUMP) <-- Or lib_lowprintf() is used
|
||||
* defined(CONFIG_ARCH_STACKDUMP) <-- Or lowsyslog() is used
|
||||
*/
|
||||
|
||||
#undef CONFIG_PRINT_TASKNAME
|
||||
@@ -267,7 +267,8 @@ static void up_dumpstate(void)
|
||||
* Name: _up_assert
|
||||
****************************************************************************/
|
||||
|
||||
static void _up_assert(int errorcode) /* noreturn_function */
|
||||
static void _up_assert(int errorcode) noreturn_function;
|
||||
static void _up_assert(int errorcode)
|
||||
{
|
||||
/* Are we in an interrupt handler or the idle task? */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user