SAM4E-EK: Add basic board support

This commit is contained in:
Gregory Nutt 2014-03-10 15:18:46 -06:00
parent d401f8399c
commit 9bc92c640d
24 changed files with 5356 additions and 2 deletions

View file

@ -564,6 +564,16 @@ config ARCH_BOARD_SAM3UEK
---help---
The port of NuttX to the Atmel SAM3U-EK development board.
config ARCH_BOARD_SAM4EEK
bool "Atmel SAM4E-EK development board"
depends on ARCH_CHIP_ATSAM4E16E
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
---help---
The port of NuttX to the Atmel SAM4E-EK development board. This
board features the SAM4E16 MCU running at up to 120MHz.
config ARCH_BOARD_SAM4L_XPLAINED
bool "Atmel SAM4L-Xplained Pro development board"
depends on ARCH_CHIP_ATSAM4LC4C
@ -949,6 +959,7 @@ config ARCH_BOARD
default "sama5d3x-ek" if ARCH_BOARD_SAMA5D3X_EK
default "samd20-xplained" if ARCH_BOARD_SAMD20_XPLAINED
default "sam3u-ek" if ARCH_BOARD_SAM3UEK
default "sam4e-ek" if ARCH_BOARD_SAM4EEK
default "sam4l-xplained" if ARCH_BOARD_SAM4L_XPLAINED
default "sam4s-xplained" if ARCH_BOARD_SAM4S_XPLAINED
default "shenzhou" if ARCH_BOARD_SHENZHOU
@ -1202,6 +1213,9 @@ endif
if ARCH_BOARD_SAM3UEK
source "configs/sam3u-ek/Kconfig"
endif
if ARCH_BOARD_SAM4EEK
source "configs/sam4e-ek/Kconfig"
endif
if ARCH_BOARD_SAM4L_XPLAINED
source "configs/sam4l-xplained/Kconfig"
endif

View file

@ -477,6 +477,10 @@ configs/samd20-xplained
configs/sam3u-ek
The port of NuttX to the Atmel SAM3U-EK development board.
configs/sam4e-ek
The port of NuttX to the Atmel SAM4E-EK development board. This board
features the SAM4E16 MCU running at up to 120MHz.
configs/sam4l-xplained
The port of NuttX to the Atmel SAM4L-Xplained development board.

View file

@ -143,8 +143,8 @@ uint8_t board_buttons(void)
{
uint8_t retval;
retval = sam_gpioread(GPIO_BUTTON1) ? 0 : GPIO_BUTTON1;
retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : GPIO_BUTTON2;
retval = sam_gpioread(GPIO_BUTTON1) ? 0 : BUTTON1;
retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : BUTTON2;
return retval;
}

19
configs/sam4e-ek/Kconfig Normal file
View file

@ -0,0 +1,19 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
if ARCH_BOARD_SAM4EEK
choice
prompt "CPU Frequency"
default SAM4EEK_96MHZ
config SAM4EEK_96MHZ
bool "96 MHz"
config SAM4EEK_120MHZ
bool "120 MHz"
endchoice # CPU Frequency
endif # ARCH_BOARD_SAM4EEK

624
configs/sam4e-ek/README.txt Normal file
View file

@ -0,0 +1,624 @@
README
^^^^^^
This README discusses issues unique to NuttX configurations for the Atmel
SAM4E-EK development. This board features the SAM4E16 MCU running at 96
or 120MHz.
Contents
^^^^^^^^
- Development Environment
- GNU Toolchain Options
- IDEs
- NuttX EABI "buildroot" Toolchain
- NuttX OABI "buildroot" Toolchain
- NXFLAT Toolchain
- AtmelStudio6.1
- LEDs
- Serial Console
- SAM4E-EK-specific Configuration Options
- Configurations
Development Environment
^^^^^^^^^^^^^^^^^^^^^^^
Either Linux 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 Toolchain Options
^^^^^^^^^^^^^^^^^^^^^
The NuttX make system can be configured to support the various different
toolchain options. All testing has been conducted using the NuttX buildroot
toolchain. To use alternative toolchain, you simply need to add change of
the following configuration options to your .config (or defconfig) file:
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y : CodeSourcery under Linux
CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC=y : Atollic toolchain for Windos
CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM=y : devkitARM under Windows
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y : Generic GCC ARM EABI toolchain for Linux
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : Generic GCC ARM EABI toolchain for Windows
You may also have to modify the PATH in the setenv.h file if your
make cannot find the tools.
NOTE about Windows native toolchains
------------------------------------
There are basically three kinds of GCC toolchains that can be used:
1. A Linux native toolchain in a Linux environment,
2. The buildroot Cygwin tool chain built in the Cygwin environment,
3. A Windows native toolchain.
There are several limitations to using a Windows based toolchain (#3) in a
Cygwin environment. The three biggest are:
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
performed automatically in the Cygwin makefiles using the 'cygpath'
utility but you might easily find some new path problems. If so, check
out 'cygpath -w'
2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic
links are used in Nuttx (e.g., include/arch). The make system works
around these problems for the Windows tools by copying directories
instead of linking them. But this can also cause some confusion for
you: For example, you may edit a file in a "linked" directory and find
that your changes had no effect. That is because you are building the
copy of the file in the "fake" symbolic directory. If you use a
Windows toolchain, you should get in the habit of making like this:
make clean_context all
An alias in your .bashrc file might make that less painful.
3. Dependencies are not made when using Windows versions of the GCC. This
is because the dependencies are generated using Windows paths which do
not work with the Cygwin make.
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
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 (There is a simple RIDE project
in the RIDE subdirectory).
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/arm/src/sam34,
arch/arm/src/common, arch/arm/src/armv7-m, 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/arm/src/sam34/sam_vectors.S. You may need to build NuttX
one time from the Cygwin command line in order to obtain the pre-built
startup object needed by RIDE.
NuttX EABI "buildroot" Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A GNU GCC-based toolchain is assumed. The files */setenv.sh should
be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
different from the default in your PATH variable).
If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
SourceForge download site (https://sourceforge.net/projects/nuttx/files/buildroot/).
This GNU toolchain builds and executes in the Linux or Cygwin environment.
1. You must have already configured Nuttx in <some-dir>/nuttx.
cd tools
./configure.sh sam4e-ek/<sub-dir>
2. Download the latest buildroot package into <some-dir>
3. unpack the buildroot tarball. The resulting directory may
have versioning information on it like buildroot-x.y.z. If so,
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
4. cd <some-dir>/buildroot
5. cp configs/cortexm3-eabi-defconfig-4.6.3 .config
6. make oldconfig
7. make
8. Edit setenv.h, if necessary, so that the PATH variable includes
the path to the newly built binaries.
See the file configs/README.txt in the buildroot source tree. That has more
details PLUS some special instructions that you will need to follow if you are
building a Cortex-M3 toolchain for Cygwin under Windows.
NOTE: Unfortunately, the 4.6.3 EABI toolchain is not compatible with the
the NXFLAT tools. See the top-level TODO file (under "Binary loaders") for
more information about this problem. If you plan to use NXFLAT, please do not
use the GCC 4.6.3 EABI toochain; instead use the GCC 4.3.3 OABI toolchain.
See instructions below.
NuttX OABI "buildroot" Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The older, OABI buildroot toolchain is also available. To use the OABI
toolchain:
1. When building the buildroot toolchain, either (1) modify the cortexm3-eabi-defconfig-4.6.3
configuration to use EABI (using 'make menuconfig'), or (2) use an exising OABI
configuration such as cortexm3-defconfig-4.3.3
2. Modify the Make.defs file to use the OABI conventions:
+CROSSDEV = arm-nuttx-elf-
+ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
-CROSSDEV = arm-nuttx-eabi-
-ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
-NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
NXFLAT Toolchain
^^^^^^^^^^^^^^^^
If you are *not* using the NuttX buildroot toolchain and you want to use
the NXFLAT tools, then you will still have to build a portion of the buildroot
tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
be downloaded from the NuttX SourceForge download site
(https://sourceforge.net/projects/nuttx/files/).
This GNU toolchain builds and executes in the Linux or Cygwin environment.
1. You must have already configured Nuttx in <some-dir>/nuttx.
cd tools
./configure.sh sam4e-ek/<sub-dir>
2. Download the latest buildroot package into <some-dir>
3. unpack the buildroot tarball. The resulting directory may
have versioning information on it like buildroot-x.y.z. If so,
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
4. cd <some-dir>/buildroot
5. cp configs/cortexm3-defconfig-nxflat .config
6. make oldconfig
7. make
8. Edit setenv.h, if necessary, so that the PATH variable includes
the path to the newly builtNXFLAT binaries.
AtmelStudio6.1
^^^^^^^^^^^^^^
You can use AtmelStudio6.1 to load and debug code.
- To load code:
Tools -> Device Programming
Configure the debugger and chip and you are in business.
- To Debug Code:
File -> Open -> Open Object File for Debugging
Select the project name, the full path to the NuttX object (called
just nuttx with no extension), and chip. Take the time to resolve
all of the source file linkages or else you will not have source
level debug!
LEDs
^^^^
The SAM4E-EK board has three, user-controllable LEDs labelled D2 (blue),
D3 (amber), and D4 (green) on the board. Usage of these LEDs is defined
in include/board.h and src/up_leds.c. They are encoded as follows:
SYMBOL Meaning D3* D2 D4
------------------- ----------------------- ------- ------- -------
LED_STARTED NuttX has been started OFF OFF OFF
LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
LED_IRQSENABLED Interrupts enabled OFF ON OFF
LED_STACKCREATED Idle stack created OFF ON ON
LED_INIRQ In an interrupt** N/C FLASH N/C
LED_SIGNAL In a signal handler*** N/C N/C FLASH
LED_ASSERTION An assertion failed FLASH N/C N/C
LED_PANIC The system has crashed FLASH N/C N/C
* If D2 and D4 are statically on, then NuttX probably failed to boot
and these LEDs will give you some indication of where the failure was
** The normal state is D3=OFF, D4=ON and D2 faintly glowing. This faint
glow is because of timer interrupts that result in the LED being
illuminated on a small proportion of the time.
*** D4 may also flicker normally if signals are processed.
Serial Console
^^^^^^^^^^^^^^
By default, all of these configurations use UART0 for the NuttX serial
console. UART0 corresponds to the DB-9 connector labelled "UART". This
is a male connector and will require a female-to-female, NUL modem cable
to connect to a PC.
An alternate is USART1 which connects to the other DB-9 connector labeled
"USART". USART1 is not enabled by default unless specifically noted
otherwise in the configuration description. A NUL modem cable must be
used with the port as well.
NOTE: One of the USART1 pins is shared with the audio CODEC. The audio
CODEC cannot be used of USART1 is enabled.
By default serial console is configured for 115000, 8-bit, 1 stop bit, and
no parity.
SAM4E-EK-specific Configuration Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
be set to:
CONFIG_ARCH=arm
CONFIG_ARCH_family - For use in C code:
CONFIG_ARCH_ARM=y
CONFIG_ARCH_architecture - For use in C code:
CONFIG_ARCH_CORTEXM3=y
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
CONFIG_ARCH_CHIP="sam34"
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
chip:
CONFIG_ARCH_CHIP_SAM34
CONFIG_ARCH_CHIP_SAM3U
CONFIG_ARCH_CHIP_ATSAM3U4
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_BOARD=sam4e-ek (for the SAM4E-EK development board)
CONFIG_ARCH_BOARD_name - For use in C code
CONFIG_ARCH_BOARD_SAM4EEK=y
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=0x00020000 (128Kb)
CONFIG_RAM_START - The start address of installed DRAM
CONFIG_RAM_START=0x20000000
CONFIG_ARCH_IRQPRIO - The SAM3U supports interrupt prioritization
CONFIG_ARCH_IRQPRIO=n
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_SAM34_SPI0 - Serial Peripheral Interface 0 (SPI0)
CONFIG_SAM34_SPI1 - Serial Peripheral Interface 1 (SPI1)
CONFIG_SAM34_SSC - Synchronous Serial Controller (SSC)
CONFIG_SAM34_TC0 - Timer/Counter 0 (TC0)
CONFIG_SAM34_TC1 - Timer/Counter 1 (TC1)
CONFIG_SAM34_TC2 - Timer/Counter 2 (TC2)
CONFIG_SAM34_TC3 - Timer/Counter 3 (TC3)
CONFIG_SAM34_TC4 - Timer/Counter 4 (TC4)
CONFIG_SAM34_TC5 - Timer/Counter 5 (TC5)
CONFIG_SAM34_TC6 - Timer/Counter 6 (TC6)
CONFIG_SAM34_TC7 - Timer/Counter 7 (TC6)
CONFIG_SAM34_TC8 - Timer/Counter 6 (TC8)
CONFIG_SAM34_PWM - Pulse Width Modulation (PWM) Controller
CONFIG_SAM34_TWIM0 - Two-wire Master Interface 0 (TWIM0)
CONFIG_SAM34_TWIS0 - Two-wire Slave Interface 0 (TWIS0)
CONFIG_SAM34_TWIM1B - Two-wire Master Interface 1 (TWIM1)
CONFIG_SAM34_TWIS1 - Two-wire Slave Interface 1 (TWIS1)
CONFIG_SAM34_UART0 - UART 0
CONFIG_SAM34_UART1 - UART 1
CONFIG_SAM34_USART0 - USART 0
CONFIG_SAM34_USART1 - USART 1
CONFIG_SAM34_USART2 - USART 2
CONFIG_SAM34_USART3 - USART 3
CONFIG_SAM34_AFEC0 - Analog Front End 0
CONFIG_SAM34_AFEC1 - Analog Front End 1
CONFIG_SAM34_DACC - Digital-to-Analog Converter
CONFIG_SAM34_ACC - Analog Comparator
CONFIG_SAM34_EMAC - Ethernet MAC
CONFIG_SAM34_CAN0 - CAN 0
CONFIG_SAM34_CAN1 - CAN 1
CONFIG_SAM34_SMC - Static Memory Controller
CONFIG_SAM34_NAND - NAND support
CONFIG_SAM34_PDCA - Peripheral DMA controller
CONFIG_SAM34_DMAC - DMA controller
CONFIG_SAM34_UDP - USB 2.0 Full-Speed device
CONFIG_SAM34_CHIPID - Chip ID
CONFIG_SAM34_RTC - Real Time Clock
CONFIG_SAM34_RTT - Real Time Timer
CONFIG_SAM34_WDT - Watchdog Timer
CONFIG_SAM34_EIC - Interrupt controller
CONFIG_SAM34_HSMCI - High Speed Multimedia Card Interface
Some subsystems can be configured to operate in different ways. The drivers
need to know how to configure the subsystem.
CONFIG_GPIOA_IRQ
CONFIG_GPIOB_IRQ
CONFIG_GPIOC_IRQ
CONFIG_GPIOD_IRQ
CONFIG_GPIOE_IRQ
CONFIG_GPIOF_IRQ
CONFIG_GPIOG_IRQ
CONFIG_GPIOH_IRQ
CONFIG_GPIOJ_IRQ
CONFIG_GPIOK_IRQ
CONFIG_GPIOL_IRQ
CONFIG_GPIOM_IRQ
CONFIG_GPION_IRQ
CONFIG_GPIOP_IRQ
CONFIG_GPIOQ_IRQ
CONFIG_USART0_ISUART
CONFIG_USART1_ISUART
CONFIG_USART2_ISUART
CONFIG_USART3_ISUART
SAM3U specific device driver settings
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,3) or UART
m (m=4,5) for the console and ttys0 (default is the USART1).
CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
This specific the size of the receive buffer
CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
being sent. This specific the size of the transmit buffer
CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_U[S]ARTn_2STOP - Two stop bits
LCD Options. Other than the standard LCD configuration options
(see configs/README.txt), the SAM4E-EK driver also supports:
CONFIG_LCD_PORTRAIT - Present the display in the standard 240x320
"Portrait" orientation. Default: The display is rotated to
support a 320x240 "Landscape" orientation.
Configurations
^^^^^^^^^^^^^^
Information Common to All Configurations
----------------------------------------
Each SAM4E-EK configuration is maintained in a sub-directory and
can be selected as follow:
cd tools
./configure.sh sam4e-ek/<subdir>
cd -
. ./setenv.sh
Before sourcing the setenv.sh file above, you should examine it and perform
edits as necessary so that BUILDROOT_BIN is the correct path to the directory
than holds your toolchain binaries.
And then build NuttX by simply typing the following. At the conclusion of
the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
make
The <subdir> that is provided above as an argument to the tools/configure.sh
must be is one of the following.
NOTES:
1. These configurations use the mconf-based configuration tool. To
change any of these configurations using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
and misc/tools/
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
2. Unless stated otherwise, all configurations generate console
output on UART0 (J3).
3. Unless otherwise stated, the configurations are setup for
Linux (or any other POSIX environment like Cygwin under Windows):
Build Setup:
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
4. All of these configurations use the older, OABI, buildroot toolchain
(unless stated otherwise in the description of the configuration). That
toolchain selection can easily be reconfigured using 'make menuconfig'.
Here are the relevant current settings:
Build Setup:
CONFIG_HOST_LINUX=y : Linux or other pure POSIX invironment
: (including Cygwin)
System Type -> Toolchain:
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
If you want to use the Atmel GCC toolchain, for example, here are the
steps to do so:
Build Setup:
CONFIG_HOST_WINDOWS=y : Windows
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
System Type -> Toolchain:
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
Library Routines ->
CONFIG_CXX_NEWLONG=n : size_t is an unsigned int, not long
This re-configuration should be done before making NuttX or else the
subsequent 'make' will fail. If you have already attempted building
NuttX then you will have to 1) 'make distclean' to remove the old
configuration, 2) 'cd tools; ./configure.sh sam4e-ek/ksnh' to start
with a fresh configuration, and 3) perform the configuration changes
above.
Also, make sure that your PATH variable has the new path to your
Atmel tools. Try 'which arm-none-eabi-gcc' to make sure that you
are selecting the right tool. setenv.sh is available for you to
use to set or PATH variable. The path in the that file may not,
however, be correct for your installation.
See also the "NOTE about Windows native toolchains" in the section call
"GNU Toolchain Options" above.
Configuration sub-directories
-----------------------------
nsh:
Configures the NuttShell (nsh) located at examples/nsh. The
Configuration enables both the serial and telnetd NSH interfaces.
NOTES:
1. NSH built-in applications are supported. However, there are
no built-in applications built with the default configuration.
Binary Formats:
CONFIG_BUILTIN=y : Enable support for built-in programs
Applicaton Configuration:
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
2. This configuration has been used for verifying the touchscreen on
on the SAM4E-EK LCD. With these modifications, you can include the
touchscreen test program at apps/examples/touchscreen as an NSH built-in
application. You can enable the touchscreen and test by modifying the
default configuration in the following ways:
Device Drivers
CONFIG_SPI=y : Enable SPI support
CONFIG_SPI_EXCHANGE=y : The exchange() method is supported
CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device
CONFIG_INPUT=y : Enable support for input devices
CONFIG_INPUT_ADS7843E=y : Enable support for the XPT2046
CONFIG_ADS7843E_SPIDEV=2 : Use SPI CS 2 for communication
CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0
CONFIG_ADS7843E_FREQUENCY=1000000 : SPI BAUD 1MHz
CONFIG_ADS7843E_SWAPXY=y : If landscpe orientation
CONFIG_ADS7843E_THRESHX=51 : These will probably need to be tuned
CONFIG_ADS7843E_THRESHY=39
System Type -> Peripherals:
CONFIG_SAM34_SPI0=y : Enable support for SPI
System Type:
CONFIG_GPIO_IRQ=y : GPIO interrupt support
CONFIG_GPIOA_IRQ=y : Enable GPIO interrupts from port A
RTOS Features:
CONFIG_DISABLE_SIGNALS=n : Signals are required
Library Support:
CONFIG_SCHED_WORKQUEUE=y : Work queue support required
Applicaton Configuration:
CONFIG_EXAMPLES_TOUCHSCREEN=y : Enable the touchscreen built-int test
Defaults should be okay for related touchscreen settings. Touchscreen
debug output on UART0 can be enabled with:
Build Setup:
CONFIG_DEBUG=y : Enable debug features
CONFIG_DEBUG_VERBOSE=y : Enable verbose debug output
CONFIG_DEBUG_INPUT=y : Enable debug output from input devices
3. Enabling HSMCI support. The SAM3U-KE provides a an SD memory card
slot. Support for the SD slot can be enabled with the following
settings:
System Type->ATSAM3/4 Peripheral Support
CONFIG_SAM34_HSMCI=y : Enable HSMCI support
CONFIG_SAM34_DMAC=y : DMAC support is needed by HSMCI
System Type
CONFIG_SAM34_GPIO_IRQ=y : PIO interrupts needed
CONFIG_SAM34_GPIOA_IRQ=y : Card detect pin is on PIOA
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_HAVECARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
CONFIG_SDIO_DMA=y : Use SDIO DMA
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes
Library Routines
CONFIG_SCHED_WORKQUEUE=y : Driver needs work queue support
Application Configuration -> NSH Library
CONFIG_NSH_ARCHINIT=y : NSH board-initialization
STATUS:
2013-6-28: The touchscreen is functional.
2013-6-29: Hmmm... but there appear to be conditions when the
touchscreen driver locks up. Looks like some issue with
managing the interrupts.
2013-6-30: Those lock-ups appear to be due to poorly placed
debug output statements. If you do not enable debug output,
the touchscreen is rock-solid.
2013-8-10: Added the comments above above enabling HSMCI memory
card support and verified that the configuration builds without
error. However, that configuration has not yet been tested (and
is may even be incomplete).

