From cdf5c8ac24374d7ee7a42af3e1dba5470c514e34 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 3 Jan 2015 10:27:04 -0600 Subject: DK-TM4C129X: Ethernet networking is now enabled by default in the NSH configuration --- nuttx/configs/dk-tm4c129x/README.txt | 262 +++++++++++++++++++++++++++++++- nuttx/configs/dk-tm4c129x/nsh/defconfig | 183 ++++++++++++++++++++-- 2 files changed, 429 insertions(+), 16 deletions(-) diff --git a/nuttx/configs/dk-tm4c129x/README.txt b/nuttx/configs/dk-tm4c129x/README.txt index 93e9c77b8..026a7ea3d 100644 --- a/nuttx/configs/dk-tm4c129x/README.txt +++ b/nuttx/configs/dk-tm4c129x/README.txt @@ -14,17 +14,31 @@ README.txt Features -------- - - Color LCD interface - - USB 2.0 OTG | Host | Device port - - TI wireless EM connection - - BoosterPack and BoosterPack XL interfaces - - Quad SSI-supported 512-Mbit Flash memory - - MicroSD slot + - Color LCD interface + - USB 2.0 OTG | Host | Device port + - TI wireless EM connection + - BoosterPack and BoosterPack XL interfaces + - Quad SSI-supported 512-Mbit Flash memory + - MicroSD slot - Expansion interface headers: MCU high-speed USB ULPI port, Ethernet RMII and MII ports External peripheral interface for - memories, parallel peripherals, and other system functions. + memories, parallel peripherals, and other system functions. - In-Circuit Debug Interface (ICDI) +Contents + - Using OpenOCD and GDB with ICDI + - Development Environment + - GNU Toolchain Options + - IDEs + - NuttX EABI "buildroot" Toolchain + - NuttX OABI "buildroot" Toolchain + - NXFLAT Toolchain + - Buttons and LEDs + - Serial Console + - Networking Support + - DK-TM4129X Configuration Options + - Configurations + Using OpenOCD and GDB with ICDI =============================== @@ -392,6 +406,209 @@ Serial Console the TM4C123 ICDI chip; Connect your external RS-232 driver at pins 13 and 16. 5v, 3.3v, AND GND are arvailable nearby at J10. +Networking Support +================== + + Networking support via the can be added to NSH by selecting the following + configuration options. +================================================== +file1: CONFIG_ARCH_HAVE_NET=y +file1: CONFIG_ARP_SEND_DELAYMSEC=20 +file1: CONFIG_ARP_SEND_MAXTRIES=5 +file1: CONFIG_IOB_BUFSIZE=196 +file1: CONFIG_IOB_NBUFFERS=36 +file1: CONFIG_IOB_NCHAINS=8 +file1: CONFIG_IOB_THROTTLE=8 +file1: CONFIG_NSOCKET_DESCRIPTORS=8 +file1: CONFIG_SCHED_HPWORK=y +file1: CONFIG_SCHED_HPWORKPERIOD=50000 +file1: CONFIG_SCHED_HPWORKPRIORITY=224 +file1: CONFIG_SCHED_HPWORKSTACKSIZE=2048 +file1: CONFIG_SCHED_WORKQUEUE=y +file1: CONFIG_SIG_SIGWORK=17 +file1: =y +file1: +file1: +file1: +file1: =y +file1: =y +file1: CONFIG_WEBCLIENT_TIMEOUT=10 +================================================== + Selecting the EMAC peripheral + ----------------------------- + + System Type -> SAM34 Peripheral Support + CONFIG_TIVA_ETHERNET=y : Enable the EMAC peripheral + + System Type -> EMAC device driver options + CONFIG_TIVA_EMAC_NRXDESC=8 : Set aside some RX and TX descriptors/buffers + CONFIG_TIVA_EMAC_NTXDESC=4 + CONFIG_TIVA_AUTONEG=y : Use autonegotiation + CONFIG_TIVA_PHY_INTERNAL=y : Use the internal PHY + CONFIG_TIVA_BOARDMAC=y : Use the MAC address in the FLASH USER0/1 registers + + Networking Support + CONFIG_NET=y : Enable Neworking + CONFIG_NET_ETHERNET=y : Support Ethernet data link + CONFIG_NET_NOINTS=y : Should operative at non-interrupt level + CONFIG_NET_SOCKOPTS=y : Enable socket operations + CONFIG_NET_MULTIBUFFER=y : Multi-packet buffer option required + CONFIG_NET_ETH_MTU=590 : Maximum packet size (MTU) 1518 is more standard + CONFIG_NET_ETH_TCP_RECVWNDO=536 : Should be the same as CONFIG_NET_ETH_MTU + CONFIG_NET_ARP=y : Enable ARP + CONFIG_NET_ARPTAB_SIZE=16 : ARP table size + CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting + CONFIG_NET_ARP_SEND=y : Send ARP request before sending data + CONFIG_NET_TCP=y : Enable TCP/IP networking + CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead + CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering + CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog + CONFIG_NET_MAX_LISTENPORTS=20 : + CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size + CONFIG_NET_UDP=y : Enable UDP networking + CONFIG_NET_BROADCAST=y : Needed for DNS name resolution + CONFIG_NET_ICMP=y : Enable ICMP networking + CONFIG_NET_ICMP_PING=y : Needed for NSH ping command + : Defaults should be okay for other options +f Application Configuration -> Network Utilities + CONFIG_NETUTILS_DNSCLIENT=y : Enable host address resolution + CONFIG_NETUTILS_TELNETD=y : Enable the Telnet daemon + CONFIG_NETUTILS_TFTPC=y : Enable TFTP data file transfers for get and put commands + CONFIG_NETUTILS_NETLIB=y : Network library support is needed + CONFIG_NETUTILS_WEBCLIENT=y : Needed for wget support + : Defaults should be okay for other options + Application Configuration -> NSH Library + CONFIG_NSH_TELNET=y : Enable NSH session via Telnet + CONFIG_NSH_IPADDR=0x0a000002 : Select a fixed IP address + CONFIG_NSH_DRIPADDR=0x0a000001 : IP address of gateway/host PC + CONFIG_NSH_NETMASK=0xffffff00 : Netmask + CONFIG_NSH_NOMAC=y : Need to make up a bogus MAC address + : Defaults should be okay for other options + + You can also enable enable the DHCPC client for networks that use + dynamically assigned address: + + Application Configuration -> Network Utilities + CONFIG_NETUTILS_DHCPC=y : Enables the DHCP client + + Networking Support + CONFIG_NET_UDP=y : Depends on broadcast UDP + + Application Configuration -> NSH Library + CONFIG_NET_BROADCAST=y + CONFIG_NSH_DHCPC=y : Tells NSH to use DHCPC, not + : the fixed addresses + + Using the network with NSH + -------------------------- + + So what can you do with this networking support? First you see that + NSH has several new network related commands: + + ifconfig, ifdown, ifup: Commands to help manage your network + get and put: TFTP file transfers + wget: HTML file transfers + ping: Check for access to peers on the network + Telnet console: You can access the NSH remotely via telnet. + + You can also enable other add on features like full FTP or a Web + Server or XML RPC and others. There are also other features that + you can enable like DHCP client (or server) or network name + resolution. + + By default, the IP address of the SAM4E-EK will be 10.0.0.2 and + it will assume that your host is the gateway and has the IP address + 10.0.0.1. + + nsh> ifconfig + eth0 HWaddr 00:e0:de:ad:be:ef at UP + IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0 + + You can use ping to test for connectivity to the host (Careful, + Window firewalls usually block ping-related ICMP traffic). On the + target side, you can: + + nsh> ping 10.0.0.1 + PING 10.0.0.1 56 bytes of data + 56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms + 56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms + 10 packets transmitted, 10 received, 0% packet loss, time 10100 ms + + NOTE: In this configuration is is normal to have packet loss > 0% + the first time you ping due to the default handling of the ARP + table. + + On the host side, you should also be able to ping the SAM4E-EK: + + $ ping 10.0.0.2 + + You can also log into the NSH from the host PC like this: + + $ telnet 10.0.0.2 + Trying 10.0.0.2... + Connected to 10.0.0.2. + Escape character is '^]'. + sh_telnetmain: Session [3] Started + + NuttShell (NSH) NuttX-6.31 + nsh> help + help usage: help [-v] [] + + [ echo ifconfig mkdir mw sleep + ? exec ifdown mkfatfs ping test + cat exit ifup mkfifo ps umount + cp free kill mkrd put usleep + cmp get losetup mh rm wget + dd help ls mount rmdir xd + df hexdump mb mv sh + + Builtin Apps: + nsh> + + NOTE: If you enable this feature, you experience a delay on booting. + That is because the start-up logic waits for the network connection + to be established before starting NuttX. In a real application, you + would probably want to do the network bringup on a separate thread + so that access to the NSH prompt is not delayed. + + This delay will be especially long if the board is not connected to + a network because additional time will be required to fail with timeout + errors. + + This delay will be especially long if the board is not connected to + a network. On the order of a minute! You will probably think that + NuttX has crashed! And then, when it finally does come up, the + network will not be available. + + Network Initialization Thread + ----------------------------- + There is a configuration option enabled by CONFIG_NSH_NETINIT_THREAD + that will do the NSH network bring-up asynchronously in parallel on + a separate thread. This eliminates the (visible) networking delay + altogether. This current implementation, however, has some limitations: + + - If no network is connected, the network bring-up will fail and + the network initialization thread will simply exit. There are no + retries and no mechanism to know if the network initialization was + successful (it could perform a network Ioctl to see if the link is + up and it now, keep trying, but it does not do that now). + + - Furthermore, there is currently no support for detecting loss of + network connection and recovery of the connection (similarly, this + thread could poll periodically for network status, but does not). + + Both of these shortcomings could be eliminated by enabling the network + monitor. See the SAMA5 configurations for a description of what it would + take to incorporate the network monitor feature. + DK-TM4129X Configuration Options ================================ @@ -541,3 +758,34 @@ Where is one of the following: CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc) CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary + + 3. Default stack sizes are large and should really be tuned to reduce + the RAM footprint: + + CONFIG_SCHED_HPWORKSTACKSIZE=2048 + CONFIG_IDLETHREAD_STACKSIZE=1024 + CONFIG_USERMAIN_STACKSIZE=2048 + CONFIG_PTHREAD_STACK_DEFAULT=2048 + CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 + CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048 + CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 + CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 + + 4. This configuration has the network enabled by default. This can be + easily disabled or reconfigured (See see the network related + configuration settings above in the section entitled "Networking"). + + NOTE: In boot-up sequence is very simple in this example; all + initialization is done sequentially (vs. in parallel) and so you will + not see the NSH prompt until all initialization is complete. The + network bring-up in particular will add some delay before the NSH + prompt appears. In a real application, you would probably want to + do the network bringup on a separate thread so that access to the + NSH prompt is not delayed. + + This delay will be especially long if the board is not connected to + a network because additional time will be required to fail with + timeout errors. This delay can be eliminated, however, if you enable + an NSH initialization option as described above in a paragraph + entitled, "Network Initialization Thread." diff --git a/nuttx/configs/dk-tm4c129x/nsh/defconfig b/nuttx/configs/dk-tm4c129x/nsh/defconfig index c852e9fb6..17ec34f3c 100644 --- a/nuttx/configs/dk-tm4c129x/nsh/defconfig +++ b/nuttx/configs/dk-tm4c129x/nsh/defconfig @@ -181,7 +181,7 @@ CONFIG_TIVA_UART0=y # CONFIG_TIVA_SSI1 is not set # CONFIG_TIVA_SSI2 is not set # CONFIG_TIVA_SSI3 is not set -# CONFIG_TIVA_ETHERNET is not set +CONFIG_TIVA_ETHERNET=y # CONFIG_TIVA_FLASH is not set # @@ -209,6 +209,17 @@ CONFIG_TIVA_HAVE_GPIOQ_IRQS=y CONFIG_TIVA_GPIOP_IRQS=y # CONFIG_TIVA_GPIOQ_IRQS is not set +# +# Tiva Ethernet Configuration +# +CONFIG_TIVA_PHY_INTERNAL=y +CONFIG_TIVA_AUTONEG=y +CONFIG_TIVA_EMAC_NRXDESC=8 +CONFIG_TIVA_EMAC_NTXDESC=4 +# CONFIG_TIVA_EMAC_ENHANCEDDESC is not set +CONFIG_TIVA_BOARDMAC=y +# CONFIG_NET_MULTICAST is not set + # # Architecture Options # @@ -363,6 +374,7 @@ CONFIG_SIG_SIGUSR1=1 CONFIG_SIG_SIGUSR2=2 CONFIG_SIG_SIGALARM=3 CONFIG_SIG_SIGCONDTIMEDOUT=16 +CONFIG_SIG_SIGWORK=17 # # POSIX Message Queue Options @@ -373,8 +385,11 @@ CONFIG_MQ_MAXMSGSIZE=32 # # Work Queue Support # -# CONFIG_SCHED_WORKQUEUE is not set -# CONFIG_SCHED_HPWORK is not set +CONFIG_SCHED_WORKQUEUE=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=224 +CONFIG_SCHED_HPWORKPERIOD=50000 +CONFIG_SCHED_HPWORKSTACKSIZE=2048 # CONFIG_SCHED_LPWORK is not set # @@ -419,6 +434,22 @@ CONFIG_DEV_NULL=y # CONFIG_MMCSD is not set # CONFIG_MTD is not set # CONFIG_EEPROM is not set +CONFIG_NETDEVICES=y + +# +# General Ethernet MAC Driver Options +# +# CONFIG_NETDEV_MULTINIC is not set + +# +# External Ethernet MAC Device Support +# +# CONFIG_NET_DM90x0 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +# CONFIG_NET_E1000 is not set +# CONFIG_NET_SLIP is not set +# CONFIG_NET_VNET is not set # CONFIG_PIPES is not set # CONFIG_PM is not set # CONFIG_POWER is not set @@ -489,9 +520,106 @@ CONFIG_UART0_2STOP=0 # # Networking Support # -# CONFIG_ARCH_HAVE_NET is not set +CONFIG_ARCH_HAVE_NET=y # CONFIG_ARCH_HAVE_PHY is not set -# CONFIG_NET is not set +CONFIG_NET=y +CONFIG_NET_NOINTS=y +# CONFIG_NET_PROMISCUOUS is not set + +# +# Driver buffer configuration +# +CONFIG_NET_MULTIBUFFER=y +CONFIG_NET_ETH_MTU=590 +CONFIG_NET_ETH_TCP_RECVWNDO=536 +CONFIG_NET_GUARDSIZE=2 + +# +# Data link support +# +# CONFIG_NET_MULTILINK is not set +CONFIG_NET_ETHERNET=y + +# +# Socket Support +# +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_SOLINGER=y + +# +# Network Device Operations +# +# CONFIG_NETDEV_PHY_IOCTL is not set + +# +# Raw Socket Support +# +# CONFIG_NET_PKT is not set + +# +# TCP/IP Networking +# +CONFIG_NET_TCP=y +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=20 +CONFIG_NET_TCP_READAHEAD=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_TCP_NWRBCHAINS=8 +CONFIG_NET_TCP_RECVDELAY=0 +CONFIG_NET_TCPBACKLOG=y +# CONFIG_NET_SENDFILE is not set + +# +# UDP Networking +# +CONFIG_NET_UDP=y +# CONFIG_NET_UDP_CHECKSUMS is not set +CONFIG_NET_UDP_CONNS=8 +CONFIG_NET_BROADCAST=y +# CONFIG_NET_RXAVAIL is not set + +# +# ICMP Networking Support +# +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y +# CONFIG_NET_PINGADDRCONF is not set + +# +# IGMPv2 Client Support +# +# CONFIG_NET_IGMP is not set + +# +# ARP Configuration +# +CONFIG_NET_ARP=y +CONFIG_NET_ARPTAB_SIZE=16 +CONFIG_NET_ARP_MAXAGE=120 +CONFIG_NET_ARP_IPIN=y +CONFIG_NET_ARP_SEND=y +CONFIG_ARP_SEND_MAXTRIES=5 +CONFIG_ARP_SEND_DELAYMSEC=20 + +# +# Network I/O Buffer Support +# +CONFIG_NET_IOB=y +CONFIG_IOB_NBUFFERS=36 +CONFIG_IOB_BUFSIZE=196 +CONFIG_IOB_NCHAINS=8 +CONFIG_IOB_THROTTLE=8 +# CONFIG_NET_ARCH_INCR32 is not set +# CONFIG_NET_ARCH_CHKSUM is not set +CONFIG_NET_STATISTICS=y + +# +# Routing Table Configuration +# +# CONFIG_NET_ROUTE is not set # # Crypto API @@ -514,6 +642,7 @@ CONFIG_UART0_2STOP=0 CONFIG_FS_MQUEUE_MPATH="/var/mqueue" # CONFIG_FS_RAMMAP is not set # CONFIG_FS_FAT is not set +# CONFIG_NFS is not set # CONFIG_FS_NXFFS is not set # CONFIG_FS_ROMFS is not set # CONFIG_FS_SMARTFS is not set @@ -627,6 +756,7 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # CONFIG_EXAMPLES_MM is not set # CONFIG_EXAMPLES_MODBUS is not set # CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_NETTEST is not set # CONFIG_EXAMPLES_NRF24L01TERM is not set CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_NULL is not set @@ -657,6 +787,7 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set # CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_DISCOVER is not set # CONFIG_EXAMPLES_WEBSERVER is not set # CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_USBTERM is not set @@ -682,15 +813,26 @@ CONFIG_EXAMPLES_NSH=y # Networking Utilities # # CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC 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_DNSCLIENT=y +CONFIG_NETUTILS_DNSCLIENT_ENTRIES=8 +CONFIG_NETUTILS_DNSCLIENT_MAXRESPONSE=96 # CONFIG_NETUTILS_SMTP is not set -# CONFIG_NETUTILS_TFTPC is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y # CONFIG_NETUTILS_THTTPD is not set -# CONFIG_NETUTILS_NETLIB is not set -# CONFIG_NETUTILS_WEBCLIENT is not set +CONFIG_NETUTILS_NETLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" +CONFIG_WEBCLIENT_TIMEOUT=10 +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_NTPCLIENT is not set +# CONFIG_NETUTILS_DISCOVER is not set +# CONFIG_NETUTILS_XMLRPC is not set # # FreeModBus @@ -746,6 +888,7 @@ CONFIG_NSH_BUILTIN_APPS=y # CONFIG_NSH_DISABLE_MOUNT is not set # CONFIG_NSH_DISABLE_MW is not set # CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set # CONFIG_NSH_DISABLE_PUT is not set # CONFIG_NSH_DISABLE_PWD is not set # CONFIG_NSH_DISABLE_RM is not set @@ -779,9 +922,31 @@ CONFIG_NSH_FILEIOSIZE=512 # Console Configuration # CONFIG_NSH_CONSOLE=y -# CONFIG_NSH_ALTCONDEV is not set # CONFIG_NSH_ARCHINIT is not set +# +# Networking Configuration +# +# CONFIG_NSH_NETINIT_THREAD is not set +CONFIG_NSH_IPADDR=0x0a000002 +CONFIG_NSH_DRIPADDR=0x0a000001 +CONFIG_NSH_NETMASK=0xffffff00 +# CONFIG_NSH_DNS is not set +# CONFIG_NSH_NOMAC is not set +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# Telnet Configuration +# +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 +# CONFIG_NSH_TELNET_LOGIN is not set + # # NxWidgets/NxWM # -- cgit v1.2.3