Add QEMU NSH configuration

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3358 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-03-10 04:13:44 +00:00
parent 046aa70b2a
commit a3c96a8df6
14 changed files with 1090 additions and 172 deletions
+3
View File
@@ -1532,3 +1532,6 @@
(and others). Contributed by Uros Platise. (and others). Contributed by Uros Platise.
* examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific * examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific
ROMFS-based NSH start-up scripts. ROMFS-based NSH start-up scripts.
* drivers/uart_16550.c and include/nuttx/uart_16550.h - Support for a generic
16550 UART.
* configure/qemu-i486/nsh - QEMU NSH example.
+4 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: March 7, 2011</p> <p>Last Updated: March 9, 2011</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -2156,6 +2156,9 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
(and others). Contributed by Uros Platise. (and others). Contributed by Uros Platise.
* examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific * examples/nsh and tools/mkromfsimg.sh -- Add support for platform-specific
ROMFS-based NSH start-up scripts. ROMFS-based NSH start-up scripts.
* drivers/uart_16550.c and include/nuttx/uart_16550.h - Support for a generic
16550 UART.
* configure/qemu-i486/nsh - QEMU NSH example.
pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+6
View File
@@ -127,6 +127,12 @@ void up_lowsetup(void)
up_gdtinit(); up_gdtinit();
/* Early serial driver initialization */
#ifdef CONFIG_USE_EARLYSERIALINIT
up_earlyserialinit();
#endif
/* Now perform board-specific initializations */ /* Now perform board-specific initializations */
up_boardinitialize(); up_boardinitialize();
+28 -1
View File
@@ -40,10 +40,18 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/uart_16550.h>
#include <arch/io.h>
#include "up_internal.h" #include "up_internal.h"
/* This is a "stub" file to suppport up_putc if no real serial driver is
* configured. Normally, drivers/serial/uart_16550.c provides the serial
* driver for this platform.
*/
#ifdef CONFIG_USE_SERIALDRIVER #ifdef CONFIG_USE_SERIALDRIVER
#error "Serial driver support not initialized"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@@ -61,6 +69,25 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: uart_getreg(), uart_putreg()
*
* Description:
* These functions must be provided by the processor-specific code in order
* to correctly access 16550 registers
*
****************************************************************************/
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset)
{
return inb(base + offset);
}
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value)
{
outb(value, base + offset);
}
#else /* CONFIG_USE_SERIALDRIVER */ #else /* CONFIG_USE_SERIALDRIVER */
/**************************************************************************** /****************************************************************************
+126
View File
@@ -0,0 +1,126 @@
############################################################################
# configs/qemu-i486/nsh/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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
HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = -O2
endif
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
endif
ARCHCPUFLAGS = -march=i486 -mtune=i486 -fno-builtin
ARCHPICFLAGS = -fpic
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHDEFINES =
# We have to use a cross-development toolchain under Cygwin because the native
# Cygwin toolchains don't generate ELF binaries.
ifeq ($(HOSTOS),Cygwin)
CROSSDEV = i486-elf-
else
CROSSDEV =
endif
CC = $(CROSSDEV)gcc
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
OBJEXT = .o
LIBEXT = .a
EXEEXT = .elf
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
LDFLAGS += -g
endif
define PREPROCESS
@echo "CPP: $1->$2"
@$(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
MKDEP = $(TOPDIR)/tools/mkdeps.sh
HOSTCC = gcc
HOSTINCLUDESv = -I.
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+91
View File
@@ -0,0 +1,91 @@
/****************************************************************************
* configs/qemu-i486/nsh/ld.script
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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.
*
****************************************************************************/
OUTPUT_ARCH(i386)
ENTRY(__start)
SECTIONS
{
. = 0x00100000;
.text : {
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.gnu.linkonce.t.*)
_etext = ABSOLUTE(.);
}
.text ALIGN (0x1000) : {
_srodata = ABSOLUTE(.);
*(.rodata .rodata.*)
*(.fixup)
*(.gnu.warning)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_erodata = ABSOLUTE(.);
}
.data ALIGN (0x1000) : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
}
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
}
/* Stabs debugging sections */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# configs/qemu-i486/nsh/setenv.sh
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
# Uncomment and modify the following if you are using anything other
# than the system GCC
# WD=`pwd`
# export BUILDROOT_BIN="${WD}/../../../buildroot/build_i486/staging_dir/bin"
# export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+1 -1
View File
@@ -1,5 +1,5 @@
############################################################################ ############################################################################
# configs/qemu-i486/Make.defs # configs/qemu-i486/ostest/Make.defs
# #
# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+5 -5
View File
@@ -362,7 +362,7 @@ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(192<<24|168<<16|0<<8|106)
# #
# Settings for examples/ostest # Settings for examples/ostest
CONFIG_EXAMPLES_OSTEST_LOOPS=100 CONFIG_EXAMPLES_OSTEST_LOOPS=100
CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096
# #
# Settings for examples/nsh # Settings for examples/nsh
@@ -370,7 +370,7 @@ CONFIG_EXAMPLES_NSH_CONSOLE=y
CONFIG_EXAMPLES_NSH_TELNET=n CONFIG_EXAMPLES_NSH_TELNET=n
CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512 CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE=512
CONFIG_EXAMPLES_NSH_CMD_SIZE=40 CONFIG_EXAMPLES_NSH_CMD_SIZE=40
CONFIG_EXAMPLES_NSH_STACKSIZE=4096 CONFIG_EXAMPLES_NSH_STACKSIZE=2048
CONFIG_EXAMPLES_NSH_DHCPC=n CONFIG_EXAMPLES_NSH_DHCPC=n
CONFIG_EXAMPLES_NSH_NOMAC=n CONFIG_EXAMPLES_NSH_NOMAC=n
CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2) CONFIG_EXAMPLES_NSH_IPADDR=(10<<24|0<<16|0<<8|2)
@@ -402,9 +402,9 @@ CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0)
CONFIG_BOOT_RUNFROMFLASH=n CONFIG_BOOT_RUNFROMFLASH=n
CONFIG_BOOT_COPYTORAM=n CONFIG_BOOT_COPYTORAM=n
CONFIG_CUSTOM_STACK=n CONFIG_CUSTOM_STACK=n
CONFIG_IDLETHREAD_STACKSIZE=4096 CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_USERMAIN_STACKSIZE=4096 CONFIG_USERMAIN_STACKSIZE=2048
CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_MIN=256
CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_PTHREAD_STACK_DEFAULT=2048
CONFIG_HEAP_BASE= CONFIG_HEAP_BASE=
CONFIG_HEAP_SIZE= CONFIG_HEAP_SIZE=
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# configs/qemu-i486/setenv.sh # configs/qemu-i486/ostest/setenv.sh
# #
# Copyright (C) 2010 Gregory Nutt. All rights reserved. # Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
+5 -2
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# drivers/serial/Make.defs # drivers/serial/Make.defs
# #
# Copyright (C) 2009 Gregory Nutt. All rights reserved. # Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,12 @@
# #
############################################################################ ############################################################################
SERIAL_ASRCS = SERIAL_ASRCS =
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
SERIAL_CSRCS = serial.c serialirq.c lowconsole.c SERIAL_CSRCS = serial.c serialirq.c lowconsole.c
ifeq ($(CONFIG_16550_UART),y)
SERIAL_CSRCS += uart_16550.c
endif
else else
SERIAL_CSRCS = SERIAL_CSRCS =
endif endif
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -43,7 +43,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#ifdef CONFIG_UART_16550 #ifdef CONFIG_16550_UART
/************************************************************************************ /************************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@@ -75,7 +75,7 @@
# error "CONFIG_16550_REGWIDTH not defined" # error "CONFIG_16550_REGWIDTH not defined"
#endif #endif
#if CONFIG_16550_REGWIDTH != 1 && CONFIG_16550_REGWIDTH != 2 && CONFIG_16550_REGWIDTH != 4 #if CONFIG_16550_REGWIDTH != 8 && CONFIG_16550_REGWIDTH != 16 && CONFIG_16550_REGWIDTH != 32
# error "CONFIG_16550_REGWIDTH not supported" # error "CONFIG_16550_REGWIDTH not supported"
#endif #endif
@@ -83,7 +83,7 @@
# error "CONFIG_16550_ADDRWIDTH not defined" # error "CONFIG_16550_ADDRWIDTH not defined"
#endif #endif
#if CONFIG_16550_ADDRWIDTH != 1 && CONFIG_16550_ADDRWIDTH != 2 && CONFIG_16550_ADDRWIDTH != 4 #if CONFIG_16550_ADDRWIDTH != 8 && CONFIG_16550_ADDRWIDTH != 16 && CONFIG_16550_ADDRWIDTH != 32
# error "CONFIG_16550_ADDRWIDTH not supported" # error "CONFIG_16550_ADDRWIDTH not supported"
#endif #endif
@@ -311,19 +311,19 @@
* Public Types * Public Types
************************************************************************************/ ************************************************************************************/
#if CONFIG_16550_REGWIDTH == 1 #if CONFIG_16550_REGWIDTH == 8
typedef uint8_t uart_datawidth_t; typedef uint8_t uart_datawidth_t;
#elif CONFIG_16550_REGWIDTH == 2 #elif CONFIG_16550_REGWIDTH == 16
typedef uint16_t uart_datawidth_t; typedef uint16_t uart_datawidth_t;
#elif CONFIG_16550_REGWIDTH == 4 #elif CONFIG_16550_REGWIDTH == 32
typedef uint32_t uart_datawidth_t; typedef uint32_t uart_datawidth_t;
#endif #endif
#if CONFIG_16550_REGWIDTH == 1 #if CONFIG_16550_ADDRWIDTH == 8
typedef uint8_t uart_addrwidth_t; typedef uint8_t uart_addrwidth_t;
#elif CONFIG_16550_REGWIDTH == 2 #elif CONFIG_16550_ADDRWIDTH == 16
typedef uint16_t uart_addrwidth_t; typedef uint16_t uart_addrwidth_t;
#elif CONFIG_16550_REGWIDTH == 4 #elif CONFIG_16550_ADDRWIDTH == 32
typedef uint32_t uart_addrwidth_t; typedef uint32_t uart_addrwidth_t;
#endif #endif