9
0
Fork 0

Beginning of a NuttX configuration tool

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4560 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-04-05 17:44:04 +00:00
parent cf0c72e1fb
commit 00ce824a19
6 changed files with 711 additions and 82 deletions

Binary file not shown.

View File

@ -2615,3 +2615,8 @@
* fs/fs_read.c: Fix read() return value for attempt to read from write-only
file or device. Was returning EBADF, should return EACCES.
* graphics/nxconsole.c: NxConsole now supports backspace and a cursor.
* Kconfig and arch/sim/Kconfig: Beginnings of support for a NuttX
configuration tool. Currently using the kconfig parser 'kconfig-frontend'
available at http://ymorin.is-a-geek.org/projects/kconfig-frontends
(version 3.3.0-1 is also available in the NuttX SVN at
trunk/misc/tools/kconfig-frontends-3.3.0-1.tar.xz

478
nuttx/Kconfig Normal file
View File

@ -0,0 +1,478 @@
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Nuttx/$ARCH Configuration"
config SRCARCH
string
option env="SRCARCH"
menu "General setup"
config EXPERIMENTAL
bool "Prompt for development and/or incomplete code/drivers"
comment "General build options"
config RRLOAD_BINARY
bool "rrload binary format"
default "n"
config INTELHEX_BINARY
bool "Intel HEX binary format"
default "n"
config MOTOROLA_SREC
bool "Motorola S-Record binary format"
default "n"
config RAW_BINARY
bool "raw binary format"
default "n"
config HAVE_LIBM
bool "supports libm.a"
default "n"
comment "General debug options"
config DEBUG
bool "enable debug"
default "n"
config DEBUG_VERBOSE
bool "enable verbose debug output"
depends on DEBUG
default "n"
config DEBUG_SYMBOLS
bool "build with debug symbols"
default "n"
endmenu
menu "System Type"
source "arch/$SRCARCH/Kconfig"
config ARCH_LOWPUTC
bool "low-level console output"
default "y"
---help---
architecture supports low-level, boot time console output
comment "Architecture optimized function"
config ARCH_MEMCPY
bool "memcpy"
default n
config ARCH_MEMCMP
bool "memcmp"
default n
config ARCH_MEMMOVE
bool "memmove"
default n
config ARCH_MEMSET
bool "memset"
default n
config ARCH_STRCMP
bool "strcmp"
default n
config ARCH_STRCPY
bool "strcpy"
default n
config ARCH_STRNCPY
bool "strncpy"
default n
config ARCH_STRLEN
bool "strlen"
default n
config ARCH_STRNLEN
bool "strlen"
default n
config ARCH_BZERO
bool "bzero"
default n
endmenu
menu "Kernel Features"
config MM_REGIONS
int "number of memory regions"
default 1
---help---
If the architecture includes multiple
regions of memory to allocate from, this specifies the
number of memory regions that the memory manager must
handle and enables the API mm_addregion(start, end);
config MSEC_PER_TICK
int "tick timer"
default 10
---help---
The default system timer is 100Hz
or MSEC_PER_TICK=10. This setting may be defined to
inform NuttX that the processor hardware is providing
system timer interrupts at some interrupt interval other
than 10 msec.
config RR_INTERVAL
int "round robin timeslice"
default 0
---help---
The round robin timeslice will be set
this number of milliseconds; Round robin scheduling can
be disabled by setting this value to zero.
config SCHED_INSTRUMENTATION
bool "monitor system performance"
default n
---help---
enables instrumentation in
scheduler to monitor system performance
config TASK_NAME_SIZE
int "task name size"
default 32
---help---
Spcifies that maximum size of a
task name to save in the TCB. Useful if scheduler
instrumentation is selected. Set to zero to disable.
config JULIAN_TIME
bool "Enables Julian time conversions"
default n
---help---
Enables Julian time conversions
config START_YEAR
int "start year"
default 2010
config START_MONTH
int "start month"
default 1
config START_DAY
int "start day"
default 1
config DEV_CONSOLE
bool "enable /dev/console"
default y
---help---
Set if architecture-specific logic
provides /dev/console. Enables stdout, stderr, stdin.
config DEV_LOWCONSOLE
bool "enable low-level serial console"
default n
---help---
Use the simple, low-level serial console
driver (minimul support)
config MUTEX_TYPES:
bool "enable mutex types"
default n
---help---
Set to enable support for recursive and
errorcheck mutexes. Enables pthread_mutexattr_settype().
config PRIORITY_INHERITANCE
bool "enable priority inheritance "
default n
---help---
Set to enable support for priority
inheritance on mutexes and semaphores.
config SEM_PREALLOCHOLDERS
int "pre alloc holders"
default 16
depends on PRIORITY_INHERITANCE
---help---
This setting is only used if priority
inheritance is enabled. It defines the maximum number of
different threads (minus one) that can take counts on a
semaphore with priority inheritance support. This may be
set to zero if priority inheritance is disabled OR if you
are only using semaphores as mutexes (only one holder) OR
if no more than two threads participate using a counting
semaphore.
config SEM_NNESTPRIO
int "maximum number of higher priority threads"
default 16
depends on PRIORITY_INHERITANCE
---help---
If priority inheritance is enabled,
then this setting is the maximum number of higher priority
threads (minus 1) than can be waiting for another thread
to release a count on a semaphore. This value may be set
to zero if no more than one thread is expected to wait for
a semaphore.
config FDCLONE_DISABLE
bool "disable clone all file descriptors"
default n
---help---
Disable cloning of all file descriptors
by task_create() when a new task is started. If set, all
files/drivers will appear to be closed in the new task.
config FDCLONE_STDIO
bool "disable clone file descriptors without stdio"
default n
---help---
Disable cloning of all but the first
three file descriptors (stdin, stdout, stderr) by task_create()
when a new task is started. If set, all files/drivers will
appear to be closed in the new task except for stdin, stdout,
and stderr.
config SDCLONE_DISABLE
bool "disable cloning of all socket"
default n
---help---
Disable cloning of all socket
desciptors by task_create() when a new task is started. If
set, all sockets will appear to be closed in the new task.
config DISABLE_OS_API
bool "disable os api"
default n
---help---
The following can be used to disable categories of
APIs supported by the OS. If the compiler supports
weak functions, then it should not be necessary to
disable functions unless you want to restrict usage
of those APIs.
There are certain dependency relationships in these
features.
o mq_notify logic depends on signals to awaken tasks
waiting for queues to become full or empty.
o pthread_condtimedwait() depends on signals to wake
up waiting tasks.
config DISABLE_CLOCK
bool "disable clock"
depends on DISABLE_OS_API
default n
config DISABLE_POSIX_TIMERS
bool "disable posix timers"
depends on DISABLE_OS_API
default n
config DISABLE_PTHREAD
bool "disable pthread"
depends on DISABLE_OS_API
default n
config DISABLE_SIGNALS
bool "disable signals"
depends on DISABLE_OS_API
default n
config DISABLE_MQUEUE
bool "disable mqueue"
depends on DISABLE_OS_API
default n
config DISABLE_MOUNTPOINT
bool "disable mount point"
depends on DISABLE_OS_API
default n
config DISABLE_ENVIRON
bool "disable environ"
depends on DISABLE_OS_API
default n
config DISABLE_POLL
bool "disable poll"
depends on DISABLE_OS_API
default n
comment "Sizes of configurable things (0 disables)"
config MAX_TASKS
int "max tasks"
default 32
---help---
The maximum number of simultaneously
active tasks. This value must be a power of two.
config MAX_TASK_ARGS
int "max task args"
default 4
---help---
This controls the maximum number of
of parameters that a task may receive (i.e., maxmum value
of 'argc')
config NPTHREAD_KEYS
int "number pthread keys"
default 4
---help---
The number of items of thread-
specific data that can be retained
config NFILE_DESCRIPTORS
int "max file descriptors"
default 16
---help---
The maximum number of file
descriptors (one for each open)
config NFILE_STREAMS
int "max file streams"
default 16
---help---
The maximum number of streams that
can be fopen'ed
config NAME_MAX
int "name max"
default 32
---help---
The maximum size of a file name.
config STDIO_BUFFER_SIZE
int "stdio buffer size"
default 256
---help---
Size of the buffer to allocate
on fopen. (Only if config _NFILE_STREAMS > 0)
config NUNGET_CHARS
int "number get chars"
default 2
---help---
Number of characters that can be
buffered by ungetc() (Only if config _NFILE_STREAMS > 0)
config PREALLOC_MQ_MSGS
int "pre alloc mq_msgs"
default 32
---help---
The number of pre-allocated message
structures. The system manages a pool of preallocated
message structures to minimize dynamic allocations
config MQ_MAXMSGSIZE
int "mq max message size"
default 32
---help---
Message structures are allocated with
a fixed payload size given by this settin (does not include
other message structure overhead.
config MAX_WDOGPARMS
int "max watchdog parms"
default 4
---help---
Maximum number of parameters that
can be passed to a watchdog handler
config PREALLOC_WDOGS
int "pre alloc watchdogs"
default 32
---help---
The number of pre-allocated watchdog
structures. The system manages a pool of preallocated
watchdog structures to minimize dynamic allocations
config PREALLOC_TIMERS
int "pre alloc timers"
default 8
---help---
The number of pre-allocated POSIX
timer structures. The system manages a pool of preallocated
timer structures to minimize dynamic allocations. Set to
zero for all dynamic allocations.
comment "Stack and heap information"
config BOOT_RUNFROMFLASH
bool "boot run from flash"
default n
---help---
Some configurations support XIP
operation from FLASH but must copy initialized .data sections to RAM.
(should also be =n for the LPC17xx which always runs from flash)
config BOOT_COPYTORAM
bool "boot copy to ram"
default n
---help---
Some configurations boot in FLASH
but copy themselves entirely into RAM for better performance.
config CUSTOM_STACK
bool "enable custom stack"
default n
---help---
The up_ implementation will handle
all stack operations outside of the nuttx model.
config STACK_POINTER
hex ""
default 0
---help---
The initial stack pointer (arm7tdmi only)
config IDLETHREAD_STACKSIZE
int "idle thread stack size"
default 1024
---help---
The size of the initial stack.
This is the thread that (1) performs the inital boot of the system up
to the point where user_start() is spawned, and (2) there after is the
IDLE thread that executes only when there is no other thread ready to
run.
config USERMAIN_STACKSIZE
int "main thread stack size"
default 2048
---help---
The size of the stack to allocate
for the main user thread that begins at the user_start() entry point.
config PTHREAD_STACK_MIN
int "minimum thrad stack size"
default 256
---help---
Minimum pthread stack size
config PTHREAD_STACK_DEFAULT
int "default stack size"
default 2048
---help---
Default pthread stack size
endmenu
menu "Device Drivers"
#source drivers/Kconfig
endmenu
menuconfig NET
bool "Networking support"
default "m"
if NET
#source net/Kconfig
endif
menu "File systems"
#source fs/Kconfig
endmenu
menu "Library routines"
config NOPRINTF_FIELDWIDTH
bool "disable sprintf support fieldwidth"
default n
---help---
sprintf-related logic is a
little smaller if we do not support fieldwidthes
endmenu
menu "Application setup"
endmenu

View File

@ -589,3 +589,8 @@ ifneq ($(APPDIR),)
@mv _SAVED_APPS_config "$(TOPDIR)/$(APPDIR)/.config" || \
{ echo "Copy of _SAVED_APPS_config failed" ; exit 1 ; }
endif
ARCH ?=sim
menuconfig:
SRCARCH=${ARCH} mconf Kconfig

View File

@ -365,20 +365,21 @@ static bool stm32_addlast(FAR struct stm32_ep_s *privep,
/* Low level data transfers and request operations *****************************/
static inline void stm32_ep0xfer(uint8_t epphy, uint8_t *data, uint32_t nbytes);
static inline void stm32_ep0xfer(uint8_t epphy, FAR uint8_t *data, uint32_t nbytes);
static void stm32_ep0read(FAR uint8_t *dest, uint16_t len);
static void stm32_flushep(struct stm32_ep_s *privep);
static void stm32_flushep(FAR struct stm32_ep_s *privep);
static inline void stm32_abortrequest(struct stm32_ep_s *privep,
struct stm32_req_s *privreq, int16_t result);
static void stm32_reqcomplete(struct stm32_ep_s *privep, int16_t result);
static inline void stm32_abortrequest(FAR struct stm32_ep_s *privep,
FAR struct stm32_req_s *privreq, int16_t result);
static void stm32_reqcomplete(FAR struct stm32_ep_s *privep, int16_t result);
static int stm32_wrrequest(struct stm32_usbdev_s *priv,
struct stm32_ep_s *privep);
static int stm32_rdrequest(struct stm32_usbdev_s *priv,
struct stm32_ep_s *privep);
static void stm32_cancelrequests(struct stm32_ep_s *privep, int16_t status);
static int stm32_wrrequest(FAR struct stm32_usbdev_s *priv,
FAR struct stm32_ep_s *privep);
static int stm32_rdrequest(FAR struct stm32_usbdev_s *priv,
FAR struct stm32_ep_s *privep);
static void stm32_cancelrequests(FAR struct stm32_ep_s *privep,
int16_t status);
/* Interrupt handling **********************************************************/
@ -386,7 +387,6 @@ static struct stm32_ep_s *stm32_epfindbyaddr(struct stm32_usbdev_s *priv,
uint16_t eplog);
static int stm32_dispatchrequest(struct stm32_usbdev_s *priv,
const struct usb_ctrlreq_s *ctrl);
static void stm32_ep0configure(struct stm32_usbdev_s *priv);
static void stm32_usbreset(struct stm32_usbdev_s *priv);
static void stm32_ep0complete(struct stm32_usbdev_s *priv, uint8_t epphy);
@ -416,6 +416,7 @@ static inline void stm32_epininterrupt(FAR struct stm32_usbdev_s *priv);
static inline void stm32_resumeinterrupt(FAR struct stm32_usbdev_s *priv);
static inline void stm32_suspendinterrupt(FAR struct stm32_usbdev_s *priv);
static inline void stm32_rxinterrupt(FAR struct stm32_usbdev_s *priv);
static inline void stm32_resetinterrupt(FAR struct stm32_usbdev_s *priv);
static inline void stm32_enuminterrupt(FAR struct stm32_usbdev_s *priv);
#ifdef CONFIG_USBDEV_ISOCHRONOUS
static inline void stm32_isocininterrupt(FAR struct stm32_usbdev_s *priv);
@ -431,9 +432,16 @@ static inline void stm32_otginterrupt(FAR struct stm32_usbdev_s *priv);
static int stm32_usbinterrupt(int irq, FAR void *context);
/* Endpoint operations *********************************************************/
/* Endpoint configuration */
static int stm32_epoutconfigure(FAR struct usbdev_ep_s *privep,
uint8_t eptype, uint16_t maxpacket);
static int stm32_epinconfigure(FAR struct usbdev_ep_s *privep,
uint8_t eptype, uint16_t maxpacket);
static int stm32_epconfigure(FAR struct usbdev_ep_s *ep,
const struct usb_epdesc_s *desc, bool last);
FAR const struct usb_epdesc_s *desc, bool last);
static void stm32_ep0configure(FAR struct stm32_usbdev_s *priv);
static int stm32_epdisable(FAR struct usbdev_ep_s *ep);
static FAR struct usbdev_req_s *stm32_epallocreq(FAR struct usbdev_ep_s *ep);
static void stm32_epfreereq(FAR struct usbdev_ep_s *ep,
@ -1065,23 +1073,6 @@ static int stm32_dispatchrequest(struct stm32_usbdev_s *priv,
return ret;
}
/*******************************************************************************
* Name: stm32_ep0configure
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
static void stm32_ep0configure(struct stm32_usbdev_s *priv)
{
/* Enable ep0 IN and ep0 OUT */
#warning "Missing Logic"
/* Enable EP0 */
#warning "Missing Logic"
}
/*******************************************************************************
* Name: stm32_usbreset
*
@ -2225,6 +2216,30 @@ static inline void stm32_rxinterrupt(FAR struct stm32_usbdev_s *priv)
#warning "Missing logic"
}
/*******************************************************************************
* Name: stm32_resetinterrupt
*
* Description:
* USB reset interrupt
*
*******************************************************************************/
static inline void stm32_resetinterrupt(FAR struct stm32_usbdev_s *priv)
{
/* Perform the device reset */
#warning "Reset hardware?"
/* Re-configure EP0 */
stm32_ep0configure(priv);
/* And put the device back in the initial state (no address, no
* configuration).
*/
priv->devstate = DEVSTATE_DEFAULT;
}
/*******************************************************************************
* Name: stm32_isocininterrupt
*
@ -2420,7 +2435,7 @@ static int stm32_usbinterrupt(int irq, FAR void *context)
if ((regval & OTGFS_GINT_USBRST) != 0)
{
usbtrace(TRACE_INTDECODE(STM32_TRACEINTID_DEVRESET), (uint16_t)regval);
stm32_usbreset(priv);
stm32_resetinterrupt(priv);
usbtrace(TRACE_INTEXIT(STM32_TRACEINTID_USB), 0);
return OK;
}
@ -2482,6 +2497,113 @@ static int stm32_usbinterrupt(int irq, FAR void *context)
* Endpoint operations
*******************************************************************************/
/*******************************************************************************
* Name: stm32_epoutconfigure
*
* Description:
* Configure an OUT endpoint, making it usable
*
* Input Parameters:
* ep - the struct usbdev_ep_s instance obtained from allocep()
* desc - A struct usb_epdesc_s instance describing the endpoint
* last - true if this this last endpoint to be configured. Some hardware
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
static int stm32_epoutconfigure(FAR struct usbdev_ep_s *privep, uint8_t eptype,
uint16_t maxpacket)
{
FAR struct stm32_ep_s *privep = (FAR struct stm32_ep_s *)ep;
usbtrace(TRACE_EPCONFIGURE, privep->epphy);
DEBUGASSERT(desc->addr == ep->eplog);
/* Setup Endpoint Control Register */
/* Reset the data toggles */
#warning "Missing logic"
/* Set the endpoint type */
switch (eptype)
{
case USB_EP_ATTR_XFER_CONTROL:
break;
case USB_EP_ATTR_XFER_ISOC:
break;
case USB_EP_ATTR_XFER_BULK:
break;
case USB_EP_ATTR_XFER_INT:
break;
}
#warning "Missing logic"
/* Reset endpoint status */
privep->stalled = false;
/* Enable the endpoint */
#warning "Missing logic"
return OK;
}
/*******************************************************************************
* Name: stm32_epinconfigure
*
* Description:
* Configure an IN endpoint, making it usable
*
* Input Parameters:
* ep - the struct usbdev_ep_s instance obtained from allocep()
* desc - A struct usb_epdesc_s instance describing the endpoint
* last - true if this this last endpoint to be configured. Some hardware
* needs to take special action when all of the endpoints have been
* configured.
*
*******************************************************************************/
static int stm32_epinconfigure(FAR struct usbdev_ep_s *privep, uint8_t eptype,
uint16_t maxpacket)
{
FAR struct stm32_ep_s *privep = (FAR struct stm32_ep_s *)ep;
usbtrace(TRACE_EPCONFIGURE, privep->epphy);
DEBUGASSERT(desc->addr == ep->eplog);
/* Setup Endpoint Control Register */
/* Reset the data toggles */
#warning "Missing logic"
/* Set the endpoint type */
switch (eptype)
{
case USB_EP_ATTR_XFER_CONTROL:
break;
case USB_EP_ATTR_XFER_ISOC:
break;
case USB_EP_ATTR_XFER_BULK:
break;
case USB_EP_ATTR_XFER_INT:
break;
}
#warning "Missing logic"
/* Reset endpoint status */
privep->stalled = false;
/* Enable the endpoint */
#warning "Missing logic"
return OK;
}
/*******************************************************************************
* Name: stm32_epconfigure
*
@ -2498,79 +2620,53 @@ static int stm32_usbinterrupt(int irq, FAR void *context)
*******************************************************************************/
static int stm32_epconfigure(FAR struct usbdev_ep_s *ep,
FAR const struct usb_epdesc_s *desc,
bool last)
FAR const struct usb_epdesc_s *desc,
bool last)
{
FAR struct stm32_ep_s *privep = (FAR struct stm32_ep_s *)ep;
uint16_t maxsize;
uint16_t maxpacket;
uint8_t eptype;
int ret;
usbtrace(TRACE_EPCONFIGURE, privep->epphy);
DEBUGASSERT(desc->addr == ep->eplog);
/* Initialise EP capabilities */
/* Initialize EP capabilities */
maxsize = GETUINT16(desc->mxpacketsize);
maxpacket = GETUINT16(desc->mxpacketsize);
eptype = desc->attr & USB_EP_ATTR_XFERTYPE_MASK;
#warning "Missing Logic"
/* Setup Endpoint Control Register */
if (privep->isin)
{
/* Reset the data toggles */
#warning "Missing logic"
/* Set the endpoint type */
switch (desc->attr & USB_EP_ATTR_XFERTYPE_MASK)
{
case USB_EP_ATTR_XFER_CONTROL:
break;
case USB_EP_ATTR_XFER_ISOC:
break;
case USB_EP_ATTR_XFER_BULK:
break;
case USB_EP_ATTR_XFER_INT:
break;
}
#warning "Missing logic"
ret = stm32_epinconfigure(privep, eptype, maxpacket);
}
else
{
/* Reset the data toggles */
#warning "Missing logic"
/* Set the endpoint type */
switch (desc->attr & USB_EP_ATTR_XFERTYPE_MASK)
{
case USB_EP_ATTR_XFER_CONTROL:
break;
case USB_EP_ATTR_XFER_ISOC:
break;
case USB_EP_ATTR_XFER_BULK:
break;
case USB_EP_ATTR_XFER_INT:
break;
}
#warning "Missing logic"
ret = stm32_epoutconfigure(privep, eptype, maxpackt);
}
/* Reset endpoint status */
return ret;
}
privep->stalled = false;
/*******************************************************************************
* Name: stm32_ep0configure
*
* Description:
* Reset Usb engine
*
*******************************************************************************/
/* Enable the endpoint */
static void stm32_ep0configure(FAR struct stm32_usbdev_s *priv)
{
/* Enable EP0 IN and OUT */
if (privep->isin)
{
#warning "Missing logic"
}
else
{
#warning "Missing logic"
}
return OK;
(void)stm32_epinconfigure(&priv->epin[EP0], USB_EP_ATTR_XFER_CONTROL,
CONFIG_USBDEV_EP0_MAXSIZE);
(void)stm32_epoutconfigure(&priv->epout[EP0], USB_EP_ATTR_XFER_CONTROL,
CONFIG_USBDEV_EP0_MAXSIZE);
}
/*******************************************************************************

45
nuttx/arch/sim/Kconfig Normal file
View File

@ -0,0 +1,45 @@
choice
prompt "Simulator system type"
default ARCH_SIM
config ARCH_SIM
bool "x86 Linux user-mode"
---help---
A user-mode port of NuttX to the x86 Linux platform is available.
The purpose of this port is primarily to support OS feature development.
This port does not support interrupts or a real timer (and hence no
round robin scheduler) Otherwise, it is complete.
endchoice
config ARCH
string
default "sim" if ARCH_SIM
choice
prompt "Simulator board type"
default ARCH_BOARD_SIM
config ARCH_BOARD_SIM
bool "x86 Linux user-mode"
---help---
A user-mode port of NuttX to the x86 Linux platform is available.
The purpose of this port is primarily to support OS feature development.
This port does not support interrupts or a real timer (and hence no
round robin scheduler) Otherwise, it is complete.
endchoice
config ARCH_BOARD
string
default "sim" if ARCH_BOARD_SIM
comment "OMAP Board Type"
depends on ARCH_OMAP2PLUS
config MACH_OMAP_GENERIC
bool "Generic OMAP board"
depends on ARCH_OMAP2
default y