mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 18:27:56 +08:00
Fix numerous errors in trapezoid rendering and wide line drawing algorithms
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3841 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -518,6 +518,15 @@ Where <subdir> is one of the following:
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LCD_RPORTRAIT=y : 240x320 reverse portrait
|
||||
|
||||
nxlines:
|
||||
------
|
||||
Another example using the NuttX graphics system (NX). This
|
||||
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
|
||||
|
||||
nxtext:
|
||||
------
|
||||
Another example using the NuttX graphics system (NX). This
|
||||
@@ -525,9 +534,14 @@ Where <subdir> is one of the following:
|
||||
windows occur. Text should continue to update normally with
|
||||
or without the popup windows present.
|
||||
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
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
|
||||
retested since then, but beware if you choose to change the
|
||||
toolchain.
|
||||
|
||||
ostest:
|
||||
------
|
||||
This configuration directory, performs a simple OS test using
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
############################################################################
|
||||
# configs/stm3210e-eval/nxlines/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
|
||||
|
||||
# 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)/nxlines/$(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)/nxlines/$(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
|
||||
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 =
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
############################################################################
|
||||
# configs/stm3210e-eval/nxlines/appconfig
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
|
||||
CONFIGURED_APPS += examples/nxlines
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
* configs/stm3210e-eval/nxlines/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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* 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) }
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/****************************************************************************
|
||||
* configs/stm3210e-eval/nxlines/ld.script.dfu
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* 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) }
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# configs/stm3210e-eval/nxlines/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 [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!"
|
||||
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
|
||||
|
||||
export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -134,9 +134,9 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
|
||||
/* Create a bounding box that contains the trapezoid */
|
||||
|
||||
remaining.pt1.x = b16toi(ngl_min(info.trap.top.x1, info.trap.bot.x1));
|
||||
remaining.pt1.y = b16toi(info.trap.top.y);
|
||||
remaining.pt1.y = info.trap.top.y;
|
||||
remaining.pt2.x = b16toi(ngl_max(info.trap.top.x2, info.trap.bot.x2));
|
||||
remaining.pt2.y = b16toi(info.trap.bot.y);
|
||||
remaining.pt2.y = info.trap.bot.y;
|
||||
|
||||
/* Clip to any user specified clipping window */
|
||||
|
||||
|
||||
@@ -191,12 +191,16 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
|
||||
|
||||
/* Fill the run buffer for the maximum run that we will need */
|
||||
|
||||
ix1 = ngl_clipl(b16toi(topx1), bounds->pt1.x);
|
||||
ix2 = ngl_clipl(b16toi(topx2), bounds->pt2.x);
|
||||
ix1 = b16toi(topx1);
|
||||
ix1 = ngl_clipl(ix1, bounds->pt1.x);
|
||||
ix2 = b16toi(topx2);
|
||||
ix2 = ngl_clipr(ix2, bounds->pt2.x);
|
||||
ncols = ix2 - ix1 + 1;
|
||||
|
||||
ix1 = ngl_clipl(b16toi(botx1), bounds->pt1.x);
|
||||
ix2 = ngl_clipl(b16toi(botx2), bounds->pt2.x);
|
||||
ix1 = b16toi(botx1);
|
||||
ix1 = ngl_clipl(ix1, bounds->pt1.x);
|
||||
ix2 = b16toi(botx2);
|
||||
ix2 = ngl_clipr(ix2, bounds->pt2.x);
|
||||
botw = ix2 - ix1 + 1;
|
||||
|
||||
if (ncols < botw)
|
||||
@@ -206,7 +210,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
|
||||
|
||||
NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols);
|
||||
|
||||
/* Then fill the trapezoid line-by-line */
|
||||
/* Then fill the trapezoid row-by-row */
|
||||
|
||||
for (row = topy; row <= boty; row++)
|
||||
{
|
||||
@@ -219,12 +223,14 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
|
||||
ngl_swap(dx1dy, dx2dy, tmp);
|
||||
}
|
||||
|
||||
/* Convert the positions to integer and get the run width,
|
||||
* clipping to fit within the bounding box.
|
||||
/* Convert the positions to integer and get the run width, clipping to
|
||||
* fit within the bounding box.
|
||||
*/
|
||||
|
||||
ix1 = ngl_clipl(b16toi(topx1), bounds->pt1.x);
|
||||
ix2 = ngl_clipl(b16toi(topx2), bounds->pt2.x);
|
||||
ix1 = b16toi(topx1);
|
||||
ix1 = ngl_clipl(ix1, bounds->pt1.x);
|
||||
ix2 = b16toi(topx2);
|
||||
ix2 = ngl_clipr(ix2, bounds->pt2.x);
|
||||
|
||||
/* Handle some corner cases where we draw nothing. Otherwise, we will
|
||||
* always draw at least one pixel.
|
||||
|
||||
@@ -121,6 +121,7 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
b16_t xoffset;
|
||||
b16_t halfoffset;
|
||||
b16_t angle;
|
||||
b16_t sinangle;
|
||||
b16_t b16x;
|
||||
|
||||
/* First, check the linewidth */
|
||||
@@ -193,12 +194,12 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
{
|
||||
/* A line of width 1 is basically a single parallelogram of width 1 */
|
||||
|
||||
traps[1].top.x1 = line.pt1.x;
|
||||
traps[1].top.x2 = line.pt1.x;
|
||||
traps[1].top.x1 = itob16(line.pt1.x);
|
||||
traps[1].top.x2 = traps[1].top.x1;
|
||||
traps[1].top.y = line.pt1.y;
|
||||
|
||||
traps[1].bot.x1 = line.pt2.x;
|
||||
traps[1].bot.x2 = line.pt2.x;
|
||||
traps[1].bot.x1 = itob16(line.pt2.x);
|
||||
traps[1].bot.x2 = traps[1].bot.x1;
|
||||
traps[1].bot.y = line.pt2.y;
|
||||
return 1;
|
||||
}
|
||||
@@ -219,21 +220,34 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
iwidth = line.pt1.x - line.pt2.x + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Triangle height: linewidth * cosA
|
||||
/* Triangle height: linewidth * cosA
|
||||
* Adjusted width: triheight / sinA
|
||||
* X offset : linewidth * linewidth / adjusted line width
|
||||
*/
|
||||
|
||||
angle = b16atan2(itob16(iheight), itob16(iwidth));
|
||||
triheight = b16toi(linewidth * b16cos(angle));
|
||||
adjwidth = b16divb16(itob16(linewidth), b16sin(angle));
|
||||
xoffset = itob16(linewidth * linewidth);
|
||||
xoffset = b16divb16(xoffset, adjwidth);
|
||||
|
||||
halfoffset = (xoffset >> 1);
|
||||
halfheight = (triheight >> 1);
|
||||
|
||||
/* If the sine of the angle is tiny (i.e., the line is nearly horizontal),
|
||||
* then we cannot compute the adjusted width. In this case, just use
|
||||
* the width of the line (not very good estimate -- need to revisit).
|
||||
*/
|
||||
|
||||
sinangle = b16sin(angle);
|
||||
if (sinangle == 0)
|
||||
{
|
||||
adjwidth = itob16(iwidth);
|
||||
xoffset = adjwidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
adjwidth = b16divb16(itob16(linewidth), sinangle);
|
||||
xoffset = itob16(linewidth * linewidth);
|
||||
xoffset = b16divb16(xoffset, adjwidth);
|
||||
}
|
||||
halfoffset = (xoffset >> 1);
|
||||
|
||||
/* Return the top triangle (if there is one). NOTE that the horizontal
|
||||
* (z) positions are represented with 16 bits of fraction. The vertical
|
||||
* (y) positions, on the other hand, are integer.
|
||||
@@ -256,7 +270,7 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
traps[0].bot.y = iy;
|
||||
|
||||
b16x = itob16(line.pt2.x) + halfoffset;
|
||||
iy = itob16(line.pt2.y) - halfheight;
|
||||
iy = line.pt2.y - halfheight;
|
||||
|
||||
traps[2].top.x1 = b16x - adjwidth + b16ONE;
|
||||
traps[2].top.x2 = b16x;
|
||||
@@ -270,7 +284,7 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
/* Line is going "south west" */
|
||||
|
||||
b16x = itob16(line.pt1.x) + halfoffset;
|
||||
iy = itob16(line.pt1.y) + halfheight;
|
||||
iy = line.pt1.y + halfheight;
|
||||
|
||||
traps[0].top.x1 = b16x - xoffset;
|
||||
traps[0].top.x2 = traps[0].top.x1;
|
||||
@@ -280,7 +294,7 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
|
||||
traps[0].bot.y = iy;
|
||||
|
||||
b16x = itob16(line.pt2.x) - halfoffset;
|
||||
iy = itob16(line.pt2.y) - halfheight;
|
||||
iy = line.pt2.y - halfheight;
|
||||
|
||||
traps[2].top.x1 = b16x;
|
||||
traps[2].top.x2 = b16x + adjwidth - b16ONE;
|
||||
|
||||
+10
-10
@@ -101,16 +101,16 @@
|
||||
|
||||
/* Conversions between b16 and b8 *****************************************/
|
||||
|
||||
#define b8tob16(b) ((b16_t)(b) << 8)
|
||||
#define ub8toub16(b) ((ub16_t)(b) << 8)
|
||||
#define b8tob16(b) (((b16_t)(b)) << 8)
|
||||
#define ub8toub16(b) (((ub16_t)(b)) << 8)
|
||||
#define b16tob8(b) (b8_t)(((b)+0x0080)>>8)
|
||||
#define ub16toub8(b) (ub8_t)(((b)+0x0080)>>8)
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
# define b8tob32(b) ((b32_t)(b) << 24)
|
||||
# define ub8toub32(b) ((ub32_t)(b) << 24)
|
||||
# define b16tob32(b) ((b32_t)(b) << 16)
|
||||
# define ub16toub32(b) ((ub32_t)(b) << 16)
|
||||
# define b8tob32(b) (((b32_t)(b)) << 24)
|
||||
# define ub8toub32(b) (((ub32_t)(b)) << 24)
|
||||
# define b16tob32(b) (((b32_t)(b)) << 16)
|
||||
# define ub16toub32(b) (((ub32_t)(b)) << 16)
|
||||
# define b32tob16(b) (b16_t)(((b) + 0x0000000000008000)>>16)
|
||||
# define ub32toub16(b) (ub16_t)(((b) + 0x0000000000008000)>>16)
|
||||
# define b32tob8(b) (b8_t)(((b) + 0x0000000000000080)>>8)
|
||||
@@ -121,8 +121,8 @@
|
||||
/* Conversions */
|
||||
|
||||
#define b8toi(a) ((a) >> 8) /* Conversion to integer */
|
||||
#define itob8(i) ((b8_t)(i) << 8) /* Conversion from integer */
|
||||
#define uitoub8(i) ((ub8_t)(i) << 8) /* Conversion from unsigned integer */
|
||||
#define itob8(i) (((b8_t)(i)) << 8) /* Conversion from integer */
|
||||
#define uitoub8(i) (((ub8_t)(i)) << 8) /* Conversion from unsigned integer */
|
||||
#define b8tof(b) (((float)b)/256.0) /* Conversion to float */
|
||||
#define ftob8(f) (b8_t)(((f)*256.0)) /* Conversion from float */
|
||||
#define b8trunc(a) ((a) & 0xff00) /* Truncate to integer b8 */
|
||||
@@ -152,8 +152,8 @@
|
||||
/* Conversions */
|
||||
|
||||
#define b16toi(a) ((a) >> 16) /* Conversion to integer */
|
||||
#define itob16(i) ((b16_t)(i) << 16) /* Conversion from integer */
|
||||
#define uitoub16(i) ((ub16_t)(i) << 16) /* Conversion from unsigned integer */
|
||||
#define itob16(i) (((b16_t)(i)) << 16) /* Conversion from integer */
|
||||
#define uitoub16(i) (((ub16_t)(i)) << 16) /* Conversion from unsigned integer */
|
||||
#define b16tof(b) (((float)b)/65536.0) /* Conversion to float */
|
||||
#define ftob16(f) (b16_t)(((f)*65536.0)) /* Conversion from float */
|
||||
#define b16trunc(a) ((a) & 0xffff0000) /* Truncate to integer */
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
#define ngl_min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define ngl_max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define ngl_swap(a,b,t) do { t = a; a = b; b = t; } while (0);
|
||||
#define ngl_swap(a,b,t) do { t = a; a = b; b = t; } while (0)
|
||||
#define ngl_clipl(a,mn) ((a) < (mn) ? (mn) : (a))
|
||||
#define ngl_clipr(a,mx) ((a) > (mx) ? (mx) : (a))
|
||||
#define ngl_clip(a,mx,mn) ((a) < (mn) ? (mn) : (a) > (mx) ? (mx) : (a))
|
||||
|
||||
Reference in New Issue
Block a user