From 7696731f19c12291b6fff03469f2c8003dc3ff2d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 6 Mar 2019 13:27:50 -0600 Subject: [PATCH] configs/open1788/knxterm: Add a configuration to test NxTerms in the PROTECTED mode. This configuration does not yet link correctly because a few NxTerms interfaces are improperly exported from the OS: nxterm_redraw() and nxterm_kbdin(). I am thinking that these might be moved into libc/libnx with a little repartitioning effort. --- configs/open1788/README.txt | 15 ++++ configs/open1788/knxterm/Make.defs | 114 +++++++++++++++++++++++++++++ configs/open1788/knxterm/defconfig | 71 ++++++++++++++++++ graphics/nxterm/nxterm_driver.c | 2 +- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 configs/open1788/knxterm/Make.defs create mode 100644 configs/open1788/knxterm/defconfig diff --git a/configs/open1788/README.txt b/configs/open1788/README.txt index 1feb341c15..dc9e184d1c 100644 --- a/configs/open1788/README.txt +++ b/configs/open1788/README.txt @@ -394,6 +394,21 @@ Configuration Directories If you do this a lot, you will probably want to invest a little time to develop a tool to automate these steps. + knxterm + ------- + + This is another protected mode build. This configuration was used to + verify that NxTerms can be used in protected mode. See the knsh + configuration notes for instructions on building and loading this + configuration. + + STATUS: + 2019-03-06: This configuration was created. It doew not yet link + correctly, however, because certain nxterm interfaces are improperly + exported: nxterm_redraw() and nxterm_kbdin(). I am thinking that + these might be moved into libc/libnx with a little repartitioning + effort. + nsh --- Configures the NuttShell (nsh) located at examples/nsh. The diff --git a/configs/open1788/knxterm/Make.defs b/configs/open1788/knxterm/Make.defs new file mode 100644 index 0000000000..87eb70824a --- /dev/null +++ b/configs/open1788/knxterm/Make.defs @@ -0,0 +1,114 @@ +############################################################################ +# configs/open1788/knxterm/Make.defs +# +# Copyright (C) 2019 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +include ${TOPDIR}/.config +include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)armv7-m$(DELIM)Toolchain.defs + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mkwindeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld}" + ARCHSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld}" +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mkdeps$(HOSTEXEEXT) + ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx + ARCHSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld + ARCHSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +STRIP = $(CROSSDEV)strip --strip-unneeded +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 +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +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)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +ASMEXT = .S +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe +HOSTLDFLAGS = + diff --git a/configs/open1788/knxterm/defconfig b/configs/open1788/knxterm/defconfig new file mode 100644 index 0000000000..9510f1d8da --- /dev/null +++ b/configs/open1788/knxterm/defconfig @@ -0,0 +1,71 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="open1788" +CONFIG_ARCH_BOARD_OPEN1788=y +CONFIG_ARCH_CHIP_LPC1788=y +CONFIG_ARCH_CHIP_LPC17XX=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_USE_MPU=y +CONFIG_BCH=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=11934 +CONFIG_BUILD_PROTECTED=y +CONFIG_DEV_LOOP=y +CONFIG_EXAMPLES_NXTERM=y +CONFIG_EXAMPLES_NXTERM_FONTID=6 +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_ROMFS=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LPC17_EXTDRAM=y +CONFIG_LPC17_EXTDRAMSIZE=67108864 +CONFIG_LPC17_GPDMA=y +CONFIG_LPC17_LCD=y +CONFIG_LPC17_SDCARD=y +CONFIG_LPC17_UART0=y +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MMCSD=y +CONFIG_MMCSD_SDIO=y +CONFIG_MM_REGIONS=2 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LIBRARY=y +CONFIG_NSH_READLINE=y +CONFIG_NUTTX_USERSPACE=0x00010000 +CONFIG_NX=y +CONFIG_NXFONT_SANS28X37B=y +CONFIG_NXTERM=y +CONFIG_NX_BLOCKING=y +CONFIG_PASS1_BUILDIR="configs/open1788/kernel" +CONFIG_PIPES=y +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_RAM_SIZE=65536 +CONFIG_RAM_START=0x10000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=2 +CONFIG_START_MONTH=3 +CONFIG_START_YEAR=2019 +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_CLE=y +CONFIG_SYS_RESERVED=8 +CONFIG_TASK_NAME_SIZE=0 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USER_ENTRYPOINT="nxterm_main" +CONFIG_WDOG_INTRESERVE=0 diff --git a/graphics/nxterm/nxterm_driver.c b/graphics/nxterm/nxterm_driver.c index 7b9780147e..82a36b9bf8 100644 --- a/graphics/nxterm/nxterm_driver.c +++ b/graphics/nxterm/nxterm_driver.c @@ -324,7 +324,7 @@ static int nxterm_unlink(FAR struct inode *inode) FAR struct nxterm_state_s *priv; int ret; - DEBUGASSERT(inode != NULLL && inode->i_private != NULL); + DEBUGASSERT(inode != NULL && inode->i_private != NULL); priv = inode->i_private; /* Get exclusive access */