View file

@ -0,0 +1,306 @@
/************************************************************************************
* configs/sam4e-ek/include/board.h
*
* Copyright (C) 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 __ARCH_SAM4E_EK_INCLUDE_BOARD_H
#define __ARCH_SAM4E_EK_INCLUDE_BOARD_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <stdint.h>
# ifdef CONFIG_GPIO_IRQ
# include <arch/irq.h>
# endif
#endif
/************************************************************************************
* Definitions
************************************************************************************/
/* Clocking *************************************************************************/
/* After power-on reset, the SAM4E16 device is running on a 4MHz internal RC. These
* definitions will configure clocking
*
* MAINOSC: Frequency = 12MHz (crysta)
*
* CONFIG_SAM4EEK_120MHZ
* PLLA: PLL Divider = 1, Multiplier = 20 to generate PLLACK = 240MHz
* Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 120MHz
* CPU clock: 120MHz
*
* CONFIG_SAM4EEK_196MHZ
* PLLA: PLL Divider = 1, Multiplier = 16 to generate PLLACK = 192MHz
* Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 96MHz
* CPU clock: 96MHz
*/
/* 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 = 16 or 20
*/
#ifdef CONFIG_SAM4EEK_120MHZ
# define BOARD_CKGR_PLLAR_MUL (20 << PMC_CKGR_PLLAR_MUL_SHIFT)
#else
# define BOARD_CKGR_PLLAR_MUL (16 << PMC_CKGR_PLLAR_MUL_SHIFT)
#endif
#define BOARD_CKGR_PLLAR_STMODE PMC_CKGR_PLLAR_STMODE_FAST
#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_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
#ifdef CONFIG_SAM4EEK_120MHZ
# define BOARD_PLLA_FREQUENCY (240000000) /* PLLACK: 20 * 12Mhz / 1 */
# define BOARD_MCK_FREQUENCY (120000000) /* MCK: PLLACK / 2 */
# define BOARD_CPU_FREQUENCY (120000000) /* CPU: MCK */
#else
# define BOARD_MAINOSC_FREQUENCY (12000000) /* MAINOSC: 12MHz crystal on-board */
# define BOARD_PLLA_FREQUENCY (192000000) /* PLLACK: 16 * 12Mhz / 1 */
# define BOARD_MCK_FREQUENCY (96000000) /* MCK: PLLACK / 2 */
# define BOARD_CPU_FREQUENCY (96000000) /* CPU: MCK */
#endif
/* HSMCI clocking
*
* Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK)
* divided by (2*(CLKDIV+1)).
*
* MCI_SPEED = MCK / (2*(CLKDIV+1))
* CLKDIV = MCK / MCI_SPEED / 2 - 1
*
* Where CLKDIV has a range of 0-255.
*/
#ifdef CONFIG_SAM4EEK_120MHZ
/* MCK = 120MHz, CLKDIV = 149, MCI_SPEED = 120MHz / 2 * (149+1) = 400 KHz */
# define HSMCI_INIT_CLKDIV (149 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 120MHz, CLKDIV = 2, MCI_SPEED = 120MHz / 2 * (2+1) = 20 MHz */
# define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 120MHz, CLKDIV = 2, MCI_SPEED = 120MHz / 2 * (2+1) = 20 MHz */
# define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
#else
/* MCK = 96MHz, CLKDIV = 119, MCI_SPEED = 96MHz / 2 * (119+1) = 400 KHz */
# define HSMCI_INIT_CLKDIV (119 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 96MHz, CLKDIV = 3, MCI_SPEED = 96MHz / 2 * (3+1) = 12 MHz */
# define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT)
/* MCK = 96MHz, CLKDIV = 1, MCI_SPEED = 96MHz / 2 * (1+1) = 24 MHz */
# define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT)
#endif
#define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV
/* FLASH wait states.
*
* SAM4E-EK documetion says:
* VDDCORE: "The voltage ranges from 1.08V to 1.32V."
* VDDIO: Looks like it is at 3.3V
*
* FWS Max frequency
* (1) (2) (3) (4)
* --- ------- ------- ------- -------
* 0 17 MHz 20 MHz 17 MHz 21 MHz
* 1 34 MHz 41 MHz 35 MHz 43 MHz
* 2 51 MHz 62 MHz 53 MHz 64 MHz
* 3 69 MHz 83 MHz 71 MHz 86 MHz
* 4 86 MHz 96 MHz 88 MHz 107 MHz
* 5 100 MHz 104 MHz 106 MHz 129 MHz
* 6 124 MHz
* (1) VDDCORE set at 1.08V and VDDIO 1.62V to 3.6V @105C
* (2) VDDCORE set at 1.08V and VDDIO 2.7V to 3.6V @105C
* (3) VDDCORE set at 1.20V and VDDIO 1.62V to 3.6V @ 105C
* (4) VDDCORE set at 1.20V and VDDIO 2.7V to 3.6V @ 105C
*/
#ifdef CONFIG_SAM4EEK_120MHZ
# define BOARD_FWS 5
#else
# define BOARD_FWS 4
#endif
/* LED definitions ******************************************************************/
/* The SAM4E-EK board has three, user-controllable LEDs labelled D2 (blue),
* D3 (amber), and D4 (green) on the board. Usage of these LEDs is defined
* in include/board.h and src/up_leds.c. They are encoded as follows:
*
* SYMBOL Meaning D3* D2 D4
* ------------------- ----------------------- ------- ------- -------
* LED_STARTED NuttX has been started OFF OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
* LED_IRQSENABLED Interrupts enabled OFF ON OFF
* LED_STACKCREATED Idle stack created OFF ON ON
* LED_INIRQ In an interrupt** N/C FLASH N/C
* LED_SIGNAL In a signal handler*** N/C N/C FLASH
* LED_ASSERTION An assertion failed FLASH N/C N/C
* LED_PANIC The system has crashed FLASH N/C N/C
*
* * If D2 and D4 are statically on, then NuttX probably failed to boot
* and these LEDs will give you some indication of where the failure was
* ** The normal state is D3=OFF, D4=ON and D2 faintly glowing. This faint
* glow is because of timer interrupts that result in the LED being
* illuminated on a small proportion of the time.
* *** D4 may also flicker normally if signals are processed.
*/
#define LED_STARTED 0 /* LED0=OFF LED1=OFF LED2=OFF */
#define LED_HEAPALLOCATE 1 /* LED0=OFF LED1=OFF LED2=ON */
#define LED_IRQSENABLED 2 /* LED0=OFF LED1=ON LED2=OFF */
#define LED_STACKCREATED 3 /* LED0=OFF LED1=ON LED2=ON */
#define LED_INIRQ 4 /* LED0=XXX LED1=TOG LED2=XXX */
#define LED_SIGNAL 5 /* LED0=XXX LED1=XXX LED2=TOG */
#define LED_ASSERTION 6 /* LED0=TOG LED1=XXX LED2=XXX */
#define LED_PANIC 7 /* LED0=TOG LED1=XXX LED2=XXX */
/* LED index values for use with sam_setled() */
#define BOARD_LED_D3 0
#define BOARD_LED_D2 1
#define BOARD_LED_D4 2
#define BOARD_NLEDS 3
/* LED bits for use with sam_setleds() */
#define BOARD_LED_D3_BIT (1 << BOARD_LED_D3)
#define BOARD_LED_D2_BIT (1 << BOARD_LED_D2)
#define BOARD_LED_D4_BIT (1 << BOARD_LED_D4)
/* Button definitions ***************************************************************/
/* Four buttons for software inputs:
*
* PA1 BUTTON_SCROLL-UP Grounded
* PA2 BUTTON_SCROLL-DOWN Grounded
* PA19 BUTTON_WAKU Grounded
* PA20 BUTTON_TAMP Grounded
*/
#define BUTTON_SCROLLUP 1 /* Bit 0: Scroll-up button */
#define BUTTON_SCROLLDOWN 2 /* Bit 1: Scroll-down button */
#define BUTTON_WAKU 4 /* Bit 2: Waku button */
#define BUTTON_TAMP 8 /* Bit 3: Tamp button */
/************************************************************************************
* 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 SAM3U 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 sam_boardinitialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
/************************************************************************************
* Name: sam_ledinit, sam_setled, and sam_setleds
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board LEDs. If
* CONFIG_ARCH_LEDS is not defined, then the following interfacesare available to
* control the LEDs from user applications.
*
************************************************************************************/
#ifndef CONFIG_ARCH_LEDS
void sam_ledinit(void);
void sam_setled(int led, bool ledon);
void sam_setleds(uint8_t ledset);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_SAM4E_EK_INCLUDE_BOARD_H */

