Can now run an NSH session within an NX window
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4539 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
d5dc27cd37
commit
a995a49261
@ -2604,3 +2604,7 @@
|
||||
user NX mode only).
|
||||
* arch/arm/src/stm32/stm32_i2c.c: Correct a bug in the STM32 I2C driver. The
|
||||
behavior of I2C status bits seems to be different between F1 and F4.
|
||||
* configs/stm3210e-eval/nxconsole: New STM32 F1 configuration that runs the
|
||||
NuttShell (NSH) within an NX window.
|
||||
* graphics/nxconsole/nxcon_sem.c: Add protection from re-entrance with debug
|
||||
is enabled.
|
||||
|
@ -408,6 +408,7 @@
|
||||
<p>
|
||||
NxConsole is a write-only character device (not shown) that is built on top of an NX window.
|
||||
This character device can be used to provide <code>stdout</code> and <code>stderr</code> and, hence, can provide the output side of NuttX console.
|
||||
NxConsole is only available when the multi-user NX implementation is selected (<code>CONFIG_NX_MULTIUSER</code>).
|
||||
</p>
|
||||
|
||||
<table width ="100%">
|
||||
|
@ -49,7 +49,3 @@ CONFIGURED_APPS += examples/nxhello
|
||||
CONFIGURED_APPS += examples/nxlines
|
||||
CONFIGURED_APPS += examples/touchscreen
|
||||
|
||||
ifeq ($(CONFIG_NXCONSOLE),y)
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
endif
|
||||
|
||||
|
@ -17,7 +17,6 @@ Contents
|
||||
- Temperature Sensor
|
||||
- RTC
|
||||
- STM3210E-EVAL-specific Configuration Options
|
||||
- NxConsole
|
||||
- Configurations
|
||||
|
||||
Development Environment
|
||||
@ -351,28 +350,6 @@ RTC
|
||||
overflow interrupt may be lost even if the STM32 is powered down only momentarily.
|
||||
Therefore hi-res solution is only useful in systems where the power is always on.
|
||||
|
||||
NxConsole
|
||||
=========
|
||||
|
||||
Several of the graphic-releted configurations are set to use the
|
||||
examples/nxconsole test. To enable this configuration,
|
||||
First, select NX Multi-User mode:
|
||||
|
||||
CONFG_NX_MULTIUSER=y
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
Then add the following definition to the defconfig file to enable
|
||||
the NxConsole driver:
|
||||
|
||||
CONFIG_NXCONSOLE=y
|
||||
|
||||
Make sure the that following is in place the appconfig file (perhaps
|
||||
eliminating other examples):
|
||||
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
|
||||
See apps/examples/README.txt for further details.
|
||||
|
||||
STM3210E-EVAL-specific Configuration Options
|
||||
============================================
|
||||
|
||||
@ -748,8 +725,36 @@ Where <subdir> is one of the following:
|
||||
focuses on general window controls, movement, mouse and keyboard
|
||||
input.
|
||||
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
|
||||
nxconsole:
|
||||
----------
|
||||
This is yet another NSH configuration. This NSH configuration differs
|
||||
from the other, however, in that it uses the NxConsole driver to host
|
||||
the NSH shell.
|
||||
|
||||
Some of the differences in this configuratino include these settings
|
||||
in the defconfig file:
|
||||
|
||||
These select NX Multi-User mode:
|
||||
|
||||
CONFG_NX_MULTIUSER=y
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
The following definition in the defconfig file to enables the NxConsole
|
||||
driver:
|
||||
|
||||
CONFIG_NXCONSOLE=y
|
||||
|
||||
The appconfig file selects examples/nxconsole instead of examples/nsh:
|
||||
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
|
||||
Other configuration settings:
|
||||
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_LCD_LANDSCAPE=y : 320x240 landscape
|
||||
|
||||
nxlines:
|
||||
------
|
||||
@ -757,8 +762,8 @@ Where <subdir> is one of the following:
|
||||
example focuses on placing lines on the background in various
|
||||
orientations.
|
||||
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
|
||||
nxtext:
|
||||
------
|
||||
@ -767,8 +772,8 @@ Where <subdir> is one of the following:
|
||||
windows occur. Text should continue to update normally with
|
||||
or without the popup windows present.
|
||||
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
|
||||
NOTE: When I tried building this example with the CodeSourcery
|
||||
tools, I got a hardfault inside of its libgcc. I haven't
|
||||
@ -781,14 +786,14 @@ Where <subdir> is one of the following:
|
||||
examples/ostest. By default, this project assumes that you are
|
||||
using the DFU bootloader.
|
||||
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
|
||||
RIDE
|
||||
----
|
||||
This configuration builds a trivial bring-up binary. It is
|
||||
useful only because it words with the RIDE7 IDE and R-Link debugger.
|
||||
|
||||
CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
|
||||
CONFIG_STM32_RAISONANCE=y : Raisonance RIDE7 under Windows
|
||||
|
||||
usbserial:
|
||||
---------
|
||||
@ -796,46 +801,46 @@ Where <subdir> is one of the following:
|
||||
driver at examples/usbserial. See examples/README.txt for
|
||||
more information.
|
||||
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
|
||||
USB debug output can be enabled as by changing the following
|
||||
settings in the configuration file:
|
||||
|
||||
-CONFIG_DEBUG=n
|
||||
-CONFIG_DEBUG_VERBOSE=n
|
||||
-CONFIG_DEBUG_USB=n
|
||||
+CONFIG_DEBUG=y
|
||||
+CONFIG_DEBUG_VERBOSE=y
|
||||
+CONFIG_DEBUG_USB=y
|
||||
-CONFIG_DEBUG=n
|
||||
-CONFIG_DEBUG_VERBOSE=n
|
||||
-CONFIG_DEBUG_USB=n
|
||||
+CONFIG_DEBUG=y
|
||||
+CONFIG_DEBUG_VERBOSE=y
|
||||
+CONFIG_DEBUG_USB=y
|
||||
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=y
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n
|
||||
-CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=y
|
||||
+CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=y
|
||||
|
||||
By default, the usbserial example uses the Prolific PL2303
|
||||
serial/USB converter emulation. The example can be modified
|
||||
to use the CDC/ACM serial class by making the following changes
|
||||
to the configuration file:
|
||||
|
||||
-CONFIG_PL2303=y
|
||||
+CONFIG_PL2303=n
|
||||
-CONFIG_PL2303=y
|
||||
+CONFIG_PL2303=n
|
||||
|
||||
-CONFIG_CDCACM=n
|
||||
+CONFIG_CDCACM=y
|
||||
-CONFIG_CDCACM=n
|
||||
+CONFIG_CDCACM=y
|
||||
|
||||
The example can also be converted to use the alternative
|
||||
USB serial example at apps/examples/usbterm by changing the
|
||||
following:
|
||||
|
||||
-CONFIGURED_APPS += examples/usbserial
|
||||
+CONFIGURED_APPS += examples/usbterm
|
||||
-CONFIGURED_APPS += examples/usbserial
|
||||
+CONFIGURED_APPS += examples/usbterm
|
||||
|
||||
In either the original appconfig file (before configuring)
|
||||
or in the final apps/.config file (after configuring).
|
||||
@ -846,5 +851,5 @@ Where <subdir> is one of the following:
|
||||
class driver at examples/usbstorage. See examples/README.txt for
|
||||
more information.
|
||||
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
CONFIG_STM32_BUILDROOT=y : NuttX buildroot under Linux or Cygwin
|
||||
|
||||
|
@ -52,10 +52,6 @@ CONFIGURED_APPS += examples/nxhello
|
||||
#CONFIGURED_APPS += examples/nxtext
|
||||
CONFIGURED_APPS += examples/usbstorage
|
||||
|
||||
ifeq ($(CONFIG_NXCONSOLE),y)
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C),y)
|
||||
CONFIGURED_APPS += system/i2c
|
||||
endif
|
||||
|
@ -34,12 +34,6 @@
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
# Various NX tests can be supported, simply comment-out examples/nx and
|
||||
# uncomment the test you wish to perform
|
||||
|
||||
CONFIGURED_APPS += examples/nx
|
||||
#CONFIGURED_APPS += examples/nxhello
|
||||
#CONFIGURED_APPS += examples/nxlines
|
||||
#CONFIGURED_APPS += examples/nxtext
|
||||
#CONFIGURED_APPS += examples/nxconsole
|
||||
|
||||
|
176
configs/stm3210e-eval/nxconsole/Make.defs
Normal file
176
configs/stm3210e-eval/nxconsole/Make.defs
Normal file
@ -0,0 +1,176 @@
|
||||
############################################################################
|
||||
# configs/stm3210e-eval/nxconsole/Make.defs
|
||||
#
|
||||
# Copyright (C) 2012 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
|
||||
|
||||
# Setup for the selected toolchain
|
||||
|
||||
ifeq ($(CONFIG_STM32_DFU),y)
|
||||
LDSCRIPT = ld.script.dfu
|
||||
else
|
||||
LDSCRIPT = ld.script
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_CODESOURCERYW),y)
|
||||
# CodeSourcery under Windows
|
||||
CROSSDEV = arm-none-eabi-
|
||||
WINTOOL = y
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O1
|
||||
endif
|
||||
ifeq ($(CONFIG_STM32_CODESOURCERYL),y)
|
||||
# CodeSourcery under Linux
|
||||
CROSSDEV = arm-none-eabi-
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O1
|
||||
endif
|
||||
ifeq ($(CONFIG_STM32_DEVKITARM),y)
|
||||
# devkitARM under Windows
|
||||
CROSSDEV = arm-eabi-
|
||||
WINTOOL = y
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O2
|
||||
endif
|
||||
ifeq ($(CONFIG_STM32_RAISONANCE),y)
|
||||
# Raisonance RIDE7 under Windows
|
||||
CROSSDEV = arm-none-eabi-
|
||||
WINTOOL = y
|
||||
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -O2
|
||||
endif
|
||||
ifeq ($(CONFIG_STM32_BUILDROOT),y)
|
||||
# NuttX buildroot under Linux or Cygwin
|
||||
CROSSDEV = arm-elf-
|
||||
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
|
||||
MAXOPTIMIZATION = -Os
|
||||
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)/nxconsole/$(LDSCRIPT)}"
|
||||
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)/nxconsole/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
|
||||
ARCHOPTIMIZATION = -g
|
||||
else
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
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 COMPILEXX
|
||||
@echo "CXX: $1"
|
||||
@$(CXX) -c $(CXXFLAGS) $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
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
55
configs/stm3210e-eval/nxconsole/appconfig
Normal file
55
configs/stm3210e-eval/nxconsole/appconfig
Normal file
@ -0,0 +1,55 @@
|
||||
############################################################################
|
||||
# configs/stm3210e-eval/nxconsole/appconfig
|
||||
#
|
||||
# Copyright (C) 2012 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
|
||||
CONFIGURED_APPS += examples/nxconsole
|
||||
|
||||
CONFIGURED_APPS += system/readline
|
||||
CONFIGURED_APPS += nshlib
|
||||
|
||||
# Optional built-in applications
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
CONFIGURED_APPS += examples/usbstorage
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C),y)
|
||||
CONFIGURED_APPS += system/i2c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CAN),y)
|
||||
CONFIGURED_APPS += examples/can
|
||||
endif
|
1314
configs/stm3210e-eval/nxconsole/defconfig
Normal file
1314
configs/stm3210e-eval/nxconsole/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
112
configs/stm3210e-eval/nxconsole/ld.script
Normal file
112
configs/stm3210e-eval/nxconsole/ld.script
Normal file
@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
* configs/stm3210e-eval/nxconsole/ld.script
|
||||
*
|
||||
* Copyright (C) 2012 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
|
||||
* 64Kb of SRAM beginning at address 0x2000:0000. When booting from FLASH,
|
||||
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
|
||||
* begin execution by jumping to the entry point in the 0x0800:0000 address
|
||||
* range.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
/* The STM32F103Z has 64Kb of SRAM beginning at the following address */
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >sram
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} >sram
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* 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) }
|
||||
}
|
111
configs/stm3210e-eval/nxconsole/ld.script.dfu
Normal file
111
configs/stm3210e-eval/nxconsole/ld.script.dfu
Normal file
@ -0,0 +1,111 @@
|
||||
/****************************************************************************
|
||||
* configs/stm3210e-eval/nxconsole/ld.script.dfu
|
||||
*
|
||||
* Copyright (C) 2012 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The STM32F103ZET6 has 512Kb of FLASH beginning at address 0x0800:0000 and
|
||||
* 64Kb of SRAM beginning at address 0x2000:0000. Here we assume that the
|
||||
* STM3210E-EVAL's DFU bootloader is being used. In that case, the corrct
|
||||
* load .text load address is 0x08003000 (leaving 464Kb).
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x08003000, LENGTH = 464K
|
||||
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
_eronly = ABSOLUTE(.);
|
||||
|
||||
/* The STM32F103Z has 64Kb of SRAM beginning at the following address */
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >sram
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} >sram
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* 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) }
|
||||
}
|
62
configs/stm3210e-eval/nxconsole/setenv.sh
Executable file
62
configs/stm3210e-eval/nxconsole/setenv.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# configs/stm3210e-eval/nxconsole/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
|
||||
# This the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
@ -34,11 +34,5 @@
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
# Various NX tests can be supported, simply comment-out examples/nx and
|
||||
# uncomment the test you wish to perform
|
||||
|
||||
#CONFIGURED_APPS += examples/nx
|
||||
#CONFIGURED_APPS += examples/nxhello
|
||||
CONFIGURED_APPS += examples/nxlines
|
||||
#CONFIGURED_APPS += examples/nxtext
|
||||
#CONFIGURED_APPS += examples/nxconsole
|
||||
|
@ -34,12 +34,6 @@
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
# Various NX tests can be supported, simply comment-out examples/nx and
|
||||
# uncomment the test you wish to perform
|
||||
|
||||
#CONFIGURED_APPS += examples/nx
|
||||
#CONFIGURED_APPS += examples/nxhello
|
||||
#CONFIGURED_APPS += examples/nxlines
|
||||
CONFIGURED_APPS += examples/nxtext
|
||||
#CONFIGURED_APPS += examples/nxconsole
|
||||
|
||||
|
@ -37,6 +37,9 @@ at the present, but here is the longer term roadmap:
|
||||
NxConsole - NxConsole is a write-only character device that is built on top of
|
||||
an NX window. This character device can be used to provide stdout
|
||||
and stderr and, hence, can provide the output side of NuttX console.
|
||||
NxConsole is only available when the multi-user NX implementation is
|
||||
selected (CONFIG_NX_MULTIUSERs).
|
||||
|
||||
|
||||
Related Header Files
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -37,3 +37,7 @@ NXCON_ASRCS =
|
||||
NXCON_CSRCS = nx_register.c nxcon_driver.c nxcon_font.c nxcon_redraw.c
|
||||
NXCON_CSRCS += nxcon_register.c nxcon_scroll.c nxcon_unregister.c
|
||||
NXCON_CSRCS += nxtk_register.c nxtool_register.c
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
NXCON_CSRCS += nxcon_sem.c
|
||||
endif
|
||||
|
@ -136,7 +136,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
||||
|
||||
/* Get exclusive access */
|
||||
|
||||
ret = sem_wait(&priv->exclsem);
|
||||
ret = nxcon_semwait(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
@ -195,7 +195,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer,
|
||||
nxcon_putc(priv, (uint8_t)ch);
|
||||
}
|
||||
|
||||
sem_post(&priv->exclsem);
|
||||
nxcon_sempost(priv);
|
||||
return (ssize_t)buflen;
|
||||
}
|
||||
|
||||
|
@ -241,10 +241,6 @@ nxcon_renderglyph(FAR struct nxcon_state_s *priv,
|
||||
int col;
|
||||
int ret;
|
||||
|
||||
/* Make sure that there is room for another glyph */
|
||||
|
||||
gvdbg("ch=%c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
||||
|
||||
/* Allocate the glyph (always succeeds) */
|
||||
|
||||
glyph = nxcon_allocglyph(priv);
|
||||
@ -629,10 +625,7 @@ void nxcon_fillchar(FAR struct nxcon_state_s *priv,
|
||||
src = (FAR const void *)glyph->bitmap;
|
||||
ret = priv->ops->bitmap(priv, &intersection, &src,
|
||||
&bm->pos, (unsigned int)glyph->stride);
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("bitmap failed: %d\n", errno);
|
||||
}
|
||||
DEBUGASSERT(ret >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,10 @@
|
||||
#define NX_DEVNAME_FORMAT "/dev/nxcon%d"
|
||||
#define NX_DEVNAME_SIZE 16
|
||||
|
||||
/* Semaphore protection */
|
||||
|
||||
#define NO_HOLDER (pid_t)-1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@ -126,6 +130,9 @@ struct nxcon_state_s
|
||||
FAR struct nxcon_window_s wndo; /* Describes the window and font */
|
||||
NXHANDLE font; /* The current font handle */
|
||||
sem_t exclsem; /* Forces mutually exclusive access */
|
||||
#ifdef CONFIG_DEBUG
|
||||
pid_t holder; /* Deadlock avoidance */
|
||||
#endif
|
||||
struct nxgl_point_s fpos; /* Next display position */
|
||||
|
||||
uint16_t maxchars; /* Size of the bm[] array */
|
||||
@ -165,6 +172,16 @@ extern const struct file_operations g_nxcon_drvrops;
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
/* Semaphore helpers */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
int nxcon_semwait(FAR struct nxcon_state_s *priv);
|
||||
int nxcon_sempost(FAR struct nxcon_state_s *priv);
|
||||
#else
|
||||
# define nxcon_semwait(p) sem_wait(&p->exclsem);
|
||||
# define nxcon_sempost(p) sem_post(&p->exclsem);
|
||||
#endif
|
||||
|
||||
/* Common device registration */
|
||||
|
||||
FAR struct nxcon_state_s *nxcon_register(NXCONSOLE handle,
|
||||
|
@ -117,7 +117,7 @@ void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, bool mor
|
||||
|
||||
do
|
||||
{
|
||||
ret = sem_wait(&priv->exclsem);
|
||||
ret = nxcon_semwait(priv);
|
||||
|
||||
/* Check for errors */
|
||||
|
||||
@ -148,5 +148,5 @@ void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, bool mor
|
||||
{
|
||||
nxcon_fillchar(priv, rect, &priv->bm[i]);
|
||||
}
|
||||
ret = sem_post(&priv->exclsem);
|
||||
ret = nxcon_sempost(priv);
|
||||
}
|
||||
|
@ -236,4 +236,4 @@ void nxcon_scroll(FAR struct nxcon_state_s *priv, int scrollheight)
|
||||
/* Move the display in the range of 0-height up one scrollheight. */
|
||||
|
||||
nxcon_movedisplay(priv, priv->fpos.y, scrollheight);
|
||||
}
|
||||
}
|
||||
|
129
graphics/nxconsole/nxcon_sem.c
Normal file
129
graphics/nxconsole/nxcon_sem.c
Normal file
@ -0,0 +1,129 @@
|
||||
/****************************************************************************
|
||||
* nuttx/graphics/nxconsole/nxcon_unregister.c
|
||||
*
|
||||
* Copyright (C) 2012 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 <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "nxcon_internal.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxcon_semwait and nxcon_sempost
|
||||
*
|
||||
* Description:
|
||||
* If debug is on, then lower level code may attempt console output while
|
||||
* we are doing console output! In this case, we will toss the nested
|
||||
* output to avoid deadlocks and infinite loops.
|
||||
*
|
||||
* Input Parameters:
|
||||
* priv - Driver data structure
|
||||
*
|
||||
* Returned Value:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nxcon_semwait(FAR struct nxcon_state_s *priv)
|
||||
{
|
||||
pid_t me;
|
||||
int ret;
|
||||
|
||||
/* Does I already hold the semaphore */
|
||||
|
||||
me = getpid();
|
||||
if (priv->holder != me)
|
||||
{
|
||||
/* No.. then wait until the thread that does hold it is finished with it */
|
||||
|
||||
ret = sem_wait(&priv->exclsem);
|
||||
if (ret == OK)
|
||||
{
|
||||
/* No I hold the semaphore */
|
||||
|
||||
priv->holder = me;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Abort, abort, abort! I have been re-entered */
|
||||
|
||||
set_errno(EBUSY);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
int nxcon_sempost(FAR struct nxcon_state_s *priv)
|
||||
{
|
||||
pid_t me = getpid();
|
||||
|
||||
/* Make sure that I really hold the semaphore */
|
||||
|
||||
ASSERT(priv->holder == me);
|
||||
|
||||
/* Then let go of it */
|
||||
|
||||
priv->holder = NO_HOLDER;
|
||||
return sem_post(&priv->exclsem);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEBUG */
|
@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* graphics/nxtk/nxtk_events.c
|
||||
*
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2008-2009, 2012 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
|
||||
@ -131,7 +131,7 @@ static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
|
||||
nxtk_containerclip(fwnd, &intersection, rect, &fwnd->fwrect);
|
||||
|
||||
gvdbg("fwrect intersction={(%d,%d),(%d,%d)}\n",
|
||||
gvdbg("fwrect intersection={(%d,%d),(%d,%d)}\n",
|
||||
intersection.pt1.x, intersection.pt1.y,
|
||||
intersection.pt2.x, intersection.pt2.y);
|
||||
|
||||
@ -154,7 +154,7 @@ static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
|
||||
nxtk_containerclip(fwnd, &intersection, rect, &fwnd->tbrect);
|
||||
|
||||
gvdbg("tbrect intersction={(%d,%d),(%d,%d)}\n",
|
||||
gvdbg("tbrect intersection={(%d,%d),(%d,%d)}\n",
|
||||
intersection.pt1.x, intersection.pt1.y,
|
||||
intersection.pt2.x, intersection.pt2.y);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user