mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
Add an NSH configuration for the Arduino Due; Pluse several fixes related to the Due and to the SAM3X in general
This commit is contained in:
@@ -5078,3 +5078,10 @@
|
||||
* configs/arduino-due: Complete the basic board configuration and
|
||||
integrate this into the configuration and build system. The Arduino
|
||||
Due is now ready to begin test (2013-6-17).
|
||||
* configs/arduino-due/nsh: Add an NSH configuration for the Arduino
|
||||
Due. Both the OS test and NSH configuration are now functional
|
||||
(2013-6-28).
|
||||
* configs/arduino-due/src: Add support for the "L" LED (2013-6-28).
|
||||
* arch/arm/src/sam34/sam_allocateheap.c: Clocking must be applied
|
||||
to the SMC module for the 3X and 3A family in order for the NFC
|
||||
SRAM to be functional (2013-6-28).
|
||||
|
||||
@@ -2583,8 +2583,8 @@ nsh>
|
||||
<ul>
|
||||
<p>
|
||||
<b>STATUS:</b>
|
||||
This is very much a work in progress.
|
||||
Basic NuttX is expected to be availabled in NuttX-6.29.
|
||||
As of this writing, the basic port is code complete and fully verified configurations exist for the basic NuttX OS test and for the NuttShell <a href="http://www.nuttx.org/Documentation/NuttShell.html">NSH</a>).
|
||||
The first fully functional Arduino Due port was released in NuttX-6.29.
|
||||
</p>
|
||||
</ul>
|
||||
<p>
|
||||
@@ -3100,6 +3100,7 @@ Mem: 29232 5920 23312 23312
|
||||
<b>STATUS:</b>
|
||||
As of this writing, the basic port is code complete and fully verified configurations exist for the basic NuttX OS test and for the NuttShell <a href="http://www.nuttx.org/Documentation/NuttShell.html">NSH</a>).
|
||||
The first fully functional SAM4S Xplained port was released in NuttX-6.28.
|
||||
Support for the on-board 1MB SRAM was added in NuttX-6.29.
|
||||
</p>
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
/* Internal SRAM memory region */
|
||||
|
||||
#define SAM_INTSRAM0_BASE 0x20000000 /* 0x20000000-0x2007ffff: Internal SRAM 0 */
|
||||
#define SAM_INTSRAM1_BASE 0x20080000 /* 0x20080000-0x200fffff: Internal SRAM 0 */
|
||||
#define SAM_INTSRAM1_BASE 0x20080000 /* 0x20080000-0x200fffff: Internal SRAM 1 */
|
||||
#define SAM_NFCSRAM_BASE 0x20100000 /* 0x20100000-0x2017ffff: NAND FLASH controller (SRAM) */
|
||||
#define SAM_UOTGHSRAM_BASE 0x20180000 /* 0x20100000-0x201fffff: UOTGHS controller (DMA) */
|
||||
/* 0x20200000-0x201fffff: Undefined */
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
#include "chip.h"
|
||||
#include "sam_mpuinit.h"
|
||||
#include "sam_periphclks.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
@@ -317,6 +318,15 @@ void up_addregion(void)
|
||||
#endif /* HAVE_SRAM1_REGION */
|
||||
|
||||
#ifdef HAVE_NFCSRAM_REGION
|
||||
#if defined(CONFIG_ARCH_CHIP_SAM3X) || defined(CONFIG_ARCH_CHIP_SAM3A)
|
||||
/* In the 3X/3A family I note that clocking must appled to the SMC module
|
||||
* in order for the NFCS SRAM to be functional. I don't recall such an
|
||||
* issue with the 3U.
|
||||
*/
|
||||
|
||||
sam_smc_enableclk();
|
||||
#endif
|
||||
|
||||
/* Allow user access to the heap memory */
|
||||
|
||||
sam_mpu_uheap(SAM_NFCSRAM_BASE, SAM34_NFCSRAM_SIZE);
|
||||
|
||||
@@ -313,14 +313,17 @@ Buttons and LEDs
|
||||
|
||||
LEDs
|
||||
----
|
||||
There are two user-controllable LEDs on board the Arduino Due board:
|
||||
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
|
||||
|
||||
Both are pulled high and can be illuminated by driving the corresponding
|
||||
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
|
||||
@@ -328,23 +331,24 @@ Buttons and LEDs
|
||||
include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
events as follows:
|
||||
|
||||
SYMBOL Meaning LED state
|
||||
RX TX
|
||||
------------------- ----------------------- -------- --------
|
||||
LED_STARTED NuttX has been started OFF OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
LED_STACKCREATED Idle stack created ON OFF
|
||||
LED_INIRQ In an interrupt No change
|
||||
LED_SIGNAL In a signal handler No change
|
||||
LED_ASSERTION An assertion failed No change
|
||||
LED_PANIC The system has crashed OFF Blinking
|
||||
LED_IDLE MCU is is sleep mode Not used
|
||||
|
||||
Thus if RX is statically on, NuttX has successfully booted and is,
|
||||
apparently, running normmally. If TX is flashing at approximately
|
||||
2Hz, then a fatal error has been detected and the system has halted.
|
||||
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 interupts (and also signals and assertions). If TX is flashing
|
||||
at approximately 2Hz, then a fatal error has been detected and the system
|
||||
has halted.
|
||||
|
||||
Serial Consoles
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -141,25 +141,30 @@
|
||||
#define BOARD_FWS 4
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
/* 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
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* 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 sam_setled() */
|
||||
|
||||
#define BOARD_LED_RX 0
|
||||
#define BOARD_LED_TX 1
|
||||
#define BOARD_NLEDS 2
|
||||
#define BOARD_LED_L 0
|
||||
#define BOARD_LED_RX 1
|
||||
#define BOARD_LED_TX 2
|
||||
#define BOARD_NLEDS 3
|
||||
|
||||
/* LED bits for use with sam_setleds() */
|
||||
|
||||
#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)
|
||||
|
||||
@@ -168,22 +173,23 @@
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Val Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- --- ----------------------- -------- --------- */
|
||||
#define LED_STARTED 0 /* NuttX has been started OFF OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */
|
||||
#define LED_STACKCREATED 1 /* Idle stack created ON OFF */
|
||||
#define LED_INIRQ 2 /* In an interrupt No change */
|
||||
#define LED_SIGNAL 2 /* In a signal handler No change */
|
||||
#define LED_ASSERTION 2 /* An assertion failed No change */
|
||||
#define LED_PANIC 3 /* The system has crashed OFF Blinking */
|
||||
#undef LED_IDLE /* MCU is is sleep mode Not used */
|
||||
* 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 RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
/* 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 interupts (and also signals and assertions). If TX is flashing
|
||||
* at approximately 2Hz, then a fatal error has been detected and the system
|
||||
*/
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
############################################################################
|
||||
# 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/mknulldeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/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
|
||||
else
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
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 -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/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}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -255,9 +255,9 @@ CONFIG_RR_INTERVAL=200
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
# CONFIG_SCHED_HAVE_PARENT is not set
|
||||
# CONFIG_JULIAN_TIME is not set
|
||||
CONFIG_START_YEAR=2009
|
||||
CONFIG_START_MONTH=9
|
||||
CONFIG_START_DAY=21
|
||||
CONFIG_START_YEAR=2013
|
||||
CONFIG_START_MONTH=6
|
||||
CONFIG_START_DAY=26
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
# CONFIG_MUTEX_TYPES is not set
|
||||
# CONFIG_PRIORITY_INHERITANCE is not set
|
||||
@@ -398,7 +398,7 @@ CONFIG_DISABLE_MOUNTPOINT=y
|
||||
#
|
||||
# CONFIG_MM_MULTIHEAP is not set
|
||||
# CONFIG_MM_SMALL is not set
|
||||
CONFIG_MM_REGIONS=3
|
||||
CONFIG_MM_REGIONS=1
|
||||
# CONFIG_GRAN is not set
|
||||
|
||||
#
|
||||
|
||||
@@ -53,14 +53,17 @@
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
/* 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
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* 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
|
||||
@@ -68,24 +71,27 @@
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- ----------------------- -------- --------
|
||||
* LED_STARTED NuttX has been started OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
* LED_STACKCREATED Idle stack created ON OFF
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed No change
|
||||
* LED_PANIC The system has crashed OFF Blinking
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
* 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 RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
* 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 interupts (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 | \
|
||||
|
||||
@@ -54,14 +54,17 @@
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
/* There are two user-controllable LEDs on board the Arduino Due board:
|
||||
/* 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
|
||||
*
|
||||
* Both are pulled high and can be illuminated by driving the corresponding
|
||||
* 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
|
||||
@@ -69,22 +72,23 @@
|
||||
* include/board.h and src/sam_leds.c. The LEDs are used to encode OS-related
|
||||
* events as follows:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RX TX
|
||||
* ------------------- ----------------------- -------- --------
|
||||
* LED_STARTED NuttX has been started OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF
|
||||
* LED_STACKCREATED Idle stack created ON OFF
|
||||
* LED_INIRQ In an interrupt No change
|
||||
* LED_SIGNAL In a signal handler No change
|
||||
* LED_ASSERTION An assertion failed No change
|
||||
* LED_PANIC The system has crashed OFF Blinking
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
* 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 RX is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally. If TX is flashing at approximately
|
||||
* 2Hz, then a fatal error has been detected and the system has halted.
|
||||
* 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 interupts (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
|
||||
@@ -119,6 +123,7 @@ void up_ledinit(void)
|
||||
{
|
||||
/* Configure RX and TX LED GPIOs for output */
|
||||
|
||||
sam_configgpio(GPIO_LED_L);
|
||||
sam_configgpio(GPIO_LED_RX);
|
||||
sam_configgpio(GPIO_LED_TX);
|
||||
}
|
||||
@@ -129,29 +134,47 @@ void up_ledinit(void)
|
||||
|
||||
void up_ledon(int led)
|
||||
{
|
||||
bool rxledon = false;
|
||||
bool txledon = false;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED */
|
||||
break;
|
||||
|
||||
case 1: /* LED_STACKCREATED */
|
||||
rxledon = true;
|
||||
break;
|
||||
/* 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 2: /* LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
return;
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 3: /* LED_PANIC */
|
||||
txledon = true;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
sam_gpiowrite(GPIO_LED_RX, rxledon);
|
||||
sam_gpiowrite(GPIO_LED_TX, txledon);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -160,10 +183,37 @@ void up_ledon(int led)
|
||||
|
||||
void up_ledoff(int led)
|
||||
{
|
||||
if (led != 2)
|
||||
switch (led)
|
||||
{
|
||||
sam_gpiowrite(GPIO_LED_RX, false);
|
||||
sam_gpiowrite(GPIO_LED_TX, false);
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ void sam_ledinit(void)
|
||||
{
|
||||
/* Configure LED1-2 GPIOs for output */
|
||||
|
||||
sam_configgpio(GPIO_LED_L);
|
||||
sam_configgpio(GPIO_LED_RX);
|
||||
sam_configgpio(GPIO_LED_TX);
|
||||
}
|
||||
@@ -107,13 +108,19 @@ void sam_setled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_RX)
|
||||
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
|
||||
{
|
||||
@@ -131,6 +138,9 @@ void sam_setleds(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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user