View file

@ -0,0 +1,110 @@
############################################################################
# configs/sam4e-ek/nsh/Make.defs
#
# Copyright (C) 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.
#
############################################################################
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/flash.ld}"
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/flash.ld
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 -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-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 =

View file

@ -0,0 +1,853 @@
#
# Automatically generated file; DO NOT EDIT.
# Nuttx/ Configuration
#
#
# Build Setup
#
# CONFIG_EXPERIMENTAL is not set
# CONFIG_DEFAULT_SMALL is not set
CONFIG_HOST_LINUX=y
# CONFIG_HOST_OSX is not set
# CONFIG_HOST_WINDOWS is not set
# CONFIG_HOST_OTHER is not set
#
# Build Configuration
#
# CONFIG_APPS_DIR="../apps"
# CONFIG_BUILD_2PASS is not set
#
# Binary Output Formats
#
# CONFIG_RRLOAD_BINARY is not set
# CONFIG_INTELHEX_BINARY is not set
# CONFIG_MOTOROLA_SREC is not set
CONFIG_RAW_BINARY=y
#
# Customize Header Files
#
# CONFIG_ARCH_STDINT_H is not set
# CONFIG_ARCH_STDBOOL_H is not set
# CONFIG_ARCH_MATH_H is not set
# CONFIG_ARCH_FLOAT_H is not set
# CONFIG_ARCH_STDARG_H is not set
#
# Debug Options
#
# CONFIG_DEBUG is not set
CONFIG_ARCH_HAVE_STACKCHECK=y
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
# CONFIG_DEBUG_SYMBOLS is not set
CONFIG_ARCH_HAVE_CUSTOMOPT=y
# CONFIG_DEBUG_NOOPT is not set
# CONFIG_DEBUG_CUSTOMOPT is not set
CONFIG_DEBUG_FULLOPT=y
#
# System Type
#
# CONFIG_ARCH_8051 is not set
CONFIG_ARCH_ARM=y
# CONFIG_ARCH_AVR is not set
# CONFIG_ARCH_HC is not set
# CONFIG_ARCH_MIPS is not set
# CONFIG_ARCH_RGMP is not set
# CONFIG_ARCH_SH is not set
# CONFIG_ARCH_SIM is not set
# CONFIG_ARCH_X86 is not set
# CONFIG_ARCH_Z16 is not set
# CONFIG_ARCH_Z80 is not set
CONFIG_ARCH="arm"
#
# ARM Options
#
# CONFIG_ARCH_CHIP_A1X is not set
# CONFIG_ARCH_CHIP_C5471 is not set
# CONFIG_ARCH_CHIP_CALYPSO is not set
# CONFIG_ARCH_CHIP_DM320 is not set
# CONFIG_ARCH_CHIP_IMX is not set
# CONFIG_ARCH_CHIP_KINETIS is not set
# CONFIG_ARCH_CHIP_KL is not set
# CONFIG_ARCH_CHIP_LM is not set
# CONFIG_ARCH_CHIP_TIVA is not set
# CONFIG_ARCH_CHIP_LPC17XX is not set
# CONFIG_ARCH_CHIP_LPC214X is not set
# CONFIG_ARCH_CHIP_LPC2378 is not set
# CONFIG_ARCH_CHIP_LPC31XX is not set
# CONFIG_ARCH_CHIP_LPC43XX is not set
# CONFIG_ARCH_CHIP_NUC1XX is not set
# CONFIG_ARCH_CHIP_SAMA5 is not set
# CONFIG_ARCH_CHIP_SAMD is not set
CONFIG_ARCH_CHIP_SAM34=y
# CONFIG_ARCH_CHIP_STM32 is not set
# CONFIG_ARCH_CHIP_STR71X is not set
# CONFIG_ARCH_ARM7TDMI is not set
# CONFIG_ARCH_ARM926EJS is not set
# CONFIG_ARCH_ARM920T is not set
# CONFIG_ARCH_CORTEXM0 is not set
# CONFIG_ARCH_CORTEXM3 is not set
CONFIG_ARCH_CORTEXM4=y
# CONFIG_ARCH_CORTEXA5 is not set
# CONFIG_ARCH_CORTEXA8 is not set
CONFIG_ARCH_FAMILY="armv7-m"
CONFIG_ARCH_CHIP="sam34"
# CONFIG_ARMV7M_USEBASEPRI is not set
# CONFIG_ARCH_HAVE_FPU is not set
CONFIG_ARCH_HAVE_MPU=y
# CONFIG_ARMV7M_MPU is not set
#
# ARMV7M Configuration Options
#
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set
# CONFIG_ARMV7M_OABI_TOOLCHAIN is not set
# CONFIG_GPIO_IRQ is not set
CONFIG_ARCH_HAVE_EXTNAND=y
CONFIG_ARCH_HAVE_EXTNOR=y
CONFIG_ARCH_HAVE_EXTSRAM0=y
CONFIG_ARCH_HAVE_EXTSRAM1=y
#
# AT91SAM3/4 Configuration Options
#
# CONFIG_ARCH_CHIP_ATSAM3U4E is not set
# CONFIG_ARCH_CHIP_ATSAM3U4C is not set
# CONFIG_ARCH_CHIP_ATSAM3U2E is not set
# CONFIG_ARCH_CHIP_ATSAM3U2C is not set
# CONFIG_ARCH_CHIP_ATSAM3U1E is not set
# CONFIG_ARCH_CHIP_ATSAM3U1C is not set
# CONFIG_ARCH_CHIP_ATSAM3X8E is not set
# CONFIG_ARCH_CHIP_ATSAM3X8C is not set
# CONFIG_ARCH_CHIP_ATSAM3X4E is not set
# CONFIG_ARCH_CHIP_ATSAM3X4C is not set
# CONFIG_ARCH_CHIP_ATSAM3A8C is not set
# CONFIG_ARCH_CHIP_ATSAM3A4C is not set
# CONFIG_ARCH_CHIP_ATSAM4LC2C is not set
# CONFIG_ARCH_CHIP_ATSAM4LC2B is not set
# CONFIG_ARCH_CHIP_ATSAM4LC2A is not set
# CONFIG_ARCH_CHIP_ATSAM4LC4C is not set
# CONFIG_ARCH_CHIP_ATSAM4LC4B is not set
# CONFIG_ARCH_CHIP_ATSAM4LC4A is not set
# CONFIG_ARCH_CHIP_ATSAM4LS2C is not set
# CONFIG_ARCH_CHIP_ATSAM4LS2B is not set
# CONFIG_ARCH_CHIP_ATSAM4LS2A is not set
# CONFIG_ARCH_CHIP_ATSAM4LS4C is not set
# CONFIG_ARCH_CHIP_ATSAM4LS4B is not set
# CONFIG_ARCH_CHIP_ATSAM4LS4A is not set
# CONFIG_ARCH_CHIP_ATSAM4SD32C is not set
# CONFIG_ARCH_CHIP_ATSAM4SD32B is not set
# CONFIG_ARCH_CHIP_ATSAM4SD16C is not set
# CONFIG_ARCH_CHIP_ATSAM4SD16B is not set
# CONFIG_ARCH_CHIP_ATSAM4SA16C is not set
# CONFIG_ARCH_CHIP_ATSAM4SA16B is not set
# CONFIG_ARCH_CHIP_ATSAM4S16C is not set
# CONFIG_ARCH_CHIP_ATSAM4S16B is not set
# CONFIG_ARCH_CHIP_ATSAM4S8C is not set
# CONFIG_ARCH_CHIP_ATSAM4S8B is not set
CONFIG_ARCH_CHIP_ATSAM4E16E=y
# CONFIG_ARCH_CHIP_ATSAM4E16C is not set
# CONFIG_ARCH_CHIP_ATSAM4E8E is not set
# CONFIG_ARCH_CHIP_ATSAM4E8C is not set
# CONFIG_ARCH_CHIP_SAM3U is not set
# CONFIG_ARCH_CHIP_SAM3X is not set
# CONFIG_ARCH_CHIP_SAM3A is not set
# CONFIG_ARCH_CHIP_SAM4L is not set
CONFIG_ARCH_CHIP_SAM4E=y
# CONFIG_ARCH_CHIP_SAM4S is not set
#
# AT91SAM3/4 Peripheral Support
#
# CONFIG_SAM34_SPI0 is not set
# CONFIG_SAM34_TC0 is not set
# CONFIG_SAM34_TC1 is not set
# CONFIG_SAM34_TC2 is not set
# CONFIG_SAM34_TC3 is not set
# CONFIG_SAM34_TC4 is not set
# CONFIG_SAM34_TC5 is not set
# CONFIG_SAM34_TC6 is not set
# CONFIG_SAM34_TC7 is not set
# CONFIG_SAM34_TC8 is not set
# CONFIG_SAM34_PWM is not set
# CONFIG_SAM34_TWIM0 is not set
# CONFIG_SAM34_TWIS0 is not set
# CONFIG_SAM34_TWIM1 is not set
# CONFIG_SAM34_TWIS1 is not set
CONFIG_SAM34_UART0=y
# CONFIG_SAM34_UART1 is not set
# CONFIG_SAM34_USART0 is not set
CONFIG_SAM34_USART1=y
# CONFIG_SAM34_AFEC0 is not set
# CONFIG_SAM34_AFEC1 is not set
# CONFIG_SAM34_DACC is not set
# CONFIG_SAM34_ACC is not set
# CONFIG_SAM34_AES is not set
# CONFIG_SAM34_EMAC is not set
# CONFIG_SAM34_CAN0 is not set
# CONFIG_SAM34_CAN1 is not set
# CONFIG_SAM34_SMC is not set
# CONFIG_SAM34_NAND is not set
# CONFIG_SAM34_PDCA is not set
# CONFIG_SAM34_DMAC is not set
# CONFIG_SAM34_UDP is not set
# CONFIG_SAM34_CHIPID is not set
# CONFIG_SAM34_RTC is not set
# CONFIG_SAM34_RTT is not set
# CONFIG_SAM34_WDT is not set
# CONFIG_SAM34_EIC is not set
# CONFIG_SAM34_HSMCI is not set
#
# External Memory Configuration
#
# CONFIG_SAM34_EXTNAND is not set
# CONFIG_SAM34_EXTNOR is not set
# CONFIG_SAM34_EXTSRAM0 is not set
# CONFIG_SAM34_EXTSRAM1 is not set
#
# AT91SAM3/4 GPIO Interrupt Configuration
#
#
# Architecture Options
#
# CONFIG_ARCH_NOINTC is not set
# CONFIG_ARCH_VECNOTIRQ is not set
# CONFIG_ARCH_DMA is not set
CONFIG_ARCH_HAVE_IRQPRIO=y
# CONFIG_CUSTOM_STACK is not set
# CONFIG_ADDRENV is not set
CONFIG_ARCH_HAVE_VFORK=y
# CONFIG_ARCH_HAVE_MMU is not set
# CONFIG_ARCH_NAND_HWECC is not set
# CONFIG_ARCH_IRQPRIO is not set
CONFIG_ARCH_STACKDUMP=y
# CONFIG_ENDIAN_BIG is not set
# CONFIG_ARCH_IDLE_CUSTOM is not set
CONFIG_ARCH_HAVE_RAMFUNCS=y
# CONFIG_ARCH_RAMFUNCS is not set
CONFIG_ARCH_HAVE_RAMVECTORS=y
# CONFIG_ARCH_RAMVECTORS is not set
#
# Board Settings
#
CONFIG_BOARD_LOOPSPERMSEC=8720
# CONFIG_ARCH_CALIBRATION is not set
#
# Interrupt options
#
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
CONFIG_ARCH_INTERRUPTSTACK=0
CONFIG_ARCH_HAVE_HIPRI_INTERRUPT=y
# CONFIG_ARCH_HIPRI_INTERRUPT is not set
#
# Boot options
#
# CONFIG_BOOT_RUNFROMEXTSRAM is not set
CONFIG_BOOT_RUNFROMFLASH=y
# CONFIG_BOOT_RUNFROMISRAM is not set
# CONFIG_BOOT_RUNFROMSDRAM is not set
# CONFIG_BOOT_COPYTORAM is not set
#
# Boot Memory Configuration
#
CONFIG_RAM_START=0x20000000
CONFIG_RAM_SIZE=131072
# CONFIG_ARCH_HAVE_SDRAM is not set
#
# Board Selection
#
CONFIG_ARCH_BOARD_SAM4EEK=y
# CONFIG_ARCH_BOARD_CUSTOM is not set
CONFIG_ARCH_BOARD="sam4e-ek"
#
# Common Board Options
#
CONFIG_ARCH_HAVE_LEDS=y
CONFIG_ARCH_LEDS=y
CONFIG_ARCH_HAVE_BUTTONS=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_HAVE_IRQBUTTONS=y
# CONFIG_ARCH_IRQBUTTONS is not set
CONFIG_NSH_MMCSDMINOR=0
#
# Board-Specific Options
#
CONFIG_SAM4EEK_96MHZ=y
# CONFIG_SAM4EEK_120MHZ is not set
#
# RTOS Features
#
# CONFIG_BOARD_INITIALIZE is not set
CONFIG_MSEC_PER_TICK=10
# CONFIG_SYSTEM_TIME64 is not set
CONFIG_RR_INTERVAL=200
# CONFIG_SCHED_CPULOAD is not set
# CONFIG_SCHED_INSTRUMENTATION is not set
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_DEV_CONSOLE=y
# CONFIG_MUTEX_TYPES is not set
# CONFIG_PRIORITY_INHERITANCE is not set
# CONFIG_FDCLONE_DISABLE is not set
# CONFIG_FDCLONE_STDIO is not set
CONFIG_SDCLONE_DISABLE=y
CONFIG_SCHED_WAITPID=y
# CONFIG_SCHED_STARTHOOK is not set
# CONFIG_SCHED_ATEXIT is not set
# CONFIG_SCHED_ONEXIT is not set
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_DISABLE_OS_API=y
# CONFIG_DISABLE_CLOCK is not set
# CONFIG_DISABLE_POSIX_TIMERS is not set
# CONFIG_DISABLE_PTHREAD is not set
# CONFIG_DISABLE_SIGNALS is not set
# CONFIG_DISABLE_MQUEUE is not set
# CONFIG_DISABLE_ENVIRON is not set
#
# Signal Numbers
#
CONFIG_SIG_SIGUSR1=1
CONFIG_SIG_SIGUSR2=2
CONFIG_SIG_SIGALARM=3
CONFIG_SIG_SIGCONDTIMEDOUT=16
#
# Sizes of configurable things (0 disables)
#
CONFIG_MAX_TASKS=16
CONFIG_MAX_TASK_ARGS=4
CONFIG_NPTHREAD_KEYS=4
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NAME_MAX=32
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_MQ_MAXMSGSIZE=32
CONFIG_MAX_WDOGPARMS=2
CONFIG_PREALLOC_WDOGS=4
CONFIG_PREALLOC_TIMERS=4
#
# Stack and heap information
#
CONFIG_IDLETHREAD_STACKSIZE=1024
CONFIG_USERMAIN_STACKSIZE=2048
CONFIG_PTHREAD_STACK_MIN=256
CONFIG_PTHREAD_STACK_DEFAULT=2048
#
# Device Drivers
#
CONFIG_DISABLE_POLL=y
CONFIG_DEV_NULL=y
# CONFIG_DEV_ZERO is not set
# CONFIG_LOOP is not set
# CONFIG_RAMDISK is not set
# CONFIG_CAN is not set
# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
# CONFIG_PWM is not set
# CONFIG_ARCH_HAVE_I2CRESET is not set
# CONFIG_I2C is not set
# CONFIG_SPI is not set
# CONFIG_I2S is not set
# CONFIG_RTC is not set
# CONFIG_WATCHDOG is not set
# CONFIG_ANALOG is not set
# CONFIG_AUDIO_DEVICES is not set
# CONFIG_VIDEO_DEVICES is not set
# CONFIG_BCH is not set
# CONFIG_INPUT is not set
# CONFIG_LCD is not set
# CONFIG_MMCSD is not set
# CONFIG_MTD is not set
# CONFIG_PIPES is not set
# CONFIG_PM is not set
# CONFIG_POWER is not set
# CONFIG_SENSORS is not set
# CONFIG_SERCOMM_CONSOLE is not set
CONFIG_SERIAL=y
# CONFIG_DEV_LOWCONSOLE is not set
# CONFIG_16550_UART is not set
# CONFIG_ARCH_HAVE_UART is not set
CONFIG_ARCH_HAVE_UART0=y
# CONFIG_ARCH_HAVE_UART1 is not set
# CONFIG_ARCH_HAVE_UART2 is not set
# CONFIG_ARCH_HAVE_UART3 is not set
# CONFIG_ARCH_HAVE_UART4 is not set
# CONFIG_ARCH_HAVE_UART5 is not set
# CONFIG_ARCH_HAVE_UART6 is not set
# CONFIG_ARCH_HAVE_UART7 is not set
# CONFIG_ARCH_HAVE_UART8 is not set
# CONFIG_ARCH_HAVE_SCI0 is not set
# CONFIG_ARCH_HAVE_SCI1 is not set
# CONFIG_ARCH_HAVE_USART0 is not set
CONFIG_ARCH_HAVE_USART1=y
# CONFIG_ARCH_HAVE_USART2 is not set
# CONFIG_ARCH_HAVE_USART3 is not set
# CONFIG_ARCH_HAVE_USART4 is not set
# CONFIG_ARCH_HAVE_USART5 is not set
# CONFIG_ARCH_HAVE_USART6 is not set
# CONFIG_ARCH_HAVE_USART7 is not set
# CONFIG_ARCH_HAVE_USART8 is not set
#
# USART Configuration
#
CONFIG_USART1_ISUART=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_UART0_SERIAL_CONSOLE=y
# CONFIG_USART1_SERIAL_CONSOLE is not set
# CONFIG_NO_SERIAL_CONSOLE is not set
#
# UART0 Configuration
#
CONFIG_UART0_RXBUFSIZE=256
CONFIG_UART0_TXBUFSIZE=256
CONFIG_UART0_BAUD=115200
CONFIG_UART0_BITS=8
CONFIG_UART0_PARITY=0
CONFIG_UART0_2STOP=0
# CONFIG_UART0_IFLOWCONTROL is not set
# CONFIG_UART0_OFLOWCONTROL is not set
#
# USART1 Configuration
#
CONFIG_USART1_RXBUFSIZE=256
CONFIG_USART1_TXBUFSIZE=256
CONFIG_USART1_BAUD=115200
CONFIG_USART1_BITS=8
CONFIG_USART1_PARITY=0
CONFIG_USART1_2STOP=0
# CONFIG_USART1_IFLOWCONTROL is not set
# CONFIG_USART1_OFLOWCONTROL is not set
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set
#
# System Logging Device Options
#
#
# System Logging
#
# CONFIG_RAMLOG is not set
#
# Networking Support
#
# CONFIG_ARCH_HAVE_NET is not set
# CONFIG_ARCH_HAVE_PHY is not set
# CONFIG_NET is not set
#
# File Systems
#
#
# File system configuration
#
# CONFIG_DISABLE_MOUNTPOINT is not set
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
# CONFIG_FAT_LCNAMES is not set
# CONFIG_FAT_LFN is not set
# CONFIG_FS_FATTIME is not set
# CONFIG_FAT_DMAMEMORY is not set
# CONFIG_FS_NXFFS is not set
# CONFIG_FS_ROMFS is not set
# CONFIG_FS_SMARTFS is not set
# CONFIG_FS_BINFS is not set
# CONFIG_FS_PROCFS is not set
#
# System Logging
#
# CONFIG_SYSLOG_ENABLE is not set
# CONFIG_SYSLOG is not set
#
# Graphics Support
#
# CONFIG_NX is not set
#
# Memory Management
#
# CONFIG_MM_MULTIHEAP is not set
# CONFIG_MM_SMALL is not set
CONFIG_MM_REGIONS=2
# CONFIG_ARCH_HAVE_HEAP2 is not set
# CONFIG_GRAN is not set
#
# Audio Support
#
# CONFIG_AUDIO is not set
#
# Binary Formats
#
# CONFIG_BINFMT_DISABLE is not set
# CONFIG_BINFMT_EXEPATH is not set
# CONFIG_NXFLAT is not set
# CONFIG_ELF is not set
CONFIG_BUILTIN=y
# CONFIG_PIC is not set
# CONFIG_SYMTAB_ORDEREDBYNAME is not set
#
# Library Routines
#
#
# Standard C Library Options
#
CONFIG_STDIO_BUFFER_SIZE=64
CONFIG_STDIO_LINEBUFFER=y
CONFIG_NUNGET_CHARS=2
CONFIG_LIB_HOMEDIR="/"
# CONFIG_LIBM is not set
# CONFIG_NOPRINTF_FIELDWIDTH is not set
# CONFIG_LIBC_FLOATINGPOINT is not set
CONFIG_LIB_RAND_ORDER=1
# CONFIG_EOL_IS_CR is not set
# CONFIG_EOL_IS_LF is not set
# CONFIG_EOL_IS_BOTH_CRLF is not set
CONFIG_EOL_IS_EITHER_CRLF=y
# CONFIG_LIBC_EXECFUNCS is not set
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048
# CONFIG_LIBC_STRERROR is not set
# CONFIG_LIBC_PERROR_STDOUT is not set
CONFIG_ARCH_LOWPUTC=y
CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_ARCH_ROMGETC is not set
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
#
# Non-standard Library Support
#
# CONFIG_SCHED_WORKQUEUE is not set
# CONFIG_LIB_KBDCODEC is not set
# CONFIG_LIB_SLCDCODEC is not set
#
# Basic CXX Support
#
# CONFIG_C99_BOOL8 is not set
# CONFIG_HAVE_CXX is not set
#
# Application Configuration
#
#
# Built-In Applications
#
CONFIG_BUILTIN_PROXY_STACKSIZE=1024
#
# Examples
#
# CONFIG_EXAMPLES_BUTTONS is not set
# CONFIG_EXAMPLES_CAN is not set
# CONFIG_EXAMPLES_CONFIGDATA is not set
# CONFIG_EXAMPLES_DHCPD is not set
# CONFIG_EXAMPLES_ELF is not set
# CONFIG_EXAMPLES_FTPC is not set
# CONFIG_EXAMPLES_FTPD is not set
# CONFIG_EXAMPLES_HELLO is not set
# CONFIG_EXAMPLES_HELLOXX is not set
# CONFIG_EXAMPLES_JSON is not set
# CONFIG_EXAMPLES_HIDKBD is not set
# CONFIG_EXAMPLES_KEYPADTEST is not set
# CONFIG_EXAMPLES_IGMP is not set
# CONFIG_EXAMPLES_LCDRW is not set
# CONFIG_EXAMPLES_MM is not set
# CONFIG_EXAMPLES_MODBUS is not set
# CONFIG_EXAMPLES_MOUNT is not set
# CONFIG_EXAMPLES_NRF24L01TERM is not set
CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_NULL is not set
# CONFIG_EXAMPLES_NX is not set
# CONFIG_EXAMPLES_NXCONSOLE is not set
# CONFIG_EXAMPLES_NXFFS is not set
# CONFIG_EXAMPLES_NXFLAT is not set
# CONFIG_EXAMPLES_NXHELLO is not set
# CONFIG_EXAMPLES_NXIMAGE is not set
# CONFIG_EXAMPLES_NXLINES is not set
# CONFIG_EXAMPLES_NXTEXT is not set
# CONFIG_EXAMPLES_OSTEST is not set
# CONFIG_EXAMPLES_PASHELLO is not set
# CONFIG_EXAMPLES_PIPE is not set
# CONFIG_EXAMPLES_POSIXSPAWN is not set
# CONFIG_EXAMPLES_QENCODER is not set
# CONFIG_EXAMPLES_RGMP is not set
# CONFIG_EXAMPLES_ROMFS is not set
# CONFIG_EXAMPLES_SENDMAIL is not set
# CONFIG_EXAMPLES_SERLOOP is not set
# CONFIG_EXAMPLES_SLCD is not set
# CONFIG_EXAMPLES_SMART_TEST is not set
# CONFIG_EXAMPLES_SMART is not set
# CONFIG_EXAMPLES_TCPECHO is not set
# CONFIG_EXAMPLES_TELNETD is not set
# CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_UDP is not set
# CONFIG_EXAMPLES_UIP is not set
# CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_USBTERM is not set
# CONFIG_EXAMPLES_WATCHDOG is not set
#
# Graphics Support
#
# CONFIG_TIFF is not set
#
# Interpreters
#
# CONFIG_INTERPRETERS_FICL is not set
# CONFIG_INTERPRETERS_PCODE is not set
#
# Network Utilities
#
#
# Networking Utilities
#
# CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_DHCPD is not set
# CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set
# CONFIG_NETUTILS_JSON is not set
# CONFIG_NETUTILS_SMTP is not set
# CONFIG_NETUTILS_TFTPC is not set
# CONFIG_NETUTILS_THTTPD is not set
# CONFIG_NETUTILS_UIPLIB is not set
# CONFIG_NETUTILS_WEBCLIENT is not set
#
# FreeModBus
#
# CONFIG_MODBUS is not set
#
# NSH Library
#
CONFIG_NSH_LIBRARY=y
CONFIG_NSH_READLINE=y
# CONFIG_NSH_CLE is not set
CONFIG_NSH_BUILTIN_APPS=y
#
# Disable Individual commands
#
# CONFIG_NSH_DISABLE_ADDROUTE is not set
# CONFIG_NSH_DISABLE_CAT is not set
# CONFIG_NSH_DISABLE_CD is not set
# CONFIG_NSH_DISABLE_CP is not set
# CONFIG_NSH_DISABLE_CMP is not set
# CONFIG_NSH_DISABLE_DD is not set
# CONFIG_NSH_DISABLE_DF is not set
# CONFIG_NSH_DISABLE_DELROUTE is not set
# CONFIG_NSH_DISABLE_ECHO is not set
# CONFIG_NSH_DISABLE_EXEC is not set
# CONFIG_NSH_DISABLE_EXIT is not set
# CONFIG_NSH_DISABLE_FREE is not set
# CONFIG_NSH_DISABLE_GET is not set
# CONFIG_NSH_DISABLE_HELP is not set
# CONFIG_NSH_DISABLE_HEXDUMP is not set
# CONFIG_NSH_DISABLE_IFCONFIG is not set
# CONFIG_NSH_DISABLE_KILL is not set
# CONFIG_NSH_DISABLE_LOSETUP is not set
# CONFIG_NSH_DISABLE_LS is not set
# CONFIG_NSH_DISABLE_MB is not set
# CONFIG_NSH_DISABLE_MKDIR is not set
# CONFIG_NSH_DISABLE_MKFATFS is not set
# CONFIG_NSH_DISABLE_MKFIFO is not set
# CONFIG_NSH_DISABLE_MKRD is not set
# CONFIG_NSH_DISABLE_MH is not set
# CONFIG_NSH_DISABLE_MOUNT is not set
# CONFIG_NSH_DISABLE_MW is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_PWD is not set
# CONFIG_NSH_DISABLE_RM is not set
# CONFIG_NSH_DISABLE_RMDIR is not set
# CONFIG_NSH_DISABLE_SET is not set
# CONFIG_NSH_DISABLE_SH is not set
# CONFIG_NSH_DISABLE_SLEEP is not set
# CONFIG_NSH_DISABLE_TEST is not set
# CONFIG_NSH_DISABLE_UMOUNT is not set
# CONFIG_NSH_DISABLE_UNSET is not set
# CONFIG_NSH_DISABLE_USLEEP is not set
# CONFIG_NSH_DISABLE_WGET is not set
# CONFIG_NSH_DISABLE_XD is not set
#
# Configure Command Options
#
# CONFIG_NSH_CMDOPT_DF_H is not set
CONFIG_NSH_CODECS_BUFSIZE=128
CONFIG_NSH_CMDOPT_HEXDUMP=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
# CONFIG_NSH_DISABLE_SEMICOLON is not set
CONFIG_NSH_CMDPARMS=y
CONFIG_NSH_TMPDIR="/tmp"
CONFIG_NSH_MAXARGUMENTS=6
CONFIG_NSH_ARGCAT=y
CONFIG_NSH_NESTDEPTH=3
# CONFIG_NSH_DISABLESCRIPT is not set
# CONFIG_NSH_DISABLE_ITEF is not set
# CONFIG_NSH_DISABLE_LOOPS is not set
# CONFIG_NSH_DISABLEBG is not set
CONFIG_NSH_CONSOLE=y
#
# USB Trace Support
#
# CONFIG_NSH_CONDEV is not set
CONFIG_NSH_ARCHINIT=y
#
# NxWidgets/NxWM
#
#
# Platform-specific Support
#
# CONFIG_PLATFORM_CONFIGDATA is not set
#
# System Libraries and NSH Add-Ons
#
#
# USB CDC/ACM Device Commands
#
#
# USB Composite Device Commands
#
#
# Custom Free Memory Command
#
# CONFIG_SYSTEM_FREE is not set
#
# I2C tool
#
#
# INI File Parser
#
# CONFIG_SYSTEM_INIFILE is not set
#
# FLASH Program Installation
#
# CONFIG_SYSTEM_INSTALL is not set
#
# FLASH Erase-all Command
#
#
# NxPlayer media player library / command Line
#
# CONFIG_SYSTEM_NXPLAYER is not set
#
# RAM test
#
# CONFIG_SYSTEM_RAMTEST is not set
#
# readline()
#
CONFIG_SYSTEM_READLINE=y
CONFIG_READLINE_ECHO=y
#
# Power Off
#
# CONFIG_SYSTEM_POWEROFF is not set
#
# RAMTRON
#
# CONFIG_SYSTEM_RAMTRON is not set
#
# SD Card
#
# CONFIG_SYSTEM_SDCARD is not set
#
# Sysinfo
#
# CONFIG_SYSTEM_SYSINFO is not set
#
# USB Monitor
#
#
# EMACS-like Command Line Editor
#
# CONFIG_SYSTEM_CLE is not set
#
# VI Work-Alike Editor
#
# CONFIG_SYSTEM_VI is not set
#
# Stack Monitor
#
#
# USB Mass Storage Device Commands
#
#
# Zmodem Commands
#
# CONFIG_SYSTEM_ZMODEM is not set

