Viewtool STM32F107: Add a NSH configuration with network support

This commit is contained in:
Gregory Nutt
2013-12-25 12:14:24 -06:00
parent 0d6a046e67
commit 53bc0bce00
6 changed files with 1288 additions and 6 deletions
+2
View File
@@ -6301,4 +6301,6 @@
Sharp Memory LCD from Librae (2013-12-23).
* configs/maple/nx and src/: Add support for a custom Sharp Memory
LCD on the Maple board. From Librae (2013-12-23).
* configs/viewtool-stm32f107/netnsh: Add a NSH configuration that
supports networking with the DP83848C module installed (2013-12-25).
+139 -4
View File
@@ -25,6 +25,7 @@ Contents
- J5 - USART1
- PL-2013 USB-to-Serial Interface
- RS-232 Module
o ViewTool DP83848 Ethernet Module
o Toolchains
- NOTE about Windows native toolchains
o Configurations
@@ -118,6 +119,93 @@ Serial Console
J35 - CON2. Jumper Setting:
1 <-> 2 : Proves 3.3V to the RS-232 module.
ViewTool DP83848 Ethernet Module
================================
Ethernet Connector
------------------
----------------------------- ------------------------ --------------------------------
Connector J2 GPIO CONFIGURATION(s)
PIN SIGNAL LEGEND (no remapping) DP83848C Board
--- ------------- ----------- ------------------------ --------------------------------
1 PA0 MII_CRS N/A N/C
2 PB11/SDA2 COM_TX_EN GPIO_ETH_RMII_TX_EN TX_EN
3 PA3/LED_G2 MII_COL N/A N/C
4 PB12/NSS2 COM_TXD0 GPIO_ETH_RMII_TXD0 TXD0
5 PA1 MII_RX_CLK GPIO_ETH_RMII_REF_CLK OSCIN
6 PB13/SCK2 COM_TXD1 GPIO_ETH_RMII_TXD1 TXD1
7 PB1/CD_RESET MII_RXD3 N/A N/C
8 PC4/LCDTP COM_RXD0 GPIO_ETH_RMII_RXD0 RXD0
9 PB0/BL_PWM MII_RXD2 N/A N/C
10 PC5 COM_RXD1 GPIO_ETH_RMII_RXD1 RXD1
11 PB8/CAN1_RX MII_TXD3 N/A N/C
12 PC1/LED_R1 COM_MDC GPIO_ETH_MDC MDC
13 PC2/LED_R2 MII_TXD2 N/A N/C
14 PA2/LED_G1 COM_MDIO GPIO_ETH_MDIO MDIO
15 PC3/ONEW MII_TX_CLK N/A N/C
16 PB10/SCL2 RX_ER N/A N/C
17 PD2 GPIO1 N/A N/C
18 PA7/MOSI1 COM_RX_DV GPIO_ETH_RMII_CRS_DV CRS_DIV
19 PD3 GPIO2 N/A N/C
20 PB5 COM_PPS_OUT N/A N/C
21 VDD 3.3 VDD_3.3 N/A 3.3V
22 VDD 3.3 VDD_3.3 N/A 3.3V
23 GND GND N/A GND
24 GND GND N/A GND
--- ------------- ----------- ------------------------ --------------------------------
NOTES:
1. RMII interface is used
2. There is a 50MHz clock on board the DP83848. No MCO clock need be provided.
Configuration
-------------
System Type -> STM32 Peripheral Support
CONFIG_STM32_ETHMAC=y
System Type -> Ethernet MAC Configuration
CONFIG_STM32_RMII=y
CONFIG_STM32_AUTONEG=y
CONFIG_STM32_PHYADDR=1
CONFIG_STM32_PHYSR=16
CONFIG_STM32_PHYSR_SPEED=0x0002
CONFIG_STM32_PHYSR_100MBPS=0x0000
CONFIG_STM32_PHYSR_MODE=0x0004
CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
CONFIG_STM32_RMII_EXTCLK=y
Device Drivers -> Networking Devices
CONFIG_NETDEVICES=y
CONFIG_ETH0_PHY_DP83848C=y
Networking (required)
CONFIG_NET=y
CONFIG_NET_MULTIBUFFER=y
CONFIG_NSH_NOMAC=y
Networking (recommended/typical)
CONFIG_NSOCKET_DESCRIPTORS=10
CONFIG_NET_SOCKOPTS=y
CONFIG_NET_BUFSIZE=650
CONFIG_NET_RECEIVE_WINDOW=650
CONFIG_NET_TCP_READAHEAD_BUFSIZE=650
CONFIG_NET_TCP=y
CONFIG_NET_NTCP_READAHEAD_BUFFERS=8
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CONNS=8
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_PING=y
CONFIG_NSH_DRIPADDR=0x0a000001
CONFIG_NSH_IPADDR=0x0a000002
CONFIG_NSH_NETMASK=0xffffff00
Toolchains
==========
@@ -224,17 +312,64 @@ Configurations
Configuration Sub-directories
-----------------------------
nsh:
netnsh:
This configuration directory provide the basuic NuttShell (NSH).
This configuration directory provide the NuttShell (NSH) with
networking support.
NOTES:
1. This configuration uses the default USART1 serial console. That
1. This configuration will work only on the version the viewtool
board with the the STM32F107VCT6 installed. If you have a board
with the STM32F103VCT6 installed, please use the nsh configuration
described below.
2. There is no PHY on the base viewtool stm32f107 board. You must
also have the "ViewTool DP83848 Ethernet Module" installed on J2
in order to support networking.
3. Since networking is enabled, you will see some boot-up delays when
the network connection is established. These delays can be quite
large is no network is attached (A production design to bring up the
network asynchronously to avoid these start up delays).
4. This configuration uses the default USART1 serial console. That
is easily changed by reconfiguring to (1) enable a different
serial peripheral, and (2) selecting that serial peripheral as
the console device.
2. By default, this configuration is set up to build on Windows
5. By default, this configuration is set up to build on Windows
under either a Cygwin or MSYS environment using a recent, Windows-
native, generic ARM EABI GCC toolchain (such as the CodeSourcery
toolchain). Both the build environment and the toolchain
selection can easily be changed by reconfiguring:
CONFIG_HOST_WINDOWS=y : Windows operating system
CONFIG_WINDOWS_CYGWIN=y : POSIX environment under windows
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
STATUS: As of this writing (2013-12-25), the STM32 communicates with the
PHY, but the DP83848 fails to return good linkstatus from the STM32.
nsh:
This configuration directory provide the basic NuttShell (NSH).
NOTES:
1. This configuration will work with either the version of the board
with STM32F107VCT6 or STM32F103VCT6 installed. The default
configuration is for the STM32F107VCT6. To use this configuration
with a STM32F103VCT6, it would have to be modified as follows:
System Type -> STM32 Configuration Options
CONFIG_ARCH_CHIP_STM32F103VCT6=y
CONFIG_ARCH_CHIP_STM32F107VC=n
2. This configuration uses the default USART1 serial console. That
is easily changed by reconfiguring to (1) enable a different
serial peripheral, and (2) selecting that serial peripheral as
the console device.
3. By default, this configuration is set up to build on Windows
under either a Cygwin or MSYS environment using a recent, Windows-
native, generic ARM EABI GCC toolchain (such as the CodeSourcery
toolchain). Both the build environment and the toolchain
+117
View File
@@ -0,0 +1,117 @@
############################################################################
# configs/viewtool-stm32f107/netnsh/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(CONFIG_STM32_DFU),y)
LDSCRIPT = dfu.ld
else
LDSCRIPT = flash.ld
endif
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/$(LDSCRIPT)}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
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-gotoff.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
# configs/viewtool-stm32f107/netnsh/setenv.sh
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
if [ "$_" = "$0" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
WD=`pwd`
if [ ! -x "setenv.sh" ]; then
echo "This script must be executed from the top-level NuttX build directory"
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then
export PATH_ORIG="${PATH}"
fi
# This is the Cygwin path to the location where I installed the RIDE
# toolchain under windows. You will also have to edit this if you install
# the RIDE toolchain in any other location
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin"
# This is the Cygwin path to the location where I installed the CodeSourcery
# toolchain under windows. You will also have to edit this if you install
# the CodeSourcery toolchain in any other location
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
# These are the Cygwin paths to the locations where I installed the Atollic
# toolchain under windows. You will also have to edit this if you install
# the Atollic toolchain in any other location. /usr/bin is added before
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
# at those locations as well.
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
# This is the Cygwin path to the location where I build the buildroot
# toolchain.
#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+2 -2
View File
@@ -296,10 +296,10 @@ void stm32_setled(int led, bool ledon)
void stm32_setleds(uint8_t ledset)
{
#ifdef CONFIG_ARCH_LEDS
led_offbits(ledset & ~BOARD_LED4_BIT);
led_onbits(ledset & ~BOARD_LED4_BIT);
led_offbits(~(ledset | BOARD_LED4_BIT));
#else
led_offbits(ledset);
led_onbits(ledset);
led_offbits(~ledset);
#endif
}