Add nettest config for str-p711 using enc28j60

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2642 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-05-01 19:21:06 +00:00
parent 51c5e75ac0
commit a831ff8459
8 changed files with 1156 additions and 9 deletions
+6
View File
@@ -1099,3 +1099,9 @@
5.5 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* drivers/net/enc28j60.c - Microchip ENC28J60 SPI ethernet chip driver.
(untested on original check-in).
* configs/olimex-str7p11/nettest - examples/nettest configuration using
the ENC28J60 driver on the Olimex STMicro STR-P711.
(unverified on original check-in)
+7 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: April 23, 2010</p>
<p>Last Updated: May 1, 2010</p>
</td>
</tr>
</table>
@@ -1681,6 +1681,12 @@ buildroot-1.8 2009-12-21 &lt;spudmonkey@racsa.co.cr&gt;
<ul><pre>
nuttx-5.5 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* drivers/net/enc28j60.c - Microchip ENC28J60 SPI ethernet chip driver.
(untested on original check-in).
* configs/olimex-str7p11/nettest - examples/nettest configuration using
the ENC28J60 driver on the Olimex STMicro STR-P711.
(unverified on original check-in)
pascal-2.1 2010-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-1.9 2010-xx-xx <spudmonkey@racsa.co.cr>
+38
View File
@@ -228,9 +228,47 @@ GENERAL STEPS:
The same commands from the telnet interface can now be accessed through the
'monitor' command, e.g. 'monitor help'
ENC28J60 Module
^^^^^^^^^^^^^^^
Module CON5 QFN ENC2860 Description
--------------- -------------------------------------------------------
1 J8-1 NET CS 5 ~CS Chip select input pin for SPI interface (active low)
2 2 SCK 4 SCK Clock in pin for SPI interface
3 3 MOSI 3 SI Data in pin for SPI interface
4 4 MISO 2 SO Data out pin for SPI interface
5 5 GND -- --- ---
10 J9-1 3V3 -- --- ---
9 2 WOL 1 ~WOL Unicast WOL filter
8 3 NET INT 28 ~INT Interrupt output pin (active low)
7 4 CLKOUT 27 CLKOUT Programmable clock output pin
6 5 NET RST 6 ~RESET Active-low device Reset input
For the Olimex STR-P711, the ENC28J60 module is placed on SPI1 (with
the MMC slot) and uses P0.0 for CS, P0.1 for an interrupt, and P0.2 as
a reset:
Module CON5 Olimex STR-P711 Connection
--------------- -------------------------------------------------------
1 J8-1 NET CS SPI0-4 P0.0 P0.0/S0.MISO/U3.TX
2 2 SCK SPI1-5 SCLK1 P0.6/S1.SCLK
3 3 MOSI SPI1-3 MOSI1 P0.5/S1.MOSI
4 4 MISO SPI1-4 MISO1 P0.4/S1.MISO
5 5 GND SPI1-1 GND
10 J9-1 3V3 SPI1-6 3.3V
9 2 WOL NC
8 3 NET INT SPI0-3 P0.1 P0.1/S0.MOSI/U3.RX
7 4 CLKOUT NC
6 5 NET RST SPI0-5 P0.2 P0.2/S0
Configurations:
---------------
nettest:
This configuration directory may be used to enable networking using the
an Microchip ENC28J60 SPI ethernet module (see above for connection to
STR-P711.
nsh:
Configures the NuttShell (nsh) located at examples/nsh. The
Configuration enables both the serial and telnetd NSH interfaces.
+160
View File
@@ -0,0 +1,160 @@
##############################################################################
# configs/olimex-strp711/nettest/Make.defs
#
# Copyright (C) 2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
##############################################################################
include ${TOPDIR}/.config
# The default value for CROSSDEV can be overridden from the make command line:
# make -- Will build for the NuttX buildroot toolchain
# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain
# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain
# make CROSSDEV=arm-elf- -- Will build for the NuttX buildroot toolchain
CROSSDEV = arm-elf-
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
HOSTOS = ${shell uname -o}
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 ($(ARCHCCMAJOR),4)
ifneq ($(HOSTOS),Cygwin)
OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment
endif
endif
ifeq ($(CROSSDEV),arm-elf-)
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)/nettest/ld.script
MAXOPTIMIZATION = -Os
else
WINTOOL = y
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nettest/ld.script}"
MAXOPTIMIZATION = -O2
endif
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ifeq ($(ARCHCCMAJOR),4)
ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft
else
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \
$(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) \
-T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld \
-no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
define PREPROCESS
@echo "CPP: $1->$2"
@$(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+122
View File
@@ -0,0 +1,122 @@
/****************************************************************************
* configs/olimex-strp711/nettest/ld.script
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* The str71x has 256Kb of non-volatile memory beginning at address
* 0x4000:0000 for program storage (Bank0, an addition 16Kb is available
* for data storage in Bank1). The OS entry point is via the reset vector
* at address 0x00000000 where the FLASH is remapped at reset.
*
* The str71x has 64Kb of on-chip static RAM beginning at address
* 0x2000:0000. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
/* The STR711 has 256Kb of FLASH beginning at address 0x4000:0000 and 64Kb
* of SRAM beginning at address 0x2000:0000
*/
MEMORY
{
flash (rx) : ORIGIN = 0x40000000, LENGTH = 256K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
/* This is where the .data section is relocated for execution out
* FLASH. The .data section will be relocated from _eronly
* to _sdata at boot time.
*/
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} >sram
.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) }
}
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# configs/olimex-strp711/nettest/setenv.sh
#
# Copyright (C) 2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
WD=`pwd`
export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
export STR41XSCRIPTS="$WD/configs/olimex-strp711/scripts"
export PATH="${BUILDROOT_BIN}:${STR41XSCRIPTS}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+9 -8
View File
@@ -75,6 +75,7 @@
/* All SPI settings can be specifed in the configuration. If not, some
* defaults will be provided.
*
* CONFIG_NET_ENC28J60 - Enabled ENC28J60 support
* CONFIG_ENC28J60_OWNBUS - Set if the ENC28J60 is the only active device on
* the SPI bus. No locking or SPI configuration will be performed. All
* transfers will be performed from the ENC2J60 interrupt handler.
@@ -82,6 +83,12 @@
* CONFIG_ENC28J60_FREQUENCY - Define to use a different bus frequency
* CONFIG_ENC28J60_NINTERFACES - Specifies the number of physical ENC28J60
* devices that will be supported.
* CONFIG_ENC28J60_STATS - Collect network statistics
* CONFOG_ENC28J60_HALFDUPPLEX - Default is full duplex
*/
/* The ENC28J60 spec says that is supports SPI mode 0,0 only. However,
* somtimes you need to tinker with these things.
*/
#ifndef CONFIG_ENC28J60_SPIMODE
@@ -358,7 +365,7 @@ static void enc_select(FAR struct spi_dev_s *spi)
SPI_SETMODE(spi, CONFIG_ENC28J60_SPIMODE);
SPI_SETBITS(spi, 8);
#ifdef CONFIG_ENC28J60_FREQUENCY
SPI_SETFREQUENCY(spi, CONFIG_ENC28J60_FREQUENCY)
SPI_SETFREQUENCY(spi, CONFIG_ENC28J60_FREQUENCY);
#endif
}
#endif
@@ -909,12 +916,6 @@ static int enc_transmit(FAR struct enc_driver_s *priv)
*/
(void)wd_start(priv->txtimeout, ENC_TXTIMEOUT, enc_txtimeout, 1, (uint32_t)priv);
/* Increment statistics */
#ifdef CONFIG_ENC28J60_STATS
priv->txqueued++;
#endif
return OK;
}
@@ -1425,7 +1426,7 @@ static void enc_worker(FAR void *arg)
if (pktcnt > 0)
{
#ifdef CONFIG_ENC28J60_STATS
if (pkcnt > priv->stats.maxpktcnt)
if (pktcnt > priv->stats.maxpktcnt)
{
priv->stats.maxpktcnt = pktcnt;
}