68
configs/sam4e-ek/nsh/setenv.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
# configs/sam4e-ek/nsh/setenv.sh
#
# Copyright (C) 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.
#
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"
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/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"
# 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}"

116
configs/sam4e-ek/scripts/flash.ld Executable file
View file

@ -0,0 +1,116 @@
/****************************************************************************
* configs/sam4e-ek/scripts/flash.ld
*
* Copyright (C) 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.
*
****************************************************************************/
/* The SAM4E16 has 1025KB of FLASH beginning at address 0x0008:0000,
* 128KB of SRAM beginning at address 0x2000:0000. When booting from FLASH,
* FLASH memory is aliased to address 0x0000:0000 where the code expects to
* begin execution by jumping to the entry point in the 0x0800:0000 address
* range.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00080000, LENGTH = 1024K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
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(.);
_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
/* 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) }
}

2
configs/sam4e-ek/src/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/.depend
/Make.dep

View file

@ -0,0 +1,110 @@
############################################################################
# configs/sam4e-ek/src/Makefile
#
# Copyright (C) 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.
#
############################################################################
-include $(TOPDIR)/Make.defs
CFLAGS += -I$(TOPDIR)/sched
ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sam_boot.c sam_leds.c sam_buttons.c sam_spi.c sam_usbdev.c
ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
CSRCS += sam_cxxinitialize.c
endif
ifeq ($(CONFIG_LCD),y)
CSRCS += sam_lcd.c
endif
ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += sam_nsh.c
endif
ifeq ($(CONFIG_SAM34_HSMCI),y)
CSRCS += sam_mmcsd.c
endif
ifeq ($(CONFIG_USBMSC),y)
CSRCS += sam_usbmsc.c
endif
ifeq ($(CONFIG_INPUT_ADS7843E),y)
CSRCS += sam_touchscreen.c
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip
CFLAGS += -I$(ARCH_SRCDIR)/common
CFLAGS += -I$(ARCH_SRCDIR)/armv7-m
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

View file

@ -0,0 +1,308 @@
/************************************************************************************
* configs/sam4e-ek/src/sam4e-ek.h
*
* Copyright (C) 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_SAM4E_EK_SRC_SAM4E_EK_H
#define __CONFIGS_SAM4E_EK_SRC_SAM4E_EK_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"
/************************************************************************************
* Definitions
************************************************************************************/
/* External Memory Usage ************************************************************/
/* LCD on CS2 */
#define LCD_BASE SAM_EXTCS2_BASE
/* Touchscreen controller (TSC) */
#define CONFIG_TSC_ADS7843 1 /* ADS7843 present on board */
#define CONFIG_TSC_SPI 0 /* On SPI0 */
/* SAM4E-EK GPIO Pin Definitions ****************************************************/
/* LCD:
* LCD Module Pin Out: SAM3U PIO:
* -------------------------------------------- --------------------------------------
* Pin Symbol Function LCD PeriphA PeriphB Extra
* ---- ------ -------------------------------- -------------- -------- ------- ------
* 1 GND Ground N/A --- --- ---
* 2 CS Chip Select PC16 NCS2 PWML3 AD12BAD5
* 3 RS Register select signal PB8 (see A1) CTS0 A1 AD3
* 4 WR Write operation signal PB23 (NWE) NWR0/NEW PCK1 ---
* 5 RD Read operation signal PB19 (NRD) NRD PWML2 ---
* 6 DB0 Data bus PB9 D0 DTR0 ---
* 7 DB1 Data bus PB10 D1 DSR0 ---
* 8 DB2 Data bus PB11 D2 DCD0 ---
* 9 DB3 Data bus PB12 D3 RI0 ---
* 10 DB4 Data bus PB13 D4 PWMH0 ---
* 11 DB5 Data bus PB14 D5 PWMH1 ---
* 12 DB6 Data bus PB15 D6 PWMH2 ---
* 13 DB7 Data bus PB16 D7 PMWH3 ---
* 14 DB8 Data bus PB25 D8 PWML0 ---
* 15 DB9 Data bus PB26 D9 PWML1 ---
* 16 DB10 Data bus PB27 D10 PWML2 ---
* 17 DB11 Data bus PB28 D11 PWML3 ---
* 18 DB12 Data bus PB29 D12 --- ---
* 19 DB13 Data bus PB30 D13 --- ---
* 20 DB14 Data bus PB31 D14 --- ---
* 21 DB15 Data bus PB6 TIOA1 D15 AD1
* 22 NC No connection N/A --- --- ---
* 23 NC No connection N/A --- --- ---
* 24 RESET Reset signal N/A --- --- ---
* 25 GND Ground N/A --- --- ---
* 26 X+ Touch panel X_RIGHT PA15 SPCK PWMH2 ---
* 27 Y+ Touch panel Y_UP PA14 MOSI --- ---
* 28 X- Touch panel X_LEFT PA13 MISO --- ---
* 29 Y- Touch panel Y_DOWN PC14 A3 NPCS2 ---
* 30 GND Ground N/A --- --- ---
* 31 VDD1 Power supply for digital IO Pad N/A --- --- ---
* 32 VDD2 Power supply for analog circuit N/A --- --- ---
* 33 A1 Power supply for backlight PB8 (see RS) CTS0 A1 AD3
* 34 A2 Power supply for backlight N/A --- --- ---
* 35 A3 Power supply for backlight N/A --- --- ---
* 36 A4 Power supply for backlight N/A --- --- ---
* 37 NC No connection N/A --- --- ---
* 38 NC No connection N/A --- --- ---
* 39 K Backlight ground N/A --- --- ---
*/
#define GPIO_LCD_NCS2 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOC | GPIO_PIN16)
#define GPIO_LCD_RS (GPIO_PERIPHB | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN8)
#define GPIO_LCD_NWE (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN23)
#define GPIO_LCD_NRD (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN19)
#define GPIO_LCD_D0 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN9)
#define GPIO_LCD_D1 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN10)
#define GPIO_LCD_D2 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN11)
#define GPIO_LCD_D3 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN12)
#define GPIO_LCD_D4 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN13)
#define GPIO_LCD_D5 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN14)
#define GPIO_LCD_D6 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN15)
#define GPIO_LCD_D7 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN16)
#define GPIO_LCD_D8 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN25)
#define GPIO_LCD_D9 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN26)
#define GPIO_LCD_D10 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN27)
#define GPIO_LCD_D11 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN28)
#define GPIO_LCD_D12 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN29)
#define GPIO_LCD_D13 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN30)
#define GPIO_LCD_D14 (GPIO_PERIPHA | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN31)
#define GPIO_LCD_D15 (GPIO_PERIPHB | GPIO_CFG_PULLUP | GPIO_PORT_PIOB | GPIO_PIN6)
/* LCD Backlight pin definition. */
#define GPIO_LCD_BKL (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \
GPIO_PORT_PIOC | GPIO_PIN19)
/* Touchscreen controller (TSC)
*
* The IRQ is active low and pulled up.
*
* Pen Interrupt. Open anode output, requires 10kO to 100kO pull-up resistor
* externally. There is a 100KO pull-up on the SAM4E-EK board so no additional
* pull-up should be required.
*
* BUSY is high impedance when CS is high (not selected). When CS is
* is low, BUSY is active high. Since the pin is pulled up, it will appear
* busy if CS is not selected (there is no pull-up onboard).
*/
#define GPIO_TCS_IRQ (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_INT_BOTHEDGES | \
GPIO_PORT_PIOA | GPIO_PIN24)
#define GPIO_TCS_BUSY (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOA | \
GPIO_PIN2)
#define SAM_TCS_IRQ SAM_IRQ_PA24
/* LEDs
*
* D2 PA0 Blue Pulled high
* D3 PD20 Amber Pulled high
* D4 PD21 Green Pulled high
*/
#define GPIO_D3 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOD | \
GPIO_OUTPUT_CLEAR | GPIO_PIN20)
#define GPIO_D2 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOA | \
GPIO_OUTPUT_SET | GPIO_PIN0)
#define GPIO_D4 (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_PORT_PIOD | \
GPIO_OUTPUT_SET | GPIO_PIN21)
/* Buttons
*
* Four buttons for software inputs:
*
* PA1 BUTTON_SCROLL-UP Grounded
* PA2 BUTTON_SCROLL-DOWN Grounded
* PA19 BUTTON_WAKU Grounded
* PA20 BUTTON_TAMP Grounded
*/
#define GPIO_SCROLLUP (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN1)
#define GPIO_SCROLLDWN (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN2)
#define GPIO_WAKU (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN19)
#define GPIO_TAMP (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | \
GPIO_INT_BOTHEDGES | GPIO_PORT_PIOA | GPIO_PIN20)
#define IRQ_SCROLLUP SAM_IRQ_PA1
#define IRQ_SCROLLDWN SAM_IRQ_PA2
#define IRQ_WAKU SAM_IRQ_PA19
#define IRQ_TAMP SAM_IRQ_PA20
#define IRQ_SCROLLUP SAM_IRQ_PA1
#define IRQ_SCROLLDWN SAM_IRQ_PA2
#define IRQ_WAKU SAM_IRQ_PA19
#define IRQ_TAMP SAM_IRQ_PA20
/* SD Card Detect */
#define GPIO_MCI_CD (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOA | GPIO_PIN25)
/* SPI Chip Selects */
/* Chip select pin connected to the touchscreen controller and to the ZigBee module
* connector. Notice that the touchscreen chip select is implemented as a GPIO
* OUTPUT that must be controlled by board-specific. This is because the ADS7843E
* driver must be able to sample the device BUSY GPIO input between SPI transfers.
* However, the AD7843E will tri-state the BUSY input whenever the chip select is
* de-asserted. So the only option is to control the chip select manually and hold
* it low throughout the SPI transfer.
*/
#define GPIO_TSC_NPCS2 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN14)
#define TSC_CSNUM 2
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public data
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the SAM4E-EK board.
*
************************************************************************************/
void weak_function sam_spiinitialize(void);
/************************************************************************************
* Name: sam_usbinitialize
*
* Description:
* Called to setup USB-related GPIO pins for the SAM4E-EK board.
*
************************************************************************************/
void weak_function sam_usbinitialize(void);
/************************************************************************************
* Name: sam_hsmciinit
*
* Description:
* Initialize HSMCI support
*
************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
int weak_function sam_hsmciinit(void);
#else
# define sam_hsmciinit()
#endif
/************************************************************************************
* Name: board_led_initialize
************************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void board_led_initialize(void);
#endif
/************************************************************************************
* Name: sam_cardinserted
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
bool sam_cardinserted(unsigned char slot);
#else
# define sam_cardinserted(slot) (false)
#endif
/************************************************************************************
* Name: sam_writeprotected
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
bool sam_writeprotected(unsigned char slot);
#else
# define sam_writeprotected(slot) (false)
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_SAM4E_EK_SRC_SAM4E_EK_H */

