Merge in configs/ submodule

This commit is contained in:
Gregory Nutt
2016-04-10 07:57:59 -06:00
2965 changed files with 747504 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
.depend
Make.dep
*.o
*.a
*.d
*.i
*~
.swp
.*.swp
core
.gdbinit
cscope.out
/Make.dep
/.depend
/*.asm
/*.obj
/*.rel
/*.lst
/*.sym
/*.adb
/*.lib
/*.src
+135
View File
@@ -0,0 +1,135 @@
############################################################################
# configs/Board.mk
#
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
# Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
# Paul Alexander Patience <paul-a.patience@polymtl.ca>
#
# 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)/Make.defs
ifneq ($(ZDSVERSION),)
AOBJS = $(ASRCS:.S=$(OBJEXT))
else
AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
SCHEDSRCDIR = $(TOPDIR)$(DELIM)sched
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
ifneq ($(ZDSVERSION),)
ifeq ($(WINTOOL),y)
WSCHEDSRCDIR = ${shell cygpath -w $(SCHEDSRCDIR)}
WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)}
USRINCLUDES = -usrinc:'.;$(WSCHEDSRCDIR);$(WARCHSRCDIR);$(WARCHSRCDIR)\common'
else
USRINCLUDES = -usrinc:".;$(SCHEDSRCDIR);$(ARCHSRCDIR);$(ARCHSRCDIR)\common"
endif
else
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(SCHEDSRCDIR)}"
ifeq ($(CONFIG_ARCH_SIM),y)
CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)}"
else
CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)chip}"
CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)common}"
ifneq ($(CONFIG_ARCH_FAMILY),)
CFLAGS += -I "${shell cygpath -w $(ARCHSRCDIR)$(DELIM)$(CONFIG_ARCH_FAMILY)}"
endif
endif
else
CFLAGS += -I$(SCHEDSRCDIR)
ifeq ($(CONFIG_ARCH_SIM),y)
CFLAGS += -I$(ARCHSRCDIR)
else
CFLAGS += -I$(ARCHSRCDIR)$(DELIM)chip
CFLAGS += -I$(ARCHSRCDIR)$(DELIM)common
ifneq ($(CONFIG_ARCH_FAMILY),)
CFLAGS += -I$(ARCHSRCDIR)$(DELIM)$(CONFIG_ARCH_FAMILY)
endif
endif
endif
endif
ifneq ($(ZDSVERSION),)
INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES)
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
endif
all: libboard$(LIBEXT)
ifneq ($(ZDSVERSION),)
$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
ifeq ($(WINTOOL),y)
$(Q) $(CPP) $(CPPFLAGS) `cygpath -w $<` -o $@.tmp
else
$(Q) $(CPP) $(CPPFLAGS) $< -o $@.tmp
endif
$(Q) cat $@.tmp | sed -e "s/^#/;/g" > $@
$(Q) rm $@.tmp
endif
$(AOBJS): %$(OBJEXT): %$(ASMEXT)
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
$(Q) $(AR) $@ # Create an empty archive
ifneq ($(OBJS),)
$(call ARCHIVE, $@, $(OBJS))
endif
.depend: Makefile $(SRCS)
ifneq ($(ZDSVERSION),)
$(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
else
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
endif
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, libboard$(LIBEXT))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
+1962
View File
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
############################################################################
# configs/Makefile
#
# Copyright (C) 2015 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)/Make.defs
# Basic
CONFIG_ASRCS =
CONFIG_CSRCS =
# boardctl support
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CONFIG_CSRCS += boardctl.c
endif
ASRCS = $(CONFIG_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = $(CONFIG_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
BIN = libconfigs$(LIBEXT)
all: $(BIN)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
ifneq ($(SRCS),)
$(Q) $(MKDEP) --dep-path . "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
endif
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, $(BIN))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
+813
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
File diff suppressed because it is too large Load Diff
+99
View File
@@ -0,0 +1,99 @@
############################################################################
# configs/amber/hello/Make.defs
#
# Copyright (C) 2011-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
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/avr/src/avr/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/hello/ld.script
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
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
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES =
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
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-gotoff.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT =
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+211
View File
@@ -0,0 +1,211 @@
/**************************************************************************************
* configs/amber/hello/ld.script
*
* Copyright (C) 2011 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.
*
**************************************************************************************/
/* Memory Regions *********************************************************************/
/* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
* | REGISTERS REGISTERS |
* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* ATMEGA128* 0x0000 128Kb | 0x0000 32 0x0020 64 0x0060 160 0x0100 4Kb | 0x0000 4Kb
* -------------- ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* *Memory configuration A
*/
MEMORY
{
flash (rx) : ORIGIN = 0, LENGTH = 128K
sram (rw!x) : ORIGIN = 0x800100, LENGTH = 4K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
}
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
OUTPUT_ARCH(avr:5)
ENTRY(__start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text :
{
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
}
.rela.text :
{
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
}
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata :
{
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
}
.rela.rodata :
{
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
}
.rel.data :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
}
.rela.data :
{
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
}
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.text :
{
_stext = . ;
*(.vectors)
*(.init)
*(.handlers)
*(.text)
*(.text.*)
_etext = . ;
} > flash
_eronly = ABSOLUTE(.);
.data :
{
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss :
{
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Global data not cleared after reset. */
.noinit :
{
_snoinit = ABSOLUTE(.);
*(.noinit*)
_enoinit = ABSOLUTE(.);
} > sram
.eeprom :
{
_seeprom = ABSOLUTE(.);
*(.eeprom*)
_eeeprom = ABSOLUTE(.);
} > eeprom
/* 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) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
}
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# configs/amber/hello/setenv.sh
#
# Copyright (C) 2011 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 is the Cygwin path to the location where I installed the WinAVR
# toolchain under windows. This is *not* the default install
# location so you will probably have to edit this. You will also have
# to edit this if you install the Linux AVR toolchain as well
#export TOOLCHAIN_BIN="/cygdrive/c/WinAVR/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
export TOOLCHAIN_BIN="${WD}/../buildroot/build_avr/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}"
+100
View File
@@ -0,0 +1,100 @@
/****************************************************************************
* configs/amber/include/board.h
* include/arch/board/board.h
*
* Copyright (C) 2011 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.
*
****************************************************************************/
#ifndef __CONFIGS_AMBER_INCLUDE_BOARD_H
#define __CONFIGS_AMBER_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Clocking *****************************************************************/
/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
#define BOARD_XTAL_FREQ 14745600 /* 14.7456MHz crystal */
#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 14.7456MHz */
#define BOARD_TOSCK_CLOCK 32768 /* TOSC = 32.768KHz */
/* LED definitions **********************************************************/
/* The Amber Web Server has a reset switch and four LEDs. The LEDs indicate
* the status of power, programming state, Ethernet link status and reset
* status (Active). None are available for software use.
*/
#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
#define LED_IRQSENABLED 2
#define LED_STACKCREATED 3
#define LED_INIRQ 4
#define LED_SIGNAL 5
#define LED_ASSERTION 6
#define LED_PANIC 7
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_AMBER_INCLUDE_BOARD_H */
+2
View File
@@ -0,0 +1,2 @@
/.depend
/Make.dep
+45
View File
@@ -0,0 +1,45 @@
############################################################################
# configs/amber/src/Makefile
#
# Copyright (C) 2011-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)/Make.defs
ASRCS =
CSRCS = atmega_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += atmega_leds.c
endif
include $(TOPDIR)/configs/Board.mk
+102
View File
@@ -0,0 +1,102 @@
/****************************************************************************
* configs/amber/src/amber.h
*
* Copyright (C) 2011 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.
*
****************************************************************************/
#ifndef __CONFIGS_AMBER_SRC_AMBER_H
#define __CONFIGS_AMBER_SRC_AMBER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/************************************************************************************
* Name: atmega_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the Amber Web Server.
*
************************************************************************************/
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
void weak_function atmega_spidev_initialize(void);
#endif
/************************************************************************************
* Name: atmega_led_initialize
*
* Description:
* Configure on-board LEDs if LED support has been selected.
*
************************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void atmega_led_initialize(void);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_AMBER_SRC_AMBER_H */
+92
View File
@@ -0,0 +1,92 @@
/************************************************************************************
* configs/amber/src/atmega_boot.c
*
* Copyright (C) 2011, 2015 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 <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "atmega.h"
#include "amber.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: atmega_boardinitialize
*
* Description:
* All ATMega architectures must provide the following entry point. This entry
* point is called early in the initialization -- after all memory has been
* configured and mapped but before any devices have been initialized.
*
************************************************************************************/
void atmega_boardinitialize(void)
{
/* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
* function atmega_spidev_initialize() has been brought into the link.
*/
#if defined(CONFIG_AVR_SPI1) || defined(CONFIG_AVR_SPI2)
if (atmega_spidev_initialize)
{
atmega_spidev_initialize();
}
#endif
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
atmega_led_initialize();
#endif
}
+24
View File
@@ -0,0 +1,24 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_ARDUINO_DUE
config ADRUINO_DUE_REV3
bool "Rev 3"
default n
---help---
This port was performed on the Aduino Due Rev 2 board. Differences
with the Arduino Due Rev 3 board have been reported. This selection
will enable work arounds specifically for the Rev 3 board.
config ARDUINO_ITHEAD_TFT
bool "ITEAD 2.4 inch TFT w/Touch"
default n
---help---
Select this option if you have the ITEAD 2.4" TFT module installed.
This will enable support for the peripherals on that module
including the SD card, TFT LCD, and touchscreen controller.
endif
File diff suppressed because it is too large Load Diff
+262
View File
@@ -0,0 +1,262 @@
/************************************************************************************
* configs/arduino-due/include/board.h
*
* Copyright (C) 2013 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.
*
************************************************************************************/
#ifndef __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H
#define __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <stdint.h>
# include <stdbool.h>
# ifdef CONFIG_SAM34_GPIO_IRQ
# include <arch/irq.h>
# endif
#endif
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Clocking *************************************************************************/
/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. These
* definitions will configure clocking
*
* MAINOSC: Frequency = 12MHz (crysta)
* PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz
* Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz
* CPU clock: 84MHz
*/
#define BOARD_32KOSC_FREQUENCY (32768)
#define BOARD_SCLK_FREQUENCY (BOARD_32KOSC_FREQUENCY)
#define BOARD_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
/* Main oscillator register settings.
*
* The start up time should be should be:
* Start Up Time = 8 * MOSCXTST / SLCK = 56 Slow Clock Cycles.
*/
#define BOARD_CKGR_MOR_MOSCXTST (62 << PMC_CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */
/* PLLA configuration.
*
* Divider = 1
* Multipler = 14
*/
#define BOARD_CKGR_PLLAR_MUL (13 << PMC_CKGR_PLLAR_MUL_SHIFT)
#define BOARD_CKGR_PLLAR_COUNT (63 << PMC_CKGR_PLLAR_COUNT_SHIFT)
#define BOARD_CKGR_PLLAR_DIV PMC_CKGR_PLLAR_DIV_BYPASS
/* PMC master clock register settings.
*
* Source = PLLA
* Divider = 2
*/
#define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLA
#define BOARD_PMC_MCKR_PRES PMC_MCKR_PRES_DIV2
/* USB UTMI PLL start-up time */
#define BOARD_CKGR_UCKR_UPLLCOUNT (3 << PMC_CKGR_UCKR_UPLLCOUNT_SHIFT)
/* Resulting frequencies */
#define BOARD_PLLA_FREQUENCY (168000000) /* PLLACK: 14 * 12Mhz / 1 */
#define BOARD_MCK_FREQUENCY (84000000) /* MCK: PLLACK / 2 */
#define BOARD_CPU_FREQUENCY (84000000) /* CPU: MCK */
/* HSMCI clocking
*
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
* divided by (2*(CLKDIV+1)).
*
* MCI_SPEED = MCCK / (2*(CLKDIV+1))
* CLKDIV = MCCK / MCI_SPEED / 2 - 1
*
* Where CLKDIV has a range of 0-255.
*/
/* MCK = 84MHz, CLKDIV = 104, MCI_SPEED = 84MHz / 2 * (104+1) = 400 KHz */
#define HSMCI_INIT_CLKDIV (104 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 84MHz, CLKDIV = 2, MCI_SPEED = 84MHz / 2 * (2+1) = 14 MHz */
#define HSMCI_MMCXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 84MHz, CLKDIV = 1, MCI_SPEED = 84MHz / 2 * (1+1) = 21 MHz */
#define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
/* FLASH wait states
*
* FWS MAX FREQUENCY
* 1.62V 1.8V
* --- ----- ------
* 0 17MHz 19MHz
* 1 45MHz 50MHz
* 2 58MHz 64MHz
* 3 70MHz 80MHz
* 4 78MHz 90MHz
*/
#define BOARD_FWS 4
/* LED definitions ******************************************************************/
/* There are three user-controllable LEDs on board the Arduino Due board:
*
* LED GPIO
* ---------------- -----
* L Amber LED PB27
* TX Yellow LED PA21
* RX Yellow LED PC30
*
* LED L is connected to ground and can be illuminated by driving the PB27
* output high. The TX and RX LEDs are pulled high and can be illuminated by
* driving the corresponding
* GPIO output to low.
*/
/* LED index values for use with board_userled() */
#define BOARD_LED_L 0
#define BOARD_LED_RX 1
#define BOARD_LED_TX 2
#define BOARD_NLEDS 3
/* LED bits for use with board_userled_all() */
#define BOARD_LED_L_BIT (1 << BOARD_LED_L)
#define BOARD_LED_RX_BIT (1 << BOARD_LED_RX)
#define BOARD_LED_TX_BIT (1 << BOARD_LED_TX)
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
* events as follows:
*
* SYMBOL MEANING LED STATE
* L TX RX
* ----------------------- -------------------------- -------- -------- -------- */
#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF OFF */
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF OFF */
#define LED_STACKCREATED 1 /* Idle stack created ON OFF OFF */
#define LED_INIRQ 2 /* In an interrupt N/C GLOW OFF */
#define LED_SIGNAL 2 /* In a signal handler N/C GLOW OFF */
#define LED_ASSERTION 2 /* An assertion failed N/C GLOW OFF */
#define LED_PANIC 3 /* The system has crashed N/C N/C Blinking */
#define LED_PANIC 3 /* MCU is is sleep mode ------ Not used -------- */
/* Thus if LED L is statically on, NuttX has successfully booted and is,
* apparently, running normmally. If LED RX is glowing, then NuttX is
* handling interrupts (and also signals and assertions). If TX is flashing
* at approximately 2Hz, then a fatal error has been detected and the system
*/
/* Button definitions ***************************************************************/
/* There are no buttons on the Arduino Due board. */
/* GPIO pin configurations **********************************************************/
#if 1 /* #ifdef CONFIG_ARDUINO_DUE_REV3 works with REV2 as well */
/* This port was performed on the Arduino Due Rev 2 board. A NuttX user reported
* issues with the serial port on his Aduino Due Rev 3 board. That problem was
* resolved as follows:
*
* "... The issue was in my hardware. I found the difference between Arduino
* Due shematics (revision R2) and actual PCB layout of my Arduino (revision
* R3). On a schematics which I download from arduino.cc was shown that 2nd
* pin of IC10 is connected to the ground, but on my Arduino the 2nd pin
* of IC10 was connected to its 1st pin instead of ground and in my case
* IC10 works in open-drain mode, but RX0 pin on SAM3x doesn't have pull-up
* and thus TX signal from AtMega16U2 can't reach the SAM3x input pin, on
* this pin always '0'.
*
* "My solution is to enable internal pull-up in SAM3x. ...
* Now shell console on UART0 (via USB programming connector) of Arduino Due
* Due works as expected."
*/
# undef GPIO_UART0_RXD
# define GPIO_UART0_RXD (GPIO_PERIPHA | GPIO_CFG_DEFAULT | GPIO_PORT_PIOA | \
GPIO_PIN8 | GPIO_CFG_PULLUP)
#endif
/************************************************************************************
* Public Data
************************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
/************************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3X architectures must provide the following entry point. This entry point
* is called early in the intitialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
*
************************************************************************************/
void sam_boardinitialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_ARDUINO_DUE_INCLUDE_BOARD_H */
+109
View File
@@ -0,0 +1,109 @@
############################################################################
# configs/arduino-due/nsh/Make.defs
#
# Copyright (C) 2013 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
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.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)/scripts/ld.script}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
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
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
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)/binfmt/libnxflat/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 =
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
# configs/arduino-due/nsh/setenv.sh
#
# Copyright (C) 2013 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 is the Cygwin path to the location where I installed the Atmel GCC
# toolchain under Windows. You will also have to edit this if you install
# this toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
# This is 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"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
# the Atollic toolchain in any other location. /usr/bin is added before
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
# at those locations as well.
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
# This is the Cygwin path to the location where I have the Arduino BOSSA program
export BOSSA_BIN="/cygdrive/c/Program Files (x86)/Arduino/arduino-1.5.2/hardware/tools"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:${BOSSA_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+123
View File
@@ -0,0 +1,123 @@
/****************************************************************************
* configs/arduino-due/scripts/ld.script
*
* Copyright (C) 2013 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 ATSAM3X8E has 512KB of FLASH beginning at address 0x0008:0000 and
* up to 100KB SRAM in three memory regions.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00080000, LENGTH = 1024K
sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 32K
nfcram (rwx) : ORIGIN = 0x20100000, LENGTH = 4K
}
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
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} >flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} >flash
__exidx_end = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram0 AT > flash
_eronly = LOADADDR(.data);
.ramfunc ALIGN(4): {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > sram0 AT > flash
_framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram0
/* 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) }
}
+68
View File
@@ -0,0 +1,68 @@
############################################################################
# configs/arduino-due/src/Makefile
#
# Copyright (C) 2013 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)/Make.defs
ASRCS =
CSRCS = sam_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += sam_autoleds.c
else
CSRCS += sam_userleds.c
endif
ifeq ($(CONFIG_ARDUINO_ITHEAD_TFT),y)
ifeq ($(CONFIG_SPI_BITBANG),y)
ifeq ($(CONFIG_MMCSD_SPI),y)
CSRCS += sam_mmcsd.c
endif
ifeq ($(CONFIG_INPUT_ADS7843E),y)
CSRCS += sam_touchscreen.c
endif
endif
ifeq ($(CONFIG_LCD),y)
CSRCS += sam_lcd.c
endif
endif
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += sam_appinit.c
endif
include $(TOPDIR)/configs/Board.mk
+339
View File
@@ -0,0 +1,339 @@
/************************************************************************************
* configs/arduino-due/src/arduino-due.h
*
* Copyright (C) 2013 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.
*
************************************************************************************/
#ifndef __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H
#define __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "chip/sam_pinmap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* There are three user-controllable LEDs on board the Arduino Due board:
*
* LED GPIO
* ---------------- -----
* L Amber LED PB27
* TX Yellow LED PA21
* RX Yellow LED PC30
*
* LED L is connected to ground and can be illuminated by driving the PB27
* output high. The TX and RX LEDs are pulled high and can be illuminated by
* driving the corresponding
* GPIO output to low.
*
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
* events as follows:
*
* SYMBOL MEANING LED STATE
* L TX RX
* ------------------- ----------------------- -------- -------- --------
* LED_STARTED NuttX has been started OFF OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF OFF
* LED_IRQSENABLED Interrupts enabled OFF OFF OFF
* LED_STACKCREATED Idle stack created ON OFF OFF
* LED_INIRQ In an interrupt N/C GLOW OFF
* LED_SIGNAL In a signal handler N/C GLOW OFF
* LED_ASSERTION An assertion failed N/C GLOW OFF
* LED_PANIC The system has crashed N/C N/C Blinking
* LED_IDLE MCU is is sleep mode ------ Not used --------
*
* Thus if LED L is statically on, NuttX has successfully booted and is,
* apparently, running normmally. If LED RX is glowing, then NuttX is
* handling interrupts (and also signals and assertions). If TX is flashing
* at approximately 2Hz, then a fatal error has been detected and the system
*/
#define GPIO_LED_L (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOB | GPIO_PIN27)
#define GPIO_LED_RX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN30)
#define GPIO_LED_TX (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOA | GPIO_PIN21)
/* ITEAD 2.4" TFT with Touch
*
* The Arduino 2.4" TFT Touch Shield is designed for all the Arduino
* compatible boards. It works in 3.3V voltage level. It can be directly
* plugged on the Arduino and other compatible boards. It will offer
* display, touch and storage functions for the Arduino board
*
* Features:
*
* 1. Compatible with 3.3/5V operation voltage level
* 2. Compatible with UTFT library
* 3. With SD Card Socket
*
* The Arduino 2.4" TFT Touch shield uses the S6D1121 controller , it
* supports 8-bit data interface. The touch IC is TSC2046.
*
* ---------- --------------------------- ----------- --------------------------- ------------------
* Arduino ATSAM3X Due ITHEAD
* Due PIN GPIO FUNCTION SIGNAL PIN SIGNAL NOTES
* ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------
* PWMH
* 10 SCL1 PA18 TWCK0/A20/WKUP9 SCL1 --- --- --- SCL not available
* 9 SDA1 PA17 TWD0SPCK0 SDA1 --- --- --- SDA not available
* 8 Aref --- --- AREF J2 pin 8 Vref N/C ---
* 7 GND --- --- GND J2 pin 7 GND --- ---
* 6 PWM13 PB27 SPI0_SPCK/A20/WKUP10 PWM13 J2 pin 6 D13 SD_SCK SCK, also LED "L", Pulled low
* 5 PWM12 PD8 A21/NANDALE/TIOB8 PWM12 J2 pin 5 D12 SD_MISO MISO not available
* 4 PWM11 PD7 A17/BA1/TIOA8 PWM11 J2 pin 4 D11 SD_MOSI MOSI not available, Pulled low
* 3 PWM10 PA28 SPI0_NPCS0/PCK2/WKUP11 SS0/PWM10 J2 pin 3 D10 SD_CS Pulled low on-board
* 2 PWM9 PC21 A0/NBS0/PWML4 PWM9 J2 pin 2 D9 Touch_Dout ---
* 1 PWM8 PC22 A1/PWML5 PWM8 J2 pin 1 D8 Touch_IRQ ---
*
* PWML
* 8 PWM7 PC23 A2/PWML6 PWM7 J3 pin 8 D7 DB15 ---
* 7 PWM6 PC24 A3/PWML7 PWM6 J3 pin 7 D6 DB14 ---
* 6 PWM5 PC25 A4/TIOA6 PWM5 J3 pin 6 D5 DB13 ---
* 5 PWM4 PC26 A5/TIOB6 SS1/PWM4 J3 pin 5 D4 DB12 ---
* 4 PWM3 PC28 A7/TIOA7 PWM3 J3 pin 4 D3 DB11 ---
* 3 PWM2 PB25 RTS0/TIOA0 PWM2 J3 pin 3 D2 DB10 ---
* 2 PWM1 PA9 UTXD/PWMH3 TX J3 pin 2 D1 DB9 UART0 TX
* 1 PWM0 PA8 URXD/PWMH0/WKUP4 RX J3 pin 1 D0 DB8 UART0 RX
* ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------
* POWER
* 1 --- --- --- --- --- --- --- ---
* 2 IOref --- --- IOREF +3V3 --- --- --- ---
* 3 RESET --- --- MASTER_RESET J4 pin 1 RST --- ---
* 5 5V --- --- +5V J4 pin 2 3.3V --- ---
* 4 3.3V --- --- +3V3 J4 pin 3 5V --- ---
* 6 GND --- --- GND J4 pin 4 GND --- ---
* 7 GND --- --- GND J4 pin 5 GND --- ---
* 8 Vin --- --- VIN J4 pin 6 Vin --- ---
* ADCL
* 1 A0 PA16 SPCK1/TD/AD7 AD0 J1 pin 1 A0/D14 Touch_Din ---
* 2 A1 PA24 MCDA3/PCK1/AD6 AD1 J1 pin 1 A1/D15 Touch_CLK ---
* 3 A2 PA23 MCDA2/TCLK4/AD5 AD2 J1 pin 1 A2/D16 --- ---
* 4 A3 PA22 MCDA1/TCLK3/AD4 AD3 J1 pin 1 A3/D17 TFT_CS ---
* 5 A4 PA6 TIOB2/NCS0/AD3 AD4 J1 pin 1 A4/D18 TFT_WR ---
* 6 A5 PA4 TCLK1/NWAIT/AD2 AD5 J1 pin 1 A5/D19 TFT_RS ---
* 7 A6 PA3 TIOB1/PWMFI1/AD1/WKUP1 AD6 --- --- --- ---
* 8 A7 PA2 TIOA1/NANDRDY/AD0 AD7 --- --- --- ---
* ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------
*
* NOTES:
*
* 1. It is not possible to use any of the SPI devices on the Shield unless
* a bit-bang SPI interface is used. This includes the touch controller
* and the SD card.
* 2. UART0 cannot be used. USARTs on the COMM connector should be available.
* 3. Parallel data is not contiguous in the PIO register
* 4. Touchcontroller /CS pin is connected to ground (always selected).
* 5. Either PA28 or PC29 may drive PWM10
*/
#ifdef CONFIG_ARDUINO_ITHEAD_TFT
/* In order to use the SD card on the ITEAD shield, you must enable the
* SPI bit-bang driver as well as support for SPI-based MMC/SD cards.
*/
# if defined(CONFIG_SPI_BITBANG) && defined(CONFIG_MMCSD_SPI)
/* SD Interface:
*
* ------------ ------------------ ------- ------------- ------------------ -------
* SD CONNECTOR ARDUINO CONNECTORS AT91SAM SD CONNECTOR ARDUINO CONNECTORS AT91SAM
* PIN SIGNAL PIN SIGNAL GPIO PIN SIGNAL PIN SIGNAL GPIO
* --- -------- -------- --------- -------- ---- -------- -------- --------- -------
* 1 /CS J2 pin 3 D10 PA28 2 DI J2 pin 4 D11 PD7
* 3 GND --- --- --- 4 VCC --- --- ---
* 5 CLK J2 pin 6 D13 PB27 6 GND --- --- ---
* 7 DO J2 pin 5 D12 PD8 8 IRQ N/C --- ---
* 9 N/C --- --- --- 10 SW N/C --- ---
* 11 WP N/C --- --- 12 CD N/C --- ---
* 13 CD N/C --- --- 14 GND --- --- ---
* 15 GND --- --- --- 16 GND --- --- ---
* --- -------- -------- --------- -------- ---- -------- -------- --------- -------
*
* NOTES:
* - The SD slot shares the pin with LED "L" so LED support must be disabled
* to use the MMC/SD card on the ITEAD shield.
* - Either PA28 or PC29 may drive D10
*/
# ifdef CONFIG_ARCH_LEDs
# error LEDs may not be used with the ITEAD SD card
# endif
# define GPIO_SD_SCK (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOB | GPIO_PIN27)
# define GPIO_SD_MISO (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOD | \
GPIO_PIN8)
# define GPIO_SD_MOSI (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOD | GPIO_PIN7)
# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN28)
# endif
/* In order to use the touchscreen on the ITEAD shield, you must enable the
* SPI bit-bang driver and ADS7843E/XPT2046 device support.
*/
# if defined(CONFIG_SPI_BITBANG) && defined(CONFIG_INPUT_ADS7843E)
/* Touch Controller Interface:
*
* ----------- ------------------ -------- ------------- ------------------ -------
* XPT2046 ARDUINO CONNECTORS AT91SAM XPT2046 ARDUINO CONNECTORS AT91SAM
* PIN SIGNAL PIN SIGNAL GPIO PIN SIGNAL PIN SIGNAL GPIO
* --- ------- -------- --------- -------- ---- -------- -------- --------- -------
* 1 VCC --- --- --- 2 X+ --- --- ---
* 3 Y+ --- --- --- 4 X- --- --- ---
* 5 Y- --- --- --- 6 GND --- --- ---
* 7 IN3 N/C --- --- 8 IN4 N/C --- ---
* 9 VREF --- --- --- 10 VCC --- --- ---
* 11 IRQ J2 pin 2 D9 PC21 12 DOUT J2 pin 1 D8 PC22
* 13 BUSY N/C --- --- 14 DIN J1 pin 1 A0/D14 PA16
* 15 /CS --- --- --- 16 DCLK J1 pin 2 A1/D15 PA24
* --- ------- -------- --------- -------- ---- -------- -------- --------- -------
*
* NOTE: /CS is connected to ground (XPT2046 is always selected)
*/
# define GPIO_TSC_SCK (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN24)
# define GPIO_TSC_MISO (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOC | \
GPIO_PIN22)
# define GPIO_TSC_MOSI (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN16)
# define GPIO_TSC_IRQ (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_INT_BOTHEDGES | \
GPIO_PORT_PIOC | GPIO_PIN21)
# define SAM_TSC_IRQ SAM_IRQ_PC21
# endif
/* Only CONFIG_LCD is expected to enable the TFT LCD */
# ifdef CONFIG_LCD
/* UART0 cannot be used with the LCD because the UART0 pins are used
* by the LCD.
*/
# ifdef CONFIG_SAM34_UART0
# error "UART0 cannot be used with the ITEAD LCD"
# endif
/* Data pins are initially configured but may be switched dynamically to
* either inputs or outputs as needed.
*/
# define GPIO_LCD_D0IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN8)
# define GPIO_LCD_D1IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN9)
# define GPIO_LCD_D2IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOB | GPIO_PIN25)
# define GPIO_LCD_D3IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN28)
# define GPIO_LCD_D4IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN26)
# define GPIO_LCD_D5IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN25)
# define GPIO_LCD_D6IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN24)
# define GPIO_LCD_D7IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN23)
# define GPIO_LCD_D7IN (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN23)
# define GPIO_LCD_CS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN22)
# define GPIO_LCD_WR (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN6)
# define GPIO_LCD_RS (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOA | GPIO_PIN4)
# endif
#endif
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public data
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_sram_initialize
*
* Description:
* Configure and enable SRAM on board the SAM4S Xplained
*
************************************************************************************/
#ifdef CONFIG_SAM34_EXTSRAM0
void sam_sram_initialize(void);
#endif
/****************************************************************************
* Name: sam_sdinitialize
*
* Description:
* Initialize the SPI-based SD card.
*
****************************************************************************/
#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
defined(CONFIG_MMCSD_SPI)
int sam_sdinitialize(int minor);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_ARDUINO_DUE_SRC_ARDUNO_DUE_H */
+102
View File
@@ -0,0 +1,102 @@
/****************************************************************************
* config/arduino-due/src/sam_appinit.c
*
* Copyright (C) 2013 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 <stdio.h>
#include <syslog.h>
#include <nuttx/board.h>
#include "arduino-due.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
defined(CONFIG_MMCSD_SPI)
/* Support for the SD card slot on the ITEAD TFT shield */
/* Verify NSH PORT and SLOT settings */
# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO
# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO)
# endif
/* Default MMC/SD minor number */
# ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
# endif
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform architecture specific initialization
*
****************************************************************************/
int board_app_initialize(void)
{
#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
defined(CONFIG_MMCSD_SPI)
/* Initialize the SPI-based MMC/SD slot */
{
int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR,
"board_app_initialize: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
}
#endif
return OK;
}
+224
View File
@@ -0,0 +1,224 @@
/****************************************************************************
* configs/arduino-due/src/sam_autoleds.c
*
* Copyright (C) 2013, 2015 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 <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/board.h>
#include "chip.h"
#include "sam_gpio.h"
#include "arduino-due.h"
/* The board.h file may override pin configurations defined in sam_pinmap.h */
#include <arch/board/board.h>
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* There are three user-controllable LEDs on board the Arduino Due board:
*
* LED GPIO
* ---------------- -----
* L Amber LED PB27
* TX Yellow LED PA21
* RX Yellow LED PC30
*
* LED L is connected to ground and can be illuminated by driving the PB27
* output high. The TX and RX LEDs are pulled high and can be illuminated by
* driving the corresponding
* GPIO output to low.
*
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
* events as follows:
*
* SYMBOL MEANING LED STATE
* L TX RX
* ------------------- ----------------------- -------- -------- --------
* LED_STARTED NuttX has been started OFF OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF OFF
* LED_IRQSENABLED Interrupts enabled OFF OFF OFF
* LED_STACKCREATED Idle stack created ON OFF OFF
* LED_INIRQ In an interrupt N/C GLOW OFF
* LED_SIGNAL In a signal handler N/C GLOW OFF
* LED_ASSERTION An assertion failed N/C GLOW OFF
* LED_PANIC The system has crashed N/C N/C Blinking
* LED_IDLE MCU is is sleep mode ------ Not used --------
*
* Thus if LED L is statically on, NuttX has successfully booted and is,
* apparently, running normmally. If LED RX is glowing, then NuttX is
* handling interrupts (and also signals and assertions). If TX is flashing
* at approximately 2Hz, then a fatal error has been detected and the system
*/
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
* with CONFIG_DEBUG_VERBOSE too)
*/
#ifdef CONFIG_DEBUG_LEDS
# define leddbg lldbg
# define ledvdbg llvdbg
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
void board_autoled_initialize(void)
{
/* Configure RX and TX LED GPIOs for output */
sam_configgpio(GPIO_LED_L);
sam_configgpio(GPIO_LED_RX);
sam_configgpio(GPIO_LED_TX);
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
switch (led)
{
/* 0: LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED: L=OFF TX=OFF
* RX=OFF
*
* Since the LEDs were initially all OFF and since this state only
* occurs one time, nothing need be done.
*/
default:
case 0:
break;
/* 1: LED_STACKCREATED: L=ON TX=OFF RX=OFF
*
* This case will also occur only once. Note that unlike the other
* LEDs, LED L is active high.
*/
case 1:
sam_gpiowrite(GPIO_LED_L, true);
break;
/* 2: LED_INIRQ, LED_SIGNAL, LED_ASSERTION: L=N/C TX=ON RX=N/C
*
* This case will occur many times. LED TX is active low.
*/
case 2:
sam_gpiowrite(GPIO_LED_TX, false);
break;
/* 3: LED_PANIC: L=N/X TX=N/C RX=ON
*
* This case will also occur many times. LED RX is active low.
*/
case 3:
sam_gpiowrite(GPIO_LED_RX, false);
break;
}
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
switch (led)
{
/* 0: LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED: L=OFF TX=OFF
* RX=OFF
* 1: LED_STACKCREATED: L=ON TX=OFF RX=OFF
*
* These cases should never happen.
*/
default:
case 1:
case 0:
break;
/* 2: LED_INIRQ, LED_SIGNAL, LED_ASSERTION: L=N/C TX=OFF RX=N/C
*
* This case will occur many times. LED TX is active low.
*/
case 2:
sam_gpiowrite(GPIO_LED_TX, true);
break;
/* 3: LED_PANIC: L=N/X TX=N/C RX=OFF
*
* This case will also occur many times. LED RX is active low.
*/
case 3:
sam_gpiowrite(GPIO_LED_RX, true);
break;
}
}
#endif /* CONFIG_ARCH_LEDS */
+77
View File
@@ -0,0 +1,77 @@
/************************************************************************************
* configs/arduino-due/src/sam_boot.c
*
* Copyright (C) 2013, 2015 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 <debug.h>
#include <nuttx/board.h>
#include "arduino-due.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3X architectures must provide the following entry point. This entry point
* is called early in the intitialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
*
************************************************************************************/
void sam_boardinitialize(void)
{
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
board_autoled_initialize();
#endif
}
+287
View File
@@ -0,0 +1,287 @@
/****************************************************************************
* configs/sam3u-ek/src/up_mmcsd.c
*
* Copyright (C) 2010, 2013 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 <stdbool.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/mmcsd.h>
#include <nuttx/spi/spi.h>
#include <nuttx/spi/spi_bitbang.h>
#include "up_arch.h"
#include "sam_gpio.h"
#include "chip/sam3u_pio.h"
#include "arduino-due.h"
/* In order to use the SD card on the ITEAD shield, you must enable the SPI bit-bang
* driver as well as support for SPI-based MMC/SD cards.
*/
#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
defined(CONFIG_MMCSD_SPI)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_DISABLE_MOUNTPOINT
# error Mountpoints are disabled (CONFIG_DISABLE_MOUNTPOINT=y)
#endif
/* Definitions for include/nuttx/spi/spi_bitbang.c. */
#define SPI_SETSCK putreg32(1 << 27, SAM_PIOB_SODR)
#define SPI_CLRSCK putreg32(1 << 27, SAM_PIOB_CODR)
#define SPI_SETMOSI putreg32(1 << 7, SAM_PIOD_SODR)
#define SPI_CLRMOSI putreg32(1 << 7, SAM_PIOD_CODR)
#define SPI_GETMISO ((getreg32(SAM_PIOD_PDSR) >> 8) & 1)
#define SPI_SETCS putreg32(1 << 28, SAM_PIOA_SODR)
#define SPI_CLRCS putreg32(1 << 28, SAM_PIOA_CODR)
/* Only mode 0 */
#undef SPI_BITBANG_DISABLEMODE0
#define SPI_BITBANG_DISABLEMODE1 1
#define SPI_BITBANG_DISABLEMODE2 1
#define SPI_BITBANG_DISABLEMODE3 1
/* Only 8-bit data width */
#undef SPI_BITBANG_VARWIDTH
/* Calibration value for timing loop */
#define SPI_BITBAND_LOOPSPERMSEC CONFIG_BOARD_LOOPSPERMSEC
/* SPI_PERBIT_NSEC is the minimum time to transfer one bit. This determines
* the maximum frequency and is also used to calculate delays to achieve
* other SPI frequencies.
*/
#define SPI_PERBIT_NSEC 100
/* Misc definitions */
#define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool selected);
static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool cmd);
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Include the bit-band skeleton logic
****************************************************************************/
#include <nuttx/spi/spi_bitbang.c>
/****************************************************************************
* Name: spi_select
*
* Description:
* Select or de-selected the SPI device specified by 'devid'
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to select or de-select
* selected - True:select false:de-select
*
* Returned Value:
* None
*
****************************************************************************/
static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool selected)
{
if (devid == SPIDEV_MMCSD)
{
if (selected)
{
SPI_CLRCS;
}
else
{
SPI_SETCS;
}
}
}
/****************************************************************************
* Name: spi_status
*
* Description:
* Return status of the SPI device specified by 'devid'
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to select or de-select
*
* Returned Value:
* An 8-bit, bit-encoded status byte
*
****************************************************************************/
static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
{
if (devid == SPIDEV_MMCSD)
{
return SPI_STATUS_PRESENT;
}
return 0;
}
/****************************************************************************
* Name: spi_cmddata
*
* Description:
* If there were was a CMD/DATA line, this function would manage it
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to use
* cmd - True=MCD false=DATA
*
* Returned Value:
* OK
*
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool cmd)
{
return OK;
}
#endif
/****************************************************************************
* Name: sam_mmcsd_spiinitialize
*
* Description:
* Initialize the SPI bit-bang driver
*
* Input Parameters:
* None
*
* Returned Value:
* A non-NULL reference to the SPI driver on success
*
****************************************************************************/
static FAR struct spi_dev_s *sam_mmcsd_spiinitialize(void)
{
/* Initialize GPIOs */
sam_configgpio(GPIO_SD_SCK);
sam_configgpio(GPIO_SD_MISO);
sam_configgpio(GPIO_SD_MOSI);
sam_configgpio(GPIO_SD_CS);
/* Create the SPI driver instance */
return spi_create_bitbang(&g_spiops);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: sam_sdinitialize
*
* Description:
* Initialize the SPI-based SD card.
*
****************************************************************************/
int sam_sdinitialize(int minor)
{
FAR struct spi_dev_s *spi;
int ret;
/* Get the SPI driver instance for the SD chip select */
fvdbg("Initializing bit bang SPI for the MMC/SD slot\n");
spi = sam_mmcsd_spiinitialize();
if (!spi)
{
fdbg("Failed to bit bang SPI for the MMC/SD slot\n");
return -ENODEV;
}
fvdbg("Successfully initialized bit bang SPI for the MMC/SD slot\n");
/* Bind the SPI device for the chip select to the slot */
fvdbg("Binding bit bang SPI device to MMC/SD slot %d\n",
SAM34_MMCSDSLOTNO);
ret = mmcsd_spislotinitialize(minor, SAM34_MMCSDSLOTNO, spi);
if (ret < 0)
{
fdbg("Failed to bind bit bang SPI device to MMC/SD slot %d: %d\n",
SAM34_MMCSDSLOTNO, ret);
return ret;
}
fvdbg("Successfuly bound bit bang SPI device to MMC/SD slot %d\n",
SAM34_MMCSDSLOTNO);
return OK;
}
#endif /* CONFIG_ARDUINO_ITHEAD_TFT && CONFIG_SPI_BITBANG && CONFIG_MMC_SPI */
+431
View File
@@ -0,0 +1,431 @@
/************************************************************************************
* configs/sam3u-ek/src/up_touchscreen.c
*
* Copyright (C) 2011-2013 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 <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <assert.h>
#include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/spi/spi_bitbang.h>
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h>
#include "up_arch.h"
#include "sam_gpio.h"
#include "chip/sam3u_pio.h"
#include "arduino-due.h"
/* In order to use the SD card on the ITEAD shield, you must enable the SPI
* bit-bang driver as well as support for SPI-based ADS7843E/XPT2046
* touchscreen controller.
*/
#if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \
defined(CONFIG_INPUT_ADS7843E)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_SAM34_GPIOC_IRQ
# error "Touchscreen support requires CONFIG_SAM34_GPIOC_IRQ"
#endif
#ifndef CONFIG_ADS7843E_FREQUENCY
# define CONFIG_ADS7843E_FREQUENCY 500000
#endif
#ifndef CONFIG_ADS7843E_SPIDEV
# define CONFIG_ADS7843E_SPIDEV 0
#endif
#ifndef CONFIG_ADS7843E_DEVMINOR
# define CONFIG_ADS7843E_DEVMINOR 0
#endif
/* Definitions for include/nuttx/spi/spi_bitbang.c. */
#define SPI_SETSCK putreg32(1 << 24, SAM_PIOA_SODR)
#define SPI_CLRSCK putreg32(1 << 24, SAM_PIOA_CODR)
#define SPI_SETMOSI putreg32(1 << 16, SAM_PIOA_SODR)
#define SPI_CLRMOSI putreg32(1 << 16, SAM_PIOA_CODR)
#define SPI_GETMISO ((getreg32(SAM_PIOC_PDSR) >> 22) & 1)
/* Only mode 0 */
#undef SPI_BITBANG_DISABLEMODE0
#define SPI_BITBANG_DISABLEMODE1 1
#define SPI_BITBANG_DISABLEMODE2 1
#define SPI_BITBANG_DISABLEMODE3 1
/* Only 8-bit data width */
#undef SPI_BITBANG_VARWIDTH
/* Calibration value for timing loop */
#define SPI_BITBAND_LOOPSPERMSEC CONFIG_BOARD_LOOPSPERMSEC
/* SPI_PERBIT_NSEC is the minimum time to transfer one bit. This determines
* the maximum frequency and is also used to calculate delays to achieve
* other SPI frequencies.
*/
#define SPI_PERBIT_NSEC 100
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Lower-half SPI */
static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool selected);
static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool cmd);
#endif
/* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the XPT2046 driver from differences in GPIO
* interrupt handling by varying boards and MCUs. If possible,
* interrupts should be configured on both rising and falling edges
* so that contact and loss-of-contact events can be detected.
*
* attach - Attach the XPT2046 interrupt handler to the GPIO interrupt
* enable - Enable or disable the GPIO interrupt
* clear - Acknowledge/clear any pending GPIO interrupt
* pendown - Return the state of the pen down GPIO input
*/
static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr);
static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable);
static void tsc_clear(FAR struct ads7843e_config_s *state);
static bool tsc_busy(FAR struct ads7843e_config_s *state);
static bool tsc_pendown(FAR struct ads7843e_config_s *state);
/****************************************************************************
* Private Data
****************************************************************************/
/* A reference to a structure of this type must be passed to the XPT2046
* driver. This structure provides information about the configuration
* of the XPT2046 and provides some board-specific hooks.
*
* Memory for this structure is provided by the caller. It is not copied
* by the driver and is presumed to persist while the driver is active. The
* memory must be writable because, under certain circumstances, the driver
* may modify frequency or X plate resistance values.
*/
static struct ads7843e_config_s g_tscinfo =
{
.frequency = CONFIG_ADS7843E_FREQUENCY,
.attach = tsc_attach,
.enable = tsc_enable,
.clear = tsc_clear,
.busy = tsc_busy,
.pendown = tsc_pendown,
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Include the bit-band skeleton logic
****************************************************************************/
#include <nuttx/spi/spi_bitbang.c>
/****************************************************************************
* Name: spi_select
*
* Description:
* Select or de-selected the SPI device specified by 'devid'
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to select or de-select
* selected - True:select false:de-select
*
* Returned Value:
* None
*
****************************************************************************/
static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool selected)
{
/* The touchscreen controller is always selected */
}
/****************************************************************************
* Name: spi_status
*
* Description:
* Return status of the SPI device specified by 'devid'
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to select or de-select
*
* Returned Value:
* An 8-bit, bit-encoded status byte
*
****************************************************************************/
static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
{
return 0;
}
/****************************************************************************
* Name: spi_cmddata
*
* Description:
* If there were was a CMD/DATA line, this function would manage it
*
* Input Parameters:
* priv - An instance of the bit-bang driver structure
* devid - The device to use
* cmd - True=MCD false=DATA
*
* Returned Value:
* OK
*
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
bool cmd)
{
return OK;
}
#endif
/****************************************************************************
* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the XPT2046 driver from differences in GPIO
* interrupt handling by varying boards and MCUs. If possible,
* interrupts should be configured on both rising and falling edges
* so that contact and loss-of-contact events can be detected.
*
* attach - Attach the XPT2046 interrupt handler to the GPIO interrupt
* enable - Enable or disable the GPIO interrupt
* clear - Acknowledge/clear any pending GPIO interrupt
* pendown - Return the state of the pen down GPIO input
*
****************************************************************************/
static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr)
{
/* Attach the XPT2046 interrupt */
ivdbg("Attaching %p to IRQ %d\n", isr, SAM_TSC_IRQ);
return irq_attach(SAM_TSC_IRQ, isr);
}
static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
{
/* Attach and enable, or detach and disable */
ivdbg("IRQ:%d enable:%d\n", SAM_TSC_IRQ, enable);
if (enable)
{
sam_gpioirqenable(SAM_TSC_IRQ);
}
else
{
sam_gpioirqdisable(SAM_TSC_IRQ);
}
}
static void tsc_clear(FAR struct ads7843e_config_s *state)
{
/* Does nothing */
}
static bool tsc_busy(FAR struct ads7843e_config_s *state)
{
return false; /* The BUSY signal is not connected */
}
static bool tsc_pendown(FAR struct ads7843e_config_s *state)
{
/* The /PENIRQ value is active low */
bool pendown = !sam_gpioread(GPIO_TSC_IRQ);
ivdbg("pendown:%d\n", pendown);
return pendown;
}
/****************************************************************************
* Name: sam_tsc_spiinitialize
*
* Description:
* Initialize the SPI bit-bang driver
*
* Input Parameters:
* None
*
* Returned Value:
* A non-NULL reference to the SPI driver on success
*
****************************************************************************/
static FAR struct spi_dev_s *sam_tsc_spiinitialize(void)
{
/* Configure the SPI bit-bang pins */
sam_configgpio(GPIO_TSC_SCK);
sam_configgpio(GPIO_TSC_MISO);
sam_configgpio(GPIO_TSC_MOSI);
/* Create the SPI driver instance */
return spi_create_bitbang(&g_spiops);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_tsc_setup
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* configure the touchscreen device. This function will register the driver
* as /dev/inputN where N is the minor device number.
*
* Input Parameters:
* minor - The input device minor number
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int board_tsc_setup(int minor)
{
FAR struct spi_dev_s *dev;
static bool initialized = false;
int ret;
idbg("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Have we already initialized? Since we never uninitialize we must prevent
* multiple initializations. This is necessary, for example, when the
* touchscreen example is used as a built-in application in NSH and can be
* called numerous time. It will attempt to initialize each time.
*/
if (!initialized)
{
/* Configure and enable the XPT2046 interrupt pin as an input */
(void)sam_configgpio(GPIO_TSC_IRQ);
/* Configure the PIO interrupt */
sam_gpioirq(SAM_TSC_IRQ);
/* Get an instance of the SPI interface for the touchscreen chip select */
dev = sam_tsc_spiinitialize();
if (!dev)
{
idbg("Failed to initialize bit bang SPI\n");
return -ENODEV;
}
/* Initialize and register the SPI touschscreen device */
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
if (ret < 0)
{
idbg("Failed to register touchscreen device\n");
/* up_spiuninitialize(dev); */
return -ENODEV;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}
/****************************************************************************
* Name: board_tsc_teardown
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* uninitialize the touchscreen device.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void board_tsc_teardown(void)
{
/* No support for un-initializing the touchscreen XPT2046 device. It will
* continue to run and process touch interrupts in the background.
*/
}
#endif /* CONFIG_ARDUINO_ITHEAD_TFT && CONFIG_SPI_BITBANG && CONFIG_INPUT_ADS7843E */
+151
View File
@@ -0,0 +1,151 @@
/****************************************************************************
* configs/arduino-due/src/sam_userleds.c
*
* Copyright (C) 2013, 2015 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 <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "chip.h"
#include "sam_gpio.h"
#include "arduino-due.h"
#ifndef CONFIG_ARCH_LEDS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
* with CONFIG_DEBUG_VERBOSE too)
*/
#ifdef CONFIG_DEBUG_LEDS
# define leddbg lldbg
# define ledvdbg llvdbg
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Function Protototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_userled_initialize
****************************************************************************/
void board_userled_initialize(void)
{
/* Configure LED1-2 GPIOs for output */
sam_configgpio(GPIO_LED_L);
sam_configgpio(GPIO_LED_RX);
sam_configgpio(GPIO_LED_TX);
}
/****************************************************************************
* Name: board_userled
****************************************************************************/
void board_userled(int led, bool ledon)
{
uint32_t ledcfg;
if (led == BOARD_LED_L)
{
ledcfg = GPIO_LED_RX;
}
else if (led == BOARD_LED_RX)
{
ledcfg = GPIO_LED_RX;
ledon = !ledon;
}
else if (led == BOARD_LED_TX)
{
ledcfg = GPIO_LED_TX;
ledon = !ledon;
}
else
{
return;
}
sam_gpiowrite(ledcfg, ledon);
}
/****************************************************************************
* Name: board_userled_all
****************************************************************************/
void board_userled_all(uint8_t ledset)
{
bool ledon;
ledon = ((ledset & BOARD_LED_L_BIT) != 0);
sam_gpiowrite(GPIO_LED_L, ledon);
ledon = ((ledset & BOARD_LED_RX_BIT) != 0);
sam_gpiowrite(GPIO_LED_RX, ledon);
ledon = ((ledset & BOARD_LED_TX_BIT) != 0);
sam_gpiowrite(GPIO_LED_TX, ledon);
}
#endif /* !CONFIG_ARCH_LEDS */
+4
View File
@@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
+105
View File
@@ -0,0 +1,105 @@
README
======
This is the README file for the port of NuttX to the Arduino Mega 2560 Rev3.
https://www.arduino.cc/en/Main/ArduinoBoardMega2560
The board is based on ATMega2560 chip from Atmel
http://www.atmel.com/devices/atmega2560.aspx
Contents
========
o Toolchain
o Serial Console
o Configurations
Toolchain
=========
Right now only Atmel's AVR8 Toolchain is supported. You can get it from
http://www.atmel.com/tools/atmelavrtoolchainforwindows.aspx
It is basically WinAVR compatible so sub-projects may define WinAVR as a
tool-chain but specify path to the Atmel AVR8 in path. See
arduino-mega2560/hello for example.
Serial Console
==============
The serial console is available on USART0. You will need to connect an
RS-232 shield or an external RS-232 driver as follows:
TXD: TX0->1
RXD: RX0->0
GND: Power GND
+5V: Power +5V
You will then need to use a terminal program configured at 38400 8N1.
Configurations
==============
Common Configuration Notes
--------------------------
1. Each Arduino MEGA2560 configuration is maintained in a sub-directory
and can be selected as follow:
cd tools
./configure.sh arduino-mega2560/<subdir>
cd -
. ./setenv.sh
Where <subdir> is one of the configuration sub-directories described in
the following paragraph.
2. These configurations use the mconf-based configuration tool. To
change a configurations using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
see additional README.txt files in the NuttX tools repository.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
3. By default, all configurations assume the Atmel Studio AVR8 toolchain
under Cygwin with Windows. This is easily reconfigured:
CONFIG_HOST_WINDOWS=y
CONFIG_WINDOWS_CYGWIN=y
CONFIG_AVR_BUILDROOT_TOOLCHAIN=y
Configuration Sub-Directories
-----------------------------
hello:
The simple apps/examples/hello "Hello, World!" example.
nsh:
This is a reduce NuttShell (NSH) configuration using apps/example/nsh.
The serial console is provided on USART0 and can be accessed via
an external RS-232 driver as described above under "Serial Console".
NOTES:
1. As of 2015-01-16, the default static memory usage is:
$ size nuttx.elf
text data bss dec hex filename
34348 2117 944 37409 9221 nuttx.elf
And dynamic, heap usage:
nsh> free
total used free largest
Mem: 4736 1768 2968 2968
There is plenty of FLASH space but not a lot of free SRAM. This
SRAM usage is due primarily to constant strings defined by NSH.
NOTE: I investigated the possibility of adding IPTR/IOBJ
qualifiers in the NSH library and moving the strings to FLASH.
This is still a possibility but would requires some extensive
changes to NSH.
+101
View File
@@ -0,0 +1,101 @@
############################################################################
# configs/arduino-mega2560/hello/Make.defs
#
# Copyright (C) 2015 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
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/avr/src/avr/Toolchain.defs
LDSCRIPT = flash.ld
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(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
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g3
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
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES =
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
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-gotoff.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT = .elf
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
# configs/arduino-mega2560/hello/setenv.sh
#
# Copyright (C) 2015 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 is the Cygwin path to the location where I installed the WinAVR
# toolchain under windows. This is *not* the default install
# location so you will probably have to edit this. You will also have
# to edit this if you install the Linux AVR toolchain as well
# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin"
export TOOLCHAIN_BIN="/cygdrive/c/as-7/7.0/toolchain/avr8/avr8-gnu-toolchain/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="/sbin:/usr/sbin:${PATH_ORIG}:${TOOLCHAIN_BIN}"
echo "PATH : ${PATH}"
+85
View File
@@ -0,0 +1,85 @@
/****************************************************************************
* configs/arduino-mega2560/include/board.h
*
* Copyright (C) 2015 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.
*
****************************************************************************/
#ifndef __CONFIGS_ARDUINO_MEGA2560_INCLUDE_BOARD_H
#define __CONFIGS_ARDUINO_MEGA2560_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Clocking *****************************************************************/
/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */
//#define BOARD_XTAL_FREQ 20000000 /* 20MHz crystal */
//#define BOARD_XTAL_FREQ 16700000 /* 16.7MHz crystal */
#define BOARD_XTAL_FREQ 16000000 /* 16MHz crystal */
#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 16MHz */
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_ARDUINO_MEGA2560_INCLUDE_BOARD_H */
+101
View File
@@ -0,0 +1,101 @@
############################################################################
# configs/arduino-mega2560/nsh/Make.defs
#
# Copyright (C) 2015 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
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/avr/src/avr/Toolchain.defs
LDSCRIPT = flash.ld
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = $(ARCHINCLUDES) "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
ARCHINCLUDES = -I. -isystem "$(TOPDIR)/include"
ARCHXXINCLUDES = $(ARCHINCLUDES) -isystem "$(TOPDIR)/include/cxx"
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(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
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g3
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
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES =
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
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-gotoff.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT = .elf
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
# configs/arduino-mega2560/nsh/setenv.sh
#
# Copyright (C) 2015 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 is the Cygwin path to the location where I installed the WinAVR
# toolchain under windows. This is *not* the default install
# location so you will probably have to edit this. You will also have
# to edit this if you install the Linux AVR toolchain as well
# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin"
export TOOLCHAIN_BIN="/cygdrive/c/as-7/7.0/toolchain/avr8/avr8-gnu-toolchain/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_avr/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="/sbin:/usr/sbin:${PATH_ORIG}:${TOOLCHAIN_BIN}"
echo "PATH : ${PATH}"
+213
View File
@@ -0,0 +1,213 @@
/*******************************************************************************
* configs/arduino-mega2560/scripts/flash.ld
*
* Copyright (C) 2015 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.
*
******************************************************************************/
/* Memory Regions *************************************************************/
/* ------ ------ ------+------- -- ------ -- ------ --- ------ ----+------- ---
* FLASH | REGISTERS I/O EXT I/O ISRAM | EEPROM
* | REGISTERS REGISTERS |
* ------- ------ -----+------- -- ------ -- ------ --- ------ ----+------- ---
* 0x0000 256Kb| 0x0000 32 0x0020 64 0x0060 416 0x0200 8Kb | 0x0000 4Kb
* ------- ------ -----+------- -- ------ -- ------ --- ------ ----+------- ---
* *Memory configuration A
*/
MEMORY
{
flash (rx) : ORIGIN = 0, LENGTH = 256K
sram (rw!x) : ORIGIN = 0x800200, LENGTH = 8K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 4K
}
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
OUTPUT_ARCH(avr:6)
ENTRY(__start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text :
{
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
}
.rela.text :
{
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
}
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata :
{
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
}
.rela.rodata :
{
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
}
.rel.data :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
}
.rela.data :
{
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
}
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.text :
{
_stext = . ;
*(.vectors)
*(.init)
*(.handlers)
*(.progmem .progmem.*)
*(.text)
*(.text.*)
_etext = . ;
} > flash
_eronly = ABSOLUTE(.);
.data :
{
_sdata = ABSOLUTE(.);
*(.rodata .rodata.*)
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss :
{
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Global data not cleared after reset. */
.noinit :
{
_snoinit = ABSOLUTE(.);
*(.noinit*)
_enoinit = ABSOLUTE(.);
} > sram
.eeprom :
{
_seeprom = ABSOLUTE(.);
*(.eeprom*)
_eeeprom = ABSOLUTE(.);
} > eeprom
/* 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) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
}
+98
View File
@@ -0,0 +1,98 @@
############################################################################
# configs/arduino-mega2560/src/Makefile
#
# Copyright (C) 2015 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)/Make.defs
ASRCS =
CSRCS = avr_boot.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += avr_leds.c
endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(CONFIG_ARCH_AVR32),y)
ARCH_SUBDIR = avr32
endif
ifeq ($(CONFIG_ARCH_AVR),y)
ARCH_SUBDIR = avr
endif
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(TOPDIR)/sched}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/$(ARCH_SUBDIR)/atmega2560}"
else
CFLAGS += -I "$(TOPDIR)/sched"
CFLAGS += -I "$(ARCH_SRCDIR)/chip"
CFLAGS += -I "$(ARCH_SRCDIR)/common"
CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)"
CFLAGS += -I "$(ARCH_SRCDIR)/$(ARCH_SUBDIR)/atmega2560"
endif
all: libboard$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
libboard$(LIBEXT): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, libboard$(LIBEXT))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
@@ -0,0 +1,77 @@
/****************************************************************************
* configs/arduino-mega2560/src/arduino-mega2560.h
*
* Copyright (C) 2011 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.
*
****************************************************************************/
#ifndef __CONFIGS_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H
#define __CONFIGS_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/*******************************************************************************
* Name: atmega_ledinit
*
* Description:
* Configure on-board LEDs if LED support has been selected.
*
******************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void atmega_led_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_ARDUINO_MEGA2560_SRC_ARDUINO_MEGA2560_H */
+82
View File
@@ -0,0 +1,82 @@
/******************************************************************************
* configs/arduino-mega2560/src/avr_boot.c
*
* Copyright (C) 2015 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 <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "atmega.h"
#include "arduino_mega2560.h"
/******************************************************************************
* Definitions
******************************************************************************/
/******************************************************************************
* Private Functions
******************************************************************************/
/******************************************************************************
* Public Functions
******************************************************************************/
/******************************************************************************
* Name: up_boardinitialize
*
* Description:
* All ATMega architectures must provide the following entry point.
* This entry point is called early in the intitialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
******************************************************************************/
void atmega_boardinitialize(void)
{
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
atmega_led_initialize();
#endif
}
+77
View File
@@ -0,0 +1,77 @@
/******************************************************************************
* configs/arduino-mega2560/src/avr_leds.c
*
* Copyright (C) 2015 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 <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "atmega2560.h"
#include "arduino_mega2560.h"
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void board_autoled_initialize(void)
{
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
}
#endif /* CONFIG_ARCH_LEDS */
+8
View File
@@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_AVR32DEV1
endif
+477
View File
@@ -0,0 +1,477 @@
README
^^^^^^
This is the README file for the NuttX port to the Atmel AVR32DEV1 board.
Contents
^^^^^^^^
* GPIO Pin Configuration
* Serial Connection
* Toolchains
* Development Environment
* GNU Toolchains
* IDEs
- Makefile Build
- Native Build
* AVR32 Bootloader
- Boot Sequence
- Link Address
- Entering the ISP
- BatchISP
* Reset
* Make Tip
* AVR32DEV1 Configuration Options
* Configurations
GPIO Pin Configuration
^^^^^^^^^^^^^^^^^^^^^^
The only GPIO pin usage is for LEDs (2) and Buttons (2):
PIN 13 PA7 LED1
PIN 14 PA8 LED2
PIN 24 PB2 KEY1
PIN 25 PB3 KEY2
(See configs/avr32dev1/src/avr32dev1.h). And also for
crystals (4), JTAG (1), and USB (1):
PIN 30 PA11 XIN32
PIN 31 PA12 XOUT32
PIN 35 PA15 EVTO (JTAG)
PIN 39 PA18 X1IN
PIN 40 PA19 X1OUT
PIN 61 PA26 ID (USB)
All GPIO pins are brought out through connectors J1 (PINS 33-64)
and J2 (PINS 1-32).
NOTE: There seems to be some difference in labeling for OSC0 and
OSC1 between MCUZone.com and Atmel:
Oscillator pinout
-------------------------- --------------------
QFP48 QFP64 Pad Oscillator AVR32DEV1
PIN PIN PIN LABEL
----- ----- ---- --------- --------------------
30 39 PA18 XIN0 X1IN (12MHz)
41 PA28 XIN1 PA28 (no crystal)
22 30 PA11 XIN32 XIN32 (32KHz)
31 40 PA19 XOUT0 X1OUT (12Mhz)
42 PA29 XOUT1 PA29 (no crystal)
23 31 PA12 XOUT32 XOUT32 (32 Khz)
----- ----- ---- --------- --------------------
NOTE 1: These crystal inputs/outputs are analog signals and my
assumption is that they need no pin multiplexing setting to
enable them for the external crystal function.
NOTE 2: There is no support for OSC1.
NOTE 3: There are solder pads for the 32KHz OSC32, but the
crystal is not populated on my board. Therefore, the RTC will
have to run from the (uncalibrated) RCOSC.
Serial Connection
^^^^^^^^^^^^^^^^^
USART1 is the default USART1 used in the configuration files to
provide a serial console (of course, that can be easily changed
by editting the configuration file). The AVR32DEV1 board has no
RS-232 drivers or connectors on board. I use an off-board MAX232
module that I got on eBay (search for MAX232 if you want to find
one). I connect the MAX232 board as follows:
In configs/avr32dev/include/board.h:
#define PINMUX_USART1_RXD PINMUX_USART1_RXD_1
#define PINMUX_USART1_TXD PINMUX_USART1_TXD_1
In arch/avr/src/at32uc3/at32uc3b_pinmux.h:
#define PINMUX_USART1_RXD_1 (GPIO_PERIPH | GPIO_FUNCD | GPIO_PORTA | 17)
#define PINMUX_USART1_TXD_1 (GPIO_PERIPH | GPIO_FUNCA | GPIO_PORTA | 23)
PA17 and PA23 are avaiable from the AVR32DEV1:
FUNC GPIO PIN Header 16X2 (J1) MX232 Board
---- ----- ----- ---------------- ------------
RXD PA17 PIN37 Pin 5 PIN4 RXD (5V TTL/CMOS)
TXD PA23 PIN47 Pin 15 PIN3 TXD (5V TTL/CMOS)
PIN2 GND
PIN1 VCC (5V)
Voltage on GPIO Pins with respect to Ground for TCK, RESET_N, PA03-PA08,
PA11-PA12, PA18-PA19, PA28-PA31............................-0.3 to 3.6V
Other Pins ............................................... -0.3 to 5.5V
I get the 5V from another USB port (using the 5V power cable that normally
provides the extra current needed by my USB IDE drive).
Development Environment
^^^^^^^^^^^^^^^^^^^^^^^
Linux, Mac OS X or Cygwin on Windows can be used for the development environment.
The source has been built only using the GNU toolchain (see below). Other
toolchains will likely cause problems. Testing was performed using the Cygwin
environment.
GNU Toolchains
^^^^^^^^^^^^^^
Atmel Toolchain:
The build logic in these directories assume that you are using the GNU
toolchain with the Atmel patches. The patch file, pre-patched tool
sources,and pre-built binaries are available from the Atmel website.
CONFIG_AVR32_AVRTOOLSW=y # Use the windows version
CONFIG_AVR32_AVRTOOLSL=y # Ue the Linux version
NOTE: The NuttX builtroot cannot be used to build the AVR32 toolchain.
This is because the Atmel patches that add support for the AVR32 are not
included in the NuttX buildroot.
WinAVR:
Another option for use under Windows is WinAVR:
http://sourceforge.net/projects/winavr/files/. WinAVR includes the
AVR32 toolchain as well as the AVR toolchain and various support
libraries and header files.
AVR32 Toolchain Builder:
A third option is to build the toolchain yourself. For OS X and Linux systems,
this Makefile will build a complete gcc-4.4.3 toolchain:
https://github.com/jsnyder/avr32-toolchain
By default the toolchain installs into ${HOME}/avr-32-tools-<somedate> and
the bin subdirectory must be added to your path before compiling.
IDEs
^^^^
NuttX is built using command-line make. It can be used with an IDE, but some
effort will be required to create the project.
Makefile Build
--------------
Under Eclipse, it is pretty easy to set up an "empty makefile project" and
simply use the NuttX makefile to build the system. That is almost for free
under Linux. Under Windows, you will need to set up the "Cygwin GCC" empty
makefile project in order to work with Windows (Google for "Eclipse Cygwin" -
there is a lot of help on the internet).
Native Build
------------
Here are a few tips before you start that effort:
1) Select the toolchain that you will be using in your .config file
2) Start the NuttX build at least one time from the Cygwin command line
before trying to create your project. This is necessary to create
certain auto-generated files and directories that will be needed.
3) Set up include pathes: You will need include/, arch/avr/src/at32uc3,
arch/avr/src/common, arch/arm/src/avr, and sched/.
4) All assembly files need to have the definition option -D __ASSEMBLY__
on the command line.
Startup files will probably cause you some headaches. The NuttX startup file
is arch/avr/src/avr3/up_nommuhead.S.
AVR32 Bootloader
^^^^^^^^^^^^^^^^
Boot Sequence
-------------
"An AVR UC3 part having the bootloader programmed resets as any other
part at 80000000h. Bootloader execution begins here. The bootloader
first performs the boot process to know whether it should start the
USB DFU ISP or the application. If the tested conditions indicate
that the USB DFU ISP should be started, then execution continues in
the bootloader area, i.e. between 80000000h and 80002000h, else
the bootloader launches the application at 80002000h."
Link Address
------------
The linker scripts (ld.script) assume that you are using the DFU
bootloader. The bootloader resides at 0x8000:0000 and so the ld.script
files link the application to execute after the bootloader at
0x8000:2000. To link so that NuttX boots directly without using the
bootloader, change the flash definition from:
flash (rxai!w) : ORIGIN = 0x80002000, LENGTH = 256K - 8K
to:
flash (rxai!w) : ORIGIN = 0x80000000, LENGTH = 256K
Or to use the MSC bootloader:
flash (rxai!w) : ORIGIN = 0x80008000, LENGTH = 256K - 32K
Entering the ISP
----------------
In order to use the USB port to download the FLASH(ISP), you need to
use the S3(PA13) to make CPU return to boot status. In this mode, the
on chip bootloader will run, making the ISP possible.
BatchISP
--------
Unlike other Atmel parts, the AVR32 will not work with the FLIP GUI
program. Instead, you must use the command-line loader call BatchISP.
If need to download FLIP from the atmel.com website, install the USB
driver in the FLIP usb directory. Then in the bin directory where
you installed FLIP, you will also find batchisp.exe.
NOTE: The AVR32DEV1 setenv.sh files will add the path to the BatchISP
bin directory to the Cygwin PATH variable. If you use a different
version of FLIP or if you install FLIP in a different location, you
will need to modify the setenv.sh files.
Notes from "AVR32 UC3 USB DFU Bootloader" (doc7745.pdf)
"To launch BatchISP, open a command prompt. Windows or Cygwin command
prompt can be used provided that the bin folder of the FLIP installation
directory is in the PATH (Windows or Cygwins) environment variable.
When running BatchISP on AT32UC3xxxxx, the target part has to be specified
with -device at32uc3xxxxx and the communication port with -hardware usb.
Commands can then be placed after -operation. These commands are executed
in order. BatchISP options can be placed in a text file invoked using
-cmdfile rather than on the command line.
"BatchISP works with an internal ISP buffer per target memory. These ISP
buffers can be filled from several sources. All target operations (program,
verify, read) are performed using these buffers."
The following BatchISP command line will erase FLASH, write the nuttx binary
into FLASH, and reset the AVR32. This command line is available in the
script config/avr32dev1/tools/doisp.sh:
batchisp -device at32uc3b0256 -hardware usb -operation erase f memory flash \
blankcheck loadbuffer nuttx.elf program verify start reset 0
"BatchISP main commands available on AT32UC3xxxxx are:
- ASSERT { PASS | FAIL } changes the displayed results of the following
operations according to the expected behavior.
- ONFAIL { ASK | ABORT | RETRY | IGNORE } changes the interactive behavior
of BatchISP in case of failure.
- WAIT <Nsec> inserts a pause between two ISP operations.
- ECHO <comment> displays a message.
- ERASE F erases internal flash contents, except the bootloader.
- MEMORY { FLASH | SECURITY | CONFIGURATION | BOOTLOADER | SIGNATURE | USER }
selects a target memory on which to apply the following operations.
- ADDRANGE <addrMin> <addrMax> selects in the current target memory an
address range on which to apply the following operations.
- BLANKCHECK checks that the selected address range is erased.
- FILLBUFFER <data> fills the ISP buffer with a byte value.
- LOADBUFFER { <in_elffile> | <in_hexfile> } loads the ISP buffer from an
input file.
- PROGRAM programs the selected address range with the ISP buffer.
- VERIFY verifies that the selected address range has the same contents
as the ISP buffer.
- READ reads the selected address range to the ISP buffer.
- SAVEBUFFER <out_hexfile> { HEX386 | HEX86 } saves the ISP buffer to an
output file.
- START { RESET | NORESET } 0 starts the execution of the programmed
application with an optional hardware reset of the target.
"The AT32UC3xxxxx memories made available by BatchISP are:
- FLASH: This memory is the internal flash array of the target, including the
bootloader protected area. E.g. on AT32UC3A0512 (512-kB internal flash),
addresses from 0 to 0x7FFFF can be accessed in this memory.
- SECURITY: This memory contains only one byte. The least significant bit
of this byte reflects the value of the target Security bit which can only
be set to 1. Once set, the only accepted commands will be ERASE and START.
After an ERASE command, all commands are accepted until the end of the
non-volatile ISP session, even if the Security bit is set.
- CONFIGURATION: This memory contains one byte per target general-purpose
fuse bit. The least significant bit of each byte reflects the value of
the corresponding GP fuse bit.
- BOOTLOADER: This memory contains three bytes concerning the ISP: the ISP
version in BCD format without the major version number (always 1), the
ISP ID0 and the ISP ID1.
- SIGNATURE: This memory contains four bytes concerning the part: the product
manufacturer ID, the product family ID, the product ID and the product
revision.
- USER: This memory is the internal flash User page of the target, with
addresses from 0 to 0x1FF.
"For further details about BatchISP commands, launch batchisp -h or see the
help files installed with FLIP ..."
Reset
^^^^^
I don't trust the reset button -- if you reset and something weird happens,
try a full power cycle.
Make Tip
^^^^^^^^
Because this build uses a native Windows toolchain and the native Windows
tools do not understand Cygwin's symbolic links, the NuttX make system does
something weird: It copies the configuration directories instead of linking
to them (it could, perhaps, use the NTFS 'mklink' command, but it doesn't).
A consequence of this is that you can easily get confused when you edit
a file in one of the "linked" directories, re-build NuttX, and then not see your
changes when you run the program. That is because build is still using the
version of the file in the copied directory, not your modified file! To work
around this annoying behavior, do the following when you re-build:
make clean_context all <-- Remove and re-copy all of the directories, then make all
doisp.sh <-- Load the code onto the board.
AVR32DEV1 Configuration Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
be set to:
CONFIG_ARCH=avr
CONFIG_ARCH_family - For use in C code:
CONFIG_ARCH_AVR=y
CONFIG_ARCH_architecture - For use in C code:
CONFIG_ARCH_FAMILY_AVR32=y
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
CONFIG_ARCH_CHIP=at32uc3
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
chip:
CONFIG_ARCH_CHIP_AT32UC3B0256
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_BOARD=avr32dev1 (for the AV32DEV1 board)
CONFIG_ARCH_BOARD_name - For use in C code
CONFIG_ARCH_BOARD_AVR32DEV1
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
of delay loops
CONFIG_ENDIAN_BIG - define if big endian (default is little
endian)
CONFIG_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
CONFIG_RAM_SIZE=0x00010000 (64Kb)
CONFIG_RAM_START - The start address of installed DRAM
CONFIG_RAM_START=0x20000000
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
have LEDs
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
stack. If defined, this symbol is the size of the interrupt
stack in bytes. If not defined, the user task stacks will be
used during interrupt handling.
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
cause a 100 second delay during boot-up. This 100 second delay
serves no purpose other than it allows you to calibratre
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
the delay actually is 100 seconds.
Individual subsystems can be enabled:
CONFIG_AVR32_GPIOIRQ - GPIO interrupt support
CONFIG_AVR32_GPIOIRQSETA - Set of GPIOs on PORTA that support interrupts
CONFIG_AVR32_GPIOIRQSETB - Set of GPIOs on PORTB that support interrupts
CONFIG_AVR32_USARTn - Enable support for USARTn
CONFIG_AVR32_USARTn_RS232 - Configure USARTn as an RS232 interface.
CONFIG_AVR32_USARTn_SPI - Configure USARTn as an SPI interface.
CONFIG_AVR32_USARTn_RS485 - Configure USARTn as an RS485 interface.
CONFIG_AVR32_USARTn_MAN - Configure USARTn as an Manchester interface.
CONFIG_AVR32_USARTn_MODEM - Configure USARTn as an Modem interface.
CONFIG_AVR32_USARTn_IRDA - Configure USARTn as an IRDA interface.
CONFIG_AVR32_USARTn_ISO786 - Configure USARTn as an ISO786 interface.
AT32UC3B0256 specific device driver settings
CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
console and ttys0 (default is the USART0).
CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
This specific the size of the receive buffer
CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
being sent. This specific the size of the transmit buffer
CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_USARTn_2STOP - Two stop bits
Configurations
^^^^^^^^^^^^^^
Common Configuration Notes
--------------------------
1. Each Atmel AVR32DEV configuration is maintained in a sub-directory and
can be selected as follow:
cd tools
./configure.sh avr32dev1/<subdir>
cd -
. ./setenv.sh
Where <subdir> is one of the configuration sub-directories described in
the following paragraph.
(Use configure.bat instead of configure.sh in a native Windows environment).
2. These configurations use the mconf-based configuration tool. To
change a configurations using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
see additional README.txt files in the NuttX tools repository.
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
3. By default, all configurations assume the AVR toolchain under Cygwin
with Windows. This is easily reconfigured:
CONFIG_HOST_WINDOWS=y
CONFIG_WINDOWS_CYGWIN=y
CONFIG_AVR32_AVRTOOLSW=y
Configuration Sub-Directories
-----------------------------
nsh:
Configures the NuttShell (nsh) located at examples/nsh. The
Configuration enables only the serial NSH interface.
ostest:
This configuration directory, performs a simple OS test using
examples/ostest.
NOTE: Round-robin scheduling is disabled in this test because
the RR test in examples/ostest declares data structures that
are too large for the poor little uc3 SRAM.
+204
View File
@@ -0,0 +1,204 @@
/************************************************************************************
* configs/avr32dev1/include/board.h
*
* Copyright (C) 2010-2011, 2014 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.
*
************************************************************************************/
#ifndef __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H
#define __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <nuttx/irq.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Clocking *************************************************************************/
/* Oscillator setup: RCOSC, OSC32, OSC0, OSC1. Only RCOSC, OSC0, or PLL0 can drive
* the main clock.
*/
/* The RCOSC frequency needs to be calibrated! */
#define AVR32_FRCOSC 115000 /* RCOSC frequency in Hz. 115KHz nominal */
#define AVR32_FOSC32 32768 /* OSC32 frequency in Hz */
#define AVR32_OSC32STARTUP 3 /* OSC32 startup time in RCOSC periods */
#define AVR32_FOSC0 12000000 /* OSC0 frequency in Hz */
#define AVR32_OSC0STARTUP 3 /* OSC0 startup time in RCOSC periods.
/* #define AVR32_FOSC1 12000000 OSC1 frequency: Hz.
* #define AVR32_OSC1STARTUP 3 OSC1 startup time in RCOSC periods.
*/
/* PLL setup
*
* FOSC0 MUL DIV PLL DIV2_EN CPU_CLOCK PBA_CLOCK COMMENT
* (MHz) (MHz) (MHz) (MHz)
* 12 15 1 192 1 12 12
* 12 9 3 40 1 20 20 PLL out of spec
* 12 15 1 192 1 24 12
* 12 9 1 120 1 30 15
* 12 9 3 40 0 40 20 PLL out of spec
* 12 15 1 192 1 48 12
* 12 15 1 192 1 48 24
* 12 8 1 108 1 54 27
* 12 9 1 120 1 60 15
* 12 9 1 120 1 60 30
* 12 10 1 132 1 66 16.5
*/
#define AVR32_CLOCK_PLL0_OSC0 1
#undef AVR32_CLOCK_PLL0_OSC1
#define AVR32_PLL0_MUL 15
#define AVR32_PLL0_DIV 1
#define AVR32_PLL0_DIV2 1
#define AVR32_PLL0_WBWM 0
#define AVR32_PLL0_FREQ 192000000
/* Set PLL1 @ 96 MHz from OSC0: 12MHz*(7+1)/1 = 96MHz */
#define AVR32_CLOCK_PLL1_OSC0 1
#undef AVR32_CLOCK_PLL1_OSC1
#define AVR32_PLL1_MUL 7
#define AVR32_PLL1_DIV 1
#define AVR32_PLL1_DIV2 1
#define AVR32_PLL1_WBWM 0
#define AVR32_PLL1_FREQ 96000000
/* Clock divider setup */
#define AVR32_CKSEL_CPUDIV 0
#define AVR32_CKSEL_HSBDIV 0
#define AVR32_CKSEL_PBADIV 0
#define AVR32_CKSEL_PBBDIV 0
/* GCLK_USBB */
#undef AVR32_CLOCK_USB_PLL0
#define AVR32_CLOCK_USB_PLL1 1
#undef AVR32_CLOCK_USB_OSC0
#undef AVR32_CLOCK_USB_OSC1
#define AVR32_CLOCK_USB_DIV 0
/* Main Clock settup: Select OSC0 as the main clock.
*
* - A 12Mhz crystal is provided on he board for OSC0.
* - The AVR32DEV1 board has no support for OSC1.
* - There are pads for he 32Khz OSC32, but it is not populated on the
* board.
*/
#define AVR32_CLOCK_OSC0 1
#undef AVR32_CLOCK_OSC1 /* Not supported */
#undef AVR32_CLOCK_OSC32 /* Not populated */
#undef AVR32_CLOCK_PLL0
#undef AVR32_CLOCK_PLL1
#define AVR32_CPU_CLOCK AVR32_FOSC0
#define AVR32_PBA_CLOCK AVR32_FOSC0
/* Pin muliplexing selecion *********************************************************/
#define PINMUX_USART1_RXD PINMUX_USART1_RXD_1
#define PINMUX_USART1_TXD PINMUX_USART1_TXD_1
/* LED definitions ******************************************************************/
/* The AVR32DEV1 board has 3 LEDs, two of which can be controlled through GPIO pins */
/* ON OFF */
/* LED1 LED2 LED1 LED2 */
#define LED_STARTED 0 /* OFF OFF OFF OFF */
#define LED_HEAPALLOCATE 0 /* OFF OFF OFF OFF */
#define LED_IRQSENABLED 0 /* OFF OFF OFF OFF */
#define LED_STACKCREATED 1 /* ON OFF OFF OFF */
#define LED_INIRQ 2 /* ON ON ON OFF */
#define LED_SIGNAL 2 /* ON ON ON OFF */
#define LED_ASSERTION 2 /* ON ON ON OFF */
#define LED_PANIC 2 /* ON ON ON OFF */
/* Button definitions ***************************************************************/
/* The AVR32DEV1 board has 3 BUTTONs, two of which can be sensed through GPIO pins. */
#define BUTTON1 1 /* Bit 0: Button 1 */
#define BUTTON2 2 /* Bit 1: Button 2 */
/************************************************************************************
* Public Types
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Data
************************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
/************************************************************************************
* Name: avr32_boardinitialize
*
* Description:
* All AVR32 architectures must provide the following entry point. This entry point
* is called early in the intitialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
*
************************************************************************************/
void avr32_boardinitialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H */
+107
View File
@@ -0,0 +1,107 @@
############################################################################
# configs/avr32dev1/nsh/Make.defs
#
# Copyright (C) 2010 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
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/avr/src/avr32/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.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}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
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
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
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -Os -ffunction-sections -fdata-sections -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-builtin -muse-rodata-section
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES =
ARCHNOPICFLAGS = -fno-pic
ARCHPICFLAGS = -fpic
ARCHALLCFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
ARCHALLCXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCFLAGS)
CXXFLAGS = $(ARCHNOPICFLAGS) $(ARCHALLCXXFLAGS)
CXXPICFLAGS = $(ARCHPICFLAGS) $(ARCHALLCXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(ARCHALLCFLAGS) -D__ASSEMBLY__
ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT =
LDFLAGS += -nostartfiles -nodefaultlibs
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More