View file

@ -0,0 +1,112 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_boot.c
*
* Copyright (C) 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "sam4e-ek.h"
/************************************************************************************
* Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3U 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)
{
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
* sam_spiinitialize() has been brought into the link.
*/
#ifdef CONFIG_SAM34_SPI0
if (sam_spiinitialize)
{
sam_spiinitialize();
}
#endif
/* Initialize USB if 1) USBDEV is selected, 2) the USB controller is not
* disabled, and 3) the weak function sam_usbinitialize() has been brought
* into the build.
*/
#if defined(CONFIG_USBDEV) && defined(CONFIG_SAM34_USB)
if (sam_usbinitialize)
{
sam_usbinitialize();
}
#endif
/* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
board_led_initialize();
#endif
/* Setup SD card-related PIOs if 1) HSMCI is selected and 2) the weak
* function sam_hsmciinit() has been brought into the build.
*/
#ifdef CONFIG_SAM34_HSMCI
if (sam_hsmciinit)
{
sam_hsmciinit();
}
#endif
}

View file

@ -0,0 +1,199 @@
/****************************************************************************
* configs/sam4e-ek/src/sam_buttons.c
*
* Copyright (C) 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <arch/board/board.h>
#include "sam_gpio.h"
#include "sam4e-ek.h"
#ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
static xcpt_t g_irq_scrollup;
static xcpt_t g_irq_scrolldown;
static xcpt_t g_irq_waku;
static xcpt_t g_irq_tamp;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_irqx
*
* Description:
* This function implements the core of the board_button_irq() logic.
*
****************************************************************************/
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
static xcpt_t board_button_irqx(int irq, xcpt_t irqhandler, xcpt_t *store)
{
xcpt_t oldhandler;
irqstate_t flags;
/* Disable interrupts until we are done. This guarantees that the following
* operations are atomic.
*/
flags = irqsave();
/* Get the old button interrupt handler and save the new one */
oldhandler = *store;
*store = irqhandler;
/* Configure the interrupt */
sam_gpioirq(irq);
(void)irq_attach(irq, irqhandler);
sam_gpioirqenable(irq);
irqrestore(flags);
/* Return the old button handler (so that it can be restored) */
return oldhandler;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
*
* Description:
* board_button_initialize() must be called to initialize button resources. After
* that, board_buttons() may be called to collect the current state of all
* buttons or board_button_irq() may be called to register button interrupt
* handlers.
*
****************************************************************************/
void board_button_initialize(void)
{
(void)sam_configgpio(GPIO_SCROLLUP);
(void)sam_configgpio(GPIO_SCROLLDWN);
(void)sam_configgpio(GPIO_WAKU);
(void)sam_configgpio(GPIO_TAMP);
}
/************************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 8-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
*
************************************************************************************/
uint8_t board_buttons(void)
{
uint8_t retval;
retval = sam_gpioread(GPIO_SCROLLUP) ? 0 : BUTTON_SCROLLUP;
retval |= sam_gpioread(GPIO_SCROLLDWN) ? 0 : BUTTON_SCROLLDOWN;
retval |= sam_gpioread(GPIO_WAKU) ? 0 : BUTTON_WAKU;
retval |= sam_gpioread(GPIO_TAMP) ? 0 : BUTTON_TAMP;
return retval;
}
/****************************************************************************
* Name: board_button_irq
*
* Description:
* This function may be called to register an interrupt handler that will
* be called when a button is depressed or released. The ID value is one
* of the BUTTON* definitions provided above. The previous interrupt
* handler address isreturned (so that it may restored, if so desired).
*
* Configuration Notes:
* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the
* overall GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
* CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
* interrupts on. For button support, bits 2 and 3 must be set in
* CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3).
*
****************************************************************************/
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
{
switch (id)
{
case BUTTON_SCROLLUP:
return board_button_irqx(IRQ_SCROLLUP, irqhandler, &g_irq_scrollup);
case BUTTON_SCROLLDOWN:
return board_button_irqx(IRQ_SCROLLDWN, irqhandler, &g_irq_scrolldown);
case BUTTON_WAKU:
return board_button_irqx(IRQ_WAKU, irqhandler, &g_irq_waku);
case BUTTON_TAMP:
return board_button_irqx(IRQ_WAKU, irqhandler, &g_irq_tamp);
default:
return NULL;
}
}
#endif
#endif /* CONFIG_ARCH_BUTTONS */

View file

@ -0,0 +1,149 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_cxxinitialize.c
*
* Copyright (C) 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <debug.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/************************************************************************************
* Definitions
************************************************************************************/
/* Debug ****************************************************************************/
/* Non-standard debug that may be enabled just for testing the static constructors */
#ifndef CONFIG_DEBUG
# undef CONFIG_DEBUG_CXX
#endif
#ifdef CONFIG_DEBUG_CXX
# define cxxdbg dbg
# define cxxlldbg lldbg
# ifdef CONFIG_DEBUG_VERBOSE
# define cxxvdbg vdbg
# define cxxllvdbg llvdbg
# else
# define cxxvdbg(x...)
# define cxxllvdbg(x...)
# endif
#else
# define cxxdbg(x...)
# define cxxlldbg(x...)
# define cxxvdbg(x...)
# define cxxllvdbg(x...)
#endif
/************************************************************************************
* Private Types
************************************************************************************/
/* This type defines one entry in initialization array */
typedef void (*initializer_t)(void);
/************************************************************************************
* External references
************************************************************************************/
/* _sinit and _einit are symbols exported by the linker script that mark the
* beginning and the end of the C++ initialization section.
*/
extern initializer_t _sinit;
extern initializer_t _einit;
/* _stext and _etext are symbols exported by the linker script that mark the
* beginning and the end of text.
*/
extern uint32_t _stext;
extern uint32_t _etext;
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Name: up_cxxinitialize
*
* Description:
* If C++ and C++ static constructors are supported, then this function
* must be provided by board-specific logic in order to perform
* initialization of the static C++ class instances.
*
* This function should then be called in the application-specific
* user_start logic in order to perform the C++ initialization. NOTE
* that no component of the core NuttX RTOS logic is involved; This
* function defintion only provides the 'contract' between application
* specific C++ code and platform-specific toolchain support
*
***************************************************************************/
void up_cxxinitialize(void)
{
initializer_t *initp;
cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
&_sinit, &_einit, &_stext, &_etext);
/* Visit each entry in the initialzation table */
for (initp = &_sinit; initp != &_einit; initp++)
{
initializer_t initializer = *initp;
cxxdbg("initp: %p initializer: %p\n", initp, initializer);
/* Make sure that the address is non-NULL and lies in the text region
* defined by the linker script. Some toolchains may put NULL values
* or counts in the initialization table
*/
if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
{
cxxdbg("Calling %p\n", initializer);
initializer();
}
}
}
#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,215 @@
/****************************************************************************
* configs/sam4e-ek/src/sam_leds.c
*
* Copyright (C) 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <arch/board/board.h>
#include "chip.h"
#include "up_arch.h"
#include "up_internal.h"
#include "sam_gpio.h"
#include "sam4e-ek.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Definitions
****************************************************************************/
/* The SAM4E-EK board has three, user-controllable LEDs labelled D2 (blue),
* D3 (amber), and D4 (green) on the board. Usage of these LEDs is defined
* in include/board.h and src/up_leds.c. They are encoded as follows:
*
* SYMBOL Meaning D3* D2 D4
* ------------------- ----------------------- ------- ------- -------
* LED_STARTED NuttX has been started OFF OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
* LED_IRQSENABLED Interrupts enabled OFF ON OFF
* LED_STACKCREATED Idle stack created OFF ON ON
* LED_INIRQ In an interrupt** N/C FLASH N/C
* LED_SIGNAL In a signal handler*** N/C N/C FLASH
* LED_ASSERTION An assertion failed FLASH N/C N/C
* LED_PANIC The system has crashed FLASH N/C N/C
*
* * If D2 and D4 are statically on, then NuttX probably failed to boot
* and these LEDs will give you some indication of where the failure was
* ** The normal state is D3=OFF, D4=ON and D2 faintly glowing. This faint
* glow is because of timer interrupts that result in the LED being
* illuminated on a small proportion of the time.
* *** D4 may also flicker normally if signals are processed.
*/
#define LED_OFF 0
#define LED_ON 1
#define LED_NOCHANGE 2
#define LED_MASK 3
#define D3_SHIFT 0
#define D3_OFF (LED_OFF << D3_SHIFT)
#define D3_ON (LED_ON << D3_SHIFT)
#define D3_NOCHANGE (LED_NOCHANGE << D3_SHIFT)
#define D2_SHIFT 2
#define D2_OFF (LED_OFF << D2_SHIFT)
#define D2_ON (LED_ON << D2_SHIFT)
#define D2_NOCHANGE (LED_NOCHANGE << D2_SHIFT)
#define D4_SHIFT 4
#define D4_OFF (LED_OFF << D4_SHIFT)
#define D4_ON (LED_ON << D4_SHIFT)
#define D4_NOCHANGE (LED_NOCHANGE << D4_SHIFT)
/* 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
****************************************************************************/
static const uint8_t g_ledon[8] =
{
(D3_OFF |D2_OFF |D4_OFF), /* LED_STARTED */
(D3_ON |D2_OFF |D4_ON), /* LED_HEAPALLOCATE */
(D3_OFF |D2_ON |D4_OFF), /* LED_IRQSENABLED */
(D3_ON |D2_ON |D4_ON), /* LED_STACKCREATED */
(D3_NOCHANGE|D2_OFF |D4_NOCHANGE), /* LED_INIRQ */
(D3_NOCHANGE|D2_NOCHANGE|D4_OFF), /* LED_SIGNAL */
(D3_ON |D2_NOCHANGE|D4_NOCHANGE), /* LED_ASSERTION */
(D3_ON |D2_NOCHANGE|D4_NOCHANGE) /* LED_PANIC */
};
static const uint8_t g_ledoff[8] =
{
(D3_OFF |D2_OFF |D4_OFF), /* LED_STARTED (does not happen) */
(D3_ON |D2_OFF |D4_ON), /* LED_HEAPALLOCATE (does not happen) */
(D3_OFF |D2_ON |D4_OFF), /* LED_IRQSENABLED (does not happen) */
(D3_ON |D2_ON |D4_ON), /* LED_STACKCREATED (does not happen) */
(D3_NOCHANGE|D2_ON |D4_NOCHANGE), /* LED_INIRQ */
(D3_NOCHANGE|D2_NOCHANGE|D4_ON), /* LED_SIGNAL */
(D3_OFF |D2_NOCHANGE|D4_NOCHANGE), /* LED_ASSERTION */
(D3_OFF |D2_NOCHANGE|D4_NOCHANGE) /* LED_PANIC */
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: sam_setled
****************************************************************************/
static void sam_setled(gpio_pinset_t pinset, uint8_t state)
{
/* Assume active high. Initial state == 0 means active high */
bool polarity = ((pinset & GPIO_OUTPUT_SET) == 0);
switch (state)
{
case LED_OFF:
polarity = !polarity;
case LED_ON:
break;
case LED_NOCHANGE:
default:
return;
}
sam_gpiowrite(pinset, polarity);
}
/****************************************************************************
* Name: sam_setleds
****************************************************************************/
static void sam_setleds(uint8_t state)
{
sam_setled(GPIO_D3, (state >> D3_SHIFT) & LED_MASK);
sam_setled(GPIO_D2, (state >> D2_SHIFT) & LED_MASK);
sam_setled(GPIO_D4, (state >> D4_SHIFT) & LED_MASK);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_led_initialize
****************************************************************************/
void board_led_initialize(void)
{
(void)sam_configgpio(GPIO_D3);
(void)sam_configgpio(GPIO_D2);
(void)sam_configgpio(GPIO_D4);
}
/****************************************************************************
* Name: board_led_on
****************************************************************************/
void board_led_on(int led)
{
sam_setleds(g_ledon[led & 7]);
}
/****************************************************************************
* Name: board_led_off
****************************************************************************/
void board_led_off(int led)
{
sam_setleds(g_ledoff[led & 7]);
}
#endif /* CONFIG_ARCH_LEDS */

View file

@ -0,0 +1,149 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_mmcsd.c
*
* Copyright (C) 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <debug.h>
#include "sam_gpio.h"
#include "sam4e-ek.h"
#ifdef CONFIG_SAM34_HSMCI
/************************************************************************************
* Definitions
************************************************************************************/
/* This needs to be extended. The card detect GPIO must be configured as an interrupt.
* when the interrupt indicating that a card has been inserted or removed is received,
* this function must call sio_mediachange() to handle that event. See
* arch/arm/src/sam34/sam_hsmci.h for more information.
*
* Also see the SAMA5D3x-EK implementation of this same logic. The card detect
* interrupt handling should be a drop-in.
*/
#ifdef GPIO_MCI_CD
# warning "Card detect interrupt handling needed"
#endif
/* Usually defined in NuttX header files */
#ifndef OK
# define OK 0
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_hsmciinit
*
* Description:
* Initialize HSMCI support. This function is called very early in board
* initialization.
*
************************************************************************************/
int sam_hsmciinit(void)
{
#ifdef GPIO_MCI_CD
sam_configgpio(GPIO_MCI_CD);
#endif
#ifdef GPIO_MCI_WP
sam_configgpio(GPIO_MCI_WP);
#endif
return OK;
}
/************************************************************************************
* Name: sam_cardinserted
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
************************************************************************************/
bool sam_cardinserted(unsigned char slot)
{
if (slot == 0)
{
#ifdef GPIO_MCI_CD
bool inserted = sam_gpioread(GPIO_MCI_CD);
fvdbg("inserted: %s\n", inserted ? "NO" : "YES");
return !inserted;
#else
return true;
#endif
}
return false;
}
/************************************************************************************
* Name: sam_writeprotected
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
************************************************************************************/
bool sam_writeprotected(unsigned char slot)
{
if (slot == 0)
{
#ifdef GPIO_MCI_WP
bool protected = sam_gpioread(GPIO_MCI_WP);
fvdbg("protected: %s\n", inserted ? "YES" : "NO");
return protected;
#else
return false;
#endif
}
return false;
}
#endif /* CONFIG_SAM34_HSMCI */

View file

@ -0,0 +1,164 @@
/****************************************************************************
* config/sam4e-ek/src/sam_nsh.c
*
* Copyright (C) 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/sdio.h>
#include <nuttx/mmcsd.h>
#include "sam_hsmci.h"
#include "sam4e-ek.h"
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* PORT and SLOT number probably depend on the board configuration */
#define NSH_HAVE_USBDEV 1
#define NSH_HAVE_MMCSD 1
/* Can't support MMC/SD if the card interface is not enable */
#ifndef CONFIG_SAM34_HSMCI
# undef NSH_HAVE_MMCSD
#endif
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
* is not enabled.
*/
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM34_HSMCI)
# undef NSH_HAVE_MMCSD
#endif
#ifdef NSH_HAVE_MMCSD
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
# error "Only one MMC/SD slot"
# undef CONFIG_NSH_MMCSDSLOTNO
# endif
# ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
# endif
# ifndef CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
# endif
#endif
/* Can't support USB features if USB is not enabled */
#ifndef CONFIG_USBDEV
# undef NSH_HAVE_USBDEV
#endif
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) syslog(__VA_ARGS__)
# else
# define message(...) printf(__VA_ARGS__)
# endif
#else
# ifdef CONFIG_DEBUG
# define message syslog
# else
# define message printf
# endif
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nsh_archinitialize
*
* Description:
* Perform architecture specific initialization
*
****************************************************************************/
int nsh_archinitialize(void)
{
#ifdef NSH_HAVE_MMCSD
FAR struct sdio_dev_s *sdio;
int ret;
/* Mount the SDIO-based MMC/SD block driver */
/* First, get an instance of the SDIO interface */
message("nsh_archinitialize: Initializing SDIO slot %d\n",
CONFIG_NSH_MMCSDSLOTNO);
sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
if (!sdio)
{
message("nsh_archinitialize: Failed to initialize SDIO slot %d\n",
CONFIG_NSH_MMCSDSLOTNO);
return -ENODEV;
}
/* Now bind the SDIO interface to the MMC/SD driver */
message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
CONFIG_NSH_MMCSDMINOR);
ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio);
if (ret != OK)
{
message("nsh_archinitialize: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
return ret;
}
message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
/* Then inform the HSMCI driver if there is or is not a card in the slot. */
sdio_mediachange(sdio, sam_cardinserted(0));
#endif
return OK;
}

View file

@ -0,0 +1,204 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_spi.c
*
* Copyright (C) 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "chip.h"
#include "sam_gpio.h"
#include "sam_spi.h"
#include "sam4e-ek.h"
#if defined(CONFIG_SAM34_SPI0) || defined(CONFIG_SAM34_SPI1)
/************************************************************************************
* Definitions
************************************************************************************/
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
#undef SPI_DEBUG /* Define to enable debug */
#undef SPI_VERBOSE /* Define to enable verbose debug */
#ifdef SPI_DEBUG
# define spidbg lldbg
# ifdef SPI_VERBOSE
# define spivdbg lldbg
# else
# define spivdbg(x...)
# endif
#else
# undef SPI_VERBOSE
# define spidbg(x...)
# define spivdbg(x...)
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_spiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the SAM4E-EK board.
*
************************************************************************************/
void weak_function sam_spiinitialize(void)
{
/* The ZigBee module connects used NPCS0. However, there is not yet any
* ZigBee support.
*/
/* The touchscreen connects using NPCS2 (PC14). */
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
sam_configgpio(GPIO_TSC_NPCS2);
#endif
}
/****************************************************************************
* Name: sam_spiselect, sam_spistatus, and sam_spicmddata
*
* Description:
* These external functions must be provided by board-specific logic. They
* include:
*
* o sam_spiselect is a functions tomanage the board-specific chip selects
* o sam_spistatus and sam_spicmddata: Implementations of the status
* and cmddata methods of the SPI interface defined by struct spi_ops_
* (see include/nuttx/spi/spi.h). All other methods including
* up_spiinitialize()) are provided by common SAM3/4 logic.
*
* To use this common SPI logic on your board:
*
* 1. Provide logic in sam_boardinitialize() to configure SPI chip select
* pins.
* 2. Provide sam_spiselect() and sam_spistatus() functions in your board-
* specific logic. These functions will perform chip selection and
* status operations using GPIOs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
* sam_spicmddata() functions in your board-specific logic. This
* function will perform cmd/data selection operations using GPIOs in
* the way your board is configured.
* 3. Add a call to up_spiinitialize() in your low level application
* initialization logic
* 4. The handle returned by up_spiinitialize() may then be used to bind the
* SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
****************************************************************************/
/****************************************************************************
* Name: sam_spiselect
*
* Description:
* PIO chip select pins may be programmed by the board specific logic in
* one of two different ways. First, the pins may be programmed as SPI
* peripherals. In that case, the pins are completely controlled by the
* SPI driver. This method still needs to be provided, but it may be only
* a stub.
*
* An alternative way to program the PIO chip select pins is as a normal
* GPIO output. In that case, the automatic control of the CS pins is
* bypassed and this function must provide control of the chip select.
* NOTE: In this case, the GPIO output pin does *not* have to be the
* same as the NPCS pin normal associated with the chip select number.
*
* Input Parameters:
* devid - Identifies the (logical) device
* selected - TRUE:Select the device, FALSE:De-select the device
*
* Returned Values:
* None
*
****************************************************************************/
void sam_spiselect(enum spi_dev_e devid, bool selected)
{
/* The touchscreen chip select is implemented as a GPIO OUTPUT that must
* be controlled by this function. This is because the ADS7843E driver
* must be able to sample the device BUSY GPIO input between SPI transfers.
* However, the AD7843E will tri-state the BUSY input whenever the chip
* select is de-asserted. So the only option is to control the chip select
* manually and hold it low throughout the SPI transfer.
*/
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
if (devid == SPIDEV_TOUCHSCREEN)
{
sam_gpiowrite(GPIO_TSC_NPCS2, !selected);
}
#endif
}
/****************************************************************************
* Name: sam_spistatus
*
* Description:
* Return status information associated with the SPI device.
*
* Input Parameters:
* devid - Identifies the (logical) device
*
* Returned Values:
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
*
****************************************************************************/
uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
return 0;
}
#endif /* CONFIG_SAM34_SPI0 || CONFIG_SAM34_SPI1 */

View file

@ -0,0 +1,294 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_touchscreen.c
*
* Copyright (C) 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.
*
************************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <assert.h>
#include <errno.h>
#include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h>
#include "sam_gpio.h"
#include "sam4e-ek.h"
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_INPUT_ADS7843E
#ifndef CONFIG_INPUT
# error "Touchscreen support requires CONFIG_INPUT"
#endif
#ifndef CONFIG_SAM34_SPI0
# error "Touchscreen support requires CONFIG_SAM34_SPI0"
#endif
#ifndef CONFIG_GPIOA_IRQ
# error "Touchscreen support requires CONFIG_GPIOA_IRQ"
#endif
#ifndef CONFIG_ADS7843E_FREQUENCY
# define CONFIG_ADS7843E_FREQUENCY 500000
#endif
#ifndef CONFIG_ADS7843E_SPIDEV
# define CONFIG_ADS7843E_SPIDEV TSC_CSNUM
#endif
#if CONFIG_ADS7843E_SPIDEV != TSC_CSNUM
# error "CONFIG_ADS7843E_SPIDEV must have the same value as TSC_CSNUM"
#endif
#ifndef CONFIG_ADS7843E_DEVMINOR
# define CONFIG_ADS7843E_DEVMINOR 0
#endif
/****************************************************************************
* Static Function Prototypes
****************************************************************************/
/* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the ADS7843E 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 ADS7843E 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 ADS7843E
* driver. This structure provides information about the configuration
* of the ADS7843E 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
****************************************************************************/
/* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the ADS7843E 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 ADS7843E 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 ADS7843E interrupt */
ivdbg("Attaching %p to IRQ %d\n", isr, SAM_TCS_IRQ);
return irq_attach(SAM_TCS_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_TCS_IRQ, enable);
if (enable)
{
sam_gpioirqenable(SAM_TCS_IRQ);
}
else
{
sam_gpioirqdisable(SAM_TCS_IRQ);
}
}
static void tsc_clear(FAR struct ads7843e_config_s *state)
{
/* Does nothing */
}
static bool tsc_busy(FAR struct ads7843e_config_s *state)
{
#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE)
static bool last = (bool)-1;
#endif
/* BUSY is high impedance when CS is high (not selected). When CS is
* is low, BUSY is active high.
*/
bool busy = sam_gpioread(GPIO_TCS_BUSY);
#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE)
if (busy != last)
{
ivdbg("busy:%d\n", busy);
last = busy;
}
#endif
return busy;
}
static bool tsc_pendown(FAR struct ads7843e_config_s *state)
{
/* The /PENIRQ value is active low */
bool pendown = !sam_gpioread(GPIO_TCS_IRQ);
ivdbg("pendown:%d\n", pendown);
return pendown;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arch_tcinitialize
*
* 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 arch_tcinitialize(int minor)
{
FAR struct spi_dev_s *dev;
int ret;
idbg("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Configure and enable the ADS7843E interrupt pin as an input */
(void)sam_configgpio(GPIO_TCS_BUSY);
(void)sam_configgpio(GPIO_TCS_IRQ);
/* Configure the PIO interrupt */
sam_gpioirq(GPIO_TCS_IRQ);
/* Get an instance of the SPI interface for the touchscreen chip select */
dev = up_spiinitialize(TSC_CSNUM);
if (!dev)
{
idbg("Failed to initialize SPI chip select %d\n", TSC_CSNUM);
return -ENODEV;
}
/* Initialize and register the SPI touschscreen device */
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
if (ret < 0)
{
idbg("Failed to initialize SPI chip select %d\n", TSC_CSNUM);
/* up_spiuninitialize(dev); */
return -ENODEV;
}
return OK;
}
/****************************************************************************
* Name: arch_tcuninitialize
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* uninitialized the touchscreen device.
*
* Input Parameters:
* None
*
* Returned Value:
* None.
*
****************************************************************************/
void arch_tcuninitialize(void)
{
/* No support for un-initializing the touchscreen ADS7843E device yet */
}
#endif /* CONFIG_INPUT_ADS7843E */

View file

@ -0,0 +1,108 @@
/************************************************************************************
* configs/sam4e-ek/src/sam_usbdev.c
*
* Copyright (C) 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.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/usb/usbdev.h>
#include <nuttx/usb/usbdev_trace.h>
#include "up_arch.h"
#include "sam4e-ek.h"
/************************************************************************************
* Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: sam_usbinitialize
*
* Description:
* Called to setup USB-related GPIO pins for the SAM4E-EK board.
*
************************************************************************************/
void sam_usbinitialize(void)
{
}
/************************************************************************************
* Name: sam_usbpullup
*
* Description:
* If USB is supported and the board supports a pullup via GPIO (for USB software
* connect and disconnect), then the board software must provide sam_pullup.
* See include/nuttx/usb/usbdev.h for additional description of this method.
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
* NULL.
*
************************************************************************************/
int sam_usbpullup(FAR struct usbdev_s *dev, bool enable)
{
return 0;
}
/************************************************************************************
* Name: sam_usbsuspend
*
* Description:
* Board logic must provide the sam_usbsuspend logic if the USBDEV driver is
* used. This function is called whenever the USB enters or leaves suspend mode.
* This is an opportunity for the board logic to shutdown clocks, power, etc.
* while the USB is suspended.
*
************************************************************************************/
void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume)
{
ulldbg("resume: %d\n", resume);
}

View file

@ -0,0 +1,148 @@
/****************************************************************************
* configs/sam4e-ek/src/sam_usbmsc.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Configure and register the SAM3U MMC/SD SDIO block driver.
*
* 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 <debug.h>
#include <errno.h>
#include <nuttx/sdio.h>
#include <nuttx/mmcsd.h>
#include "sam_hsmci.h"
#ifdef CONFIG_SAM34_HSMCI
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
#endif
/* SLOT number(s) depends on the board configuration */
#undef SAM_MMCSDSLOTNO
#define SAM_MMCSDSLOTNO 0
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
# define msgflush() fflush(stdout)
# endif
#else
# ifdef CONFIG_DEBUG
# define message lowsyslog
# define msgflush()
# else
# define message printf
# define msgflush() fflush(stdout)
# endif
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: usbmsc_archinitialize
*
* Description:
* Perform architecture specific initialization
*
****************************************************************************/
int usbmsc_archinitialize(void)
{
FAR struct sdio_dev_s *sdio;
int ret;
/* First, get an instance of the SDIO interface */
message("usbmsc_archinitialize: "
"Initializing SDIO slot %d\n",
SAM_MMCSDSLOTNO);
sdio = sdio_initialize(SAM_MMCSDSLOTNO);
if (!sdio)
{
message("usbmsc_archinitialize: Failed to initialize SDIO slot %d\n",
SAM_MMCSDSLOTNO);
return -ENODEV;
}
/* Now bind the SPI interface to the MMC/SD driver */
message("usbmsc_archinitialize: "
"Bind SDIO to the MMC/SD driver, minor=%d\n",
CONFIG_SYSTEM_USBMSC_DEVMINOR1);
ret = mmcsd_slotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1, sdio);
if (ret != OK)
{
message("usbmsc_archinitialize: "
"Failed to bind SDIO to the MMC/SD driver: %d\n",
ret);
return ret;
}
message("usbmsc_archinitialize: "
"Successfully bound SDIO to the MMC/SD driver\n");
/* Then let's guess and say that there is a card in the slot. I need to check to
* see if the SAM3U10E-EVAL board supports a GPIO to detect if there is a card in
* the slot.
*/
sdio_mediachange(sdio, true);
return OK;
}
#endif /* CONFIG_SAM34_HSMCI */