From 5ab468aaa6e626a86bfb10785dee660e57d894c0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 28 Mar 2009 13:14:13 +0000 Subject: Fix examples/wget build git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1649 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 4 ++- nuttx/Documentation/NuttX.html | 6 +++-- nuttx/configs/c5471evm/defconfig | 31 ++++++++++++++++------ nuttx/configs/c5471evm/dhcpconfig | 31 ++++++++++++++++------ nuttx/configs/c5471evm/netconfig | 31 ++++++++++++++++------ nuttx/configs/c5471evm/nshconfig | 31 ++++++++++++++++------ nuttx/configs/ez80f910200kitg/ostest/defconfig | 15 +++++++++++ nuttx/configs/ez80f910200zco/dhcpd/defconfig | 15 +++++++++++ nuttx/configs/ez80f910200zco/httpd/defconfig | 15 +++++++++++ nuttx/configs/ez80f910200zco/nettest/defconfig | 17 +++++++++++- nuttx/configs/ez80f910200zco/nsh/defconfig | 15 +++++++++++ nuttx/configs/ez80f910200zco/ostest/defconfig | 15 +++++++++++ nuttx/configs/ez80f910200zco/poll/defconfig | 15 +++++++++++ nuttx/examples/README.txt | 36 +++++++++++++++++++++++++- nuttx/examples/wget/Makefile.host | 2 +- nuttx/examples/wget/target.c | 17 +++++++++++- nuttx/include/net/uip/webclient.h | 18 ++++++------- nuttx/netutils/webclient/webclient.c | 22 ++++++++-------- 18 files changed, 277 insertions(+), 59 deletions(-) (limited to 'nuttx') diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 424dacb91..e250ac7ef 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -672,4 +672,6 @@ (submitted by JPelletier). The is the same fix that was needed for the eZ80 and fixed in 0.4.2. * netutils: Added logic to support a simple wget() function - * examples/wget: Added a test for wget() + * examples/wget: Added a test for wget() (Not yet tested because of + some current networking limitations). + * lib/strncasecmp: Fix cut'n'paste error in function name. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 59e40d1d6..a592cf57a 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: March 25, 2009

+

Last Updated: March 28, 2009

@@ -1363,7 +1363,9 @@ nuttx-0.4.4 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> (submitted by JPelletier). The is the same fix that was needed for the eZ80 and fixed in 0.4.2. * netutils: Added logic to support a simple wget() function - * examples/wget: Added a test for wget() + * examples/wget: Added a test for wget() (Not yet tested because of + some current networking limitations). + * lib/strncasecmp: Fix cut'n'paste error in function name. pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/configs/c5471evm/defconfig b/nuttx/configs/c5471evm/defconfig index 8bd0ddba6..3c778d294 100644 --- a/nuttx/configs/c5471evm/defconfig +++ b/nuttx/configs/c5471evm/defconfig @@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0 CONFIG_UART_IRDA_2STOP=0 CONFIG_UART_MODEM_2STOP=0 +# +# C5471 Ethernet Driver settings +CONFIG_C5471_NET_STATS=n +ETHERNET_PHY_LU3X31T_T64=1 +ETHERNET_PHY_AC101L=2 +CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 +CONFIG_NET_C5471_AUTONEGOTIATION=y +CONFIG_NET_C5471_BASET100=n +CONFIG_NET_C5471_BASET10=n + # # General build options # @@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) # -# C5471 Ethernet Driver settings -CONFIG_C5471_NET_STATS=n -ETHERNET_PHY_LU3X31T_T64=1 -ETHERNET_PHY_AC101L=2 -CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 -CONFIG_NET_C5471_AUTONEGOTIATION=y -CONFIG_NET_C5471_BASET100=n -CONFIG_NET_C5471_BASET10=n +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) # # Stack and heap information diff --git a/nuttx/configs/c5471evm/dhcpconfig b/nuttx/configs/c5471evm/dhcpconfig index d8be43c1c..50596e337 100644 --- a/nuttx/configs/c5471evm/dhcpconfig +++ b/nuttx/configs/c5471evm/dhcpconfig @@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0 CONFIG_UART_IRDA_2STOP=0 CONFIG_UART_MODEM_2STOP=0 +# +# C5471 Ethernet Driver settings +CONFIG_C5471_NET_STATS=n +ETHERNET_PHY_LU3X31T_T64=1 +ETHERNET_PHY_AC101L=2 +CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 +CONFIG_NET_C5471_AUTONEGOTIATION=y +CONFIG_NET_C5471_BASET100=n +CONFIG_NET_C5471_BASET10=n + # # General build options # @@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) # -# C5471 Ethernet Driver settings -CONFIG_C5471_NET_STATS=n -ETHERNET_PHY_LU3X31T_T64=1 -ETHERNET_PHY_AC101L=2 -CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 -CONFIG_NET_C5471_AUTONEGOTIATION=y -CONFIG_NET_C5471_BASET100=n -CONFIG_NET_C5471_BASET10=n +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) # # Stack and heap information diff --git a/nuttx/configs/c5471evm/netconfig b/nuttx/configs/c5471evm/netconfig index fc735fa86..312b11414 100644 --- a/nuttx/configs/c5471evm/netconfig +++ b/nuttx/configs/c5471evm/netconfig @@ -119,6 +119,16 @@ CONFIG_UART_MODEM_PARITY=0 CONFIG_UART_IRDA_2STOP=0 CONFIG_UART_MODEM_2STOP=0 +# +# C5471 Ethernet Driver settings +CONFIG_C5471_NET_STATS=n +ETHERNET_PHY_LU3X31T_T64=1 +ETHERNET_PHY_AC101L=2 +CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 +CONFIG_NET_C5471_AUTONEGOTIATION=y +CONFIG_NET_C5471_BASET100=n +CONFIG_NET_C5471_BASET10=n + # # General OS setup # @@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) # -# C5471 Ethernet Driver settings -CONFIG_C5471_NET_STATS=n -ETHERNET_PHY_LU3X31T_T64=1 -ETHERNET_PHY_AC101L=2 -CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 -CONFIG_NET_C5471_AUTONEGOTIATION=y -CONFIG_NET_C5471_BASET100=n -CONFIG_NET_C5471_BASET10=n +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) # # Stack and heap information diff --git a/nuttx/configs/c5471evm/nshconfig b/nuttx/configs/c5471evm/nshconfig index 74120c99d..ac0ca2582 100644 --- a/nuttx/configs/c5471evm/nshconfig +++ b/nuttx/configs/c5471evm/nshconfig @@ -101,6 +101,16 @@ CONFIG_UART_MODEM_PARITY=0 CONFIG_UART_IRDA_2STOP=0 CONFIG_UART_MODEM_2STOP=0 +# +# C5471 Ethernet Driver settings +CONFIG_C5471_NET_STATS=n +ETHERNET_PHY_LU3X31T_T64=1 +ETHERNET_PHY_AC101L=2 +CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 +CONFIG_NET_C5471_AUTONEGOTIATION=y +CONFIG_NET_C5471_BASET100=n +CONFIG_NET_C5471_BASET10=n + # # General build options # @@ -366,14 +376,19 @@ CONFIG_EXAMPLES_NSH_DRIPADDR=(10<<24|0<<16|0<<8|1) CONFIG_EXAMPLES_NSH_NETMASK=(255<<24|255<<16|255<<8|0) # -# C5471 Ethernet Driver settings -CONFIG_C5471_NET_STATS=n -ETHERNET_PHY_LU3X31T_T64=1 -ETHERNET_PHY_AC101L=2 -CONFIG_C5471_ETHERNET_PHY=ETHERNET_PHY_LU3X31T_T64 -CONFIG_NET_C5471_AUTONEGOTIATION=y -CONFIG_NET_C5471_BASET100=n -CONFIG_NET_C5471_BASET10=n +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) # # Stack and heap information diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig index b5a04b202..51d6c3e0b 100644 --- a/nuttx/configs/ez80f910200kitg/ostest/defconfig +++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig @@ -715,6 +715,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/dhcpd/defconfig b/nuttx/configs/ez80f910200zco/dhcpd/defconfig index 5d59fabcc..6ffc90611 100644 --- a/nuttx/configs/ez80f910200zco/dhcpd/defconfig +++ b/nuttx/configs/ez80f910200zco/dhcpd/defconfig @@ -763,6 +763,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/httpd/defconfig b/nuttx/configs/ez80f910200zco/httpd/defconfig index 7e49a0011..04ad0cb99 100644 --- a/nuttx/configs/ez80f910200zco/httpd/defconfig +++ b/nuttx/configs/ez80f910200zco/httpd/defconfig @@ -771,6 +771,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/nettest/defconfig b/nuttx/configs/ez80f910200zco/nettest/defconfig index f4cc622fc..2aff4d370 100644 --- a/nuttx/configs/ez80f910200zco/nettest/defconfig +++ b/nuttx/configs/ez80f910200zco/nettest/defconfig @@ -224,7 +224,7 @@ CONFIG_HAVE_LIBM=n # semaphore. This value may be set to zero if no more than one # thread is expected to wait for a semaphore. # -CONFIG_EXAMPLE=nettest +CONFIG_EXAMPLE=wget CONFIG_DEBUG=y CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_NET=n @@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/nsh/defconfig b/nuttx/configs/ez80f910200zco/nsh/defconfig index 2cf6cf581..352542fb5 100644 --- a/nuttx/configs/ez80f910200zco/nsh/defconfig +++ b/nuttx/configs/ez80f910200zco/nsh/defconfig @@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig index 1b49f66da..95243d13f 100644 --- a/nuttx/configs/ez80f910200zco/ostest/defconfig +++ b/nuttx/configs/ez80f910200zco/ostest/defconfig @@ -739,6 +739,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/configs/ez80f910200zco/poll/defconfig b/nuttx/configs/ez80f910200zco/poll/defconfig index c73a568c7..21521105f 100644 --- a/nuttx/configs/ez80f910200zco/poll/defconfig +++ b/nuttx/configs/ez80f910200zco/poll/defconfig @@ -756,6 +756,21 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" #CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 #CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# +# Settings for examples/wget +# CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file +# CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') +# CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) +# CONFIG_EXAMPLE_WGET_IPADDR - Target IP address +# CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess +# CONFIG_EXAMPLE_WGET_NETMASK - Network mask +CONFIG_EXAMPLE_WGET_HOSTNAME="www.nuttx.org" +CONFIG_EXAMPLE_WGET_FILENAME="/index.html" +CONFIG_EXAMPLE_WGET_NOMAC=y +CONFIG_EXAMPLE_WGET_IPADDR=(10L<<24|0L<<16|0L<<8|2L) +CONFIG_EXAMPLE_WGET_DRIPADDR=(10L<<24|0L<<16|0L<<8|1L) +CONFIG_EXAMPLE_WGET_NETMASK=(255L<<24|255L<<16|255L<<8|0L) + # # Stack and heap information # diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt index 2c83dcd4f..f90dbffc5 100644 --- a/nuttx/examples/README.txt +++ b/nuttx/examples/README.txt @@ -308,7 +308,7 @@ examples/usbserial serial messages. examples/usbstorage -^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^ This example registers a block device driver, then exports the block the device using the USB storage class driver. Configuration options: @@ -347,3 +347,37 @@ examples/usbstorage Error results are always shown in the trace output +examples/wget +^^^^^^^^^^^^^ + + A simple web client example. It will obtain a file from a server using the HTTP + protocol. Settings unique to this example include: + + CONFIG_EXAMPLE_WGET_HOSTNAME - The host that serves the file + CONFIG_EXAMPLE_WGET_FILENAME - The name of the file to get (with leading '/') + CONFIG_EXAMPLE_WGET_NOMAC - (May be defined to use software assigned MAC) + CONFIG_EXAMPLE_WGET_IPADDR - Target IP address + CONFIG_EXAMPLE_WGET_DRIPADDR - Default router IP addess + CONFIG_EXAMPLE_WGET_NETMASK - Network mask + + This example uses netutils/webclient. Additional configuration settings apply + to that code as follows (but built-in defaults are probably OK): + + CONFIG_WEBCLIENT_GETMIMETYPE, CONFIG_WEBCLIENT_MAXHTTPLINE, + CONFIG_WEBCLIENT_MAXMIMESIZE, CONFIG_WEBCLIENT_MAXHOSTNAME, + CONFIG_WEBCLIENT_MAXFILENAME + + Of course, the example also requires other settings including CONFIG_NET and + CONFIG_NET_TCP. The example also uses the uIP resolver which requires CONFIG_UDP. + + WARNNG: As of this writing, wget is untested on the target platform. At present + it has been tested only in the host-based configuration described in the following + note. The primary difference is that the target version will rely on the also + untested uIP name resolver. + + NOTE: For test purposes, this example can be built as a host-based wget function. + This can be built as follows: + + cd examples/wget + make -f Makefile.host + diff --git a/nuttx/examples/wget/Makefile.host b/nuttx/examples/wget/Makefile.host index 057649902..267a4e435 100644 --- a/nuttx/examples/wget/Makefile.host +++ b/nuttx/examples/wget/Makefile.host @@ -40,7 +40,7 @@ include $(TOPDIR)/Make.defs OBJS = host.o1 webclient.o1 BIN = wget -HOSTCFLAGS += -DCONFIG_NETUTILS_WEBCLIENT_HOST=1 +HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1 HOSTCFLAGS += -I. -include hostdefs.h VPATH = $(TOPDIR)/netutils/webclient:. diff --git a/nuttx/examples/wget/target.c b/nuttx/examples/wget/target.c index 68bd47f4a..9f0b69b40 100644 --- a/nuttx/examples/wget/target.c +++ b/nuttx/examples/wget/target.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -86,6 +87,21 @@ static char g_iobuffer[512]; +/**************************************************************************** + * Private Functions + ****************************************************************************/ +/**************************************************************************** + * Name: callback + ****************************************************************************/ + +static void callback(FAR char **buffer, int offset, int datend, FAR int *buflen) +{ + (void)write(1, &((*buffer)[offset]), datend - offset); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ /**************************************************************************** * user_initialize ****************************************************************************/ @@ -106,7 +122,6 @@ void user_initialize(void) int user_start(int argc, char *argv[]) { struct in_addr addr; - static uip_ipaddr_t addr; #if defined(CONFIG_EXAMPLE_WGET_NOMAC) uint8 mac[IFHWADDRLEN]; #endif diff --git a/nuttx/include/net/uip/webclient.h b/nuttx/include/net/uip/webclient.h index 1e485559d..58664335c 100644 --- a/nuttx/include/net/uip/webclient.h +++ b/nuttx/include/net/uip/webclient.h @@ -46,7 +46,7 @@ * Included Files ****************************************************************************/ -#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST +#ifndef CONFIG_WEBCLIENT_HOST # include #endif #include @@ -55,20 +55,20 @@ * Pre-processor definitions ****************************************************************************/ -#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE -# define CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE 200 +#ifndef CONFIG_WEBCLIENT_MAXHTTPLINE +# define CONFIG_WEBCLIENT_MAXHTTPLINE 200 #endif -#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE -# define CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE 32 +#ifndef CONFIG_WEBCLIENT_MAXMIMESIZE +# define CONFIG_WEBCLIENT_MAXMIMESIZE 32 #endif -#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME -# define CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME 40 +#ifndef CONFIG_WEBCLIENT_MAXHOSTNAME +# define CONFIG_WEBCLIENT_MAXHOSTNAME 40 #endif -#ifndef CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME -# define CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME 100 +#ifndef CONFIG_WEBCLIENT_MAXFILENAME +# define CONFIG_WEBCLIENT_MAXFILENAME 100 #endif /**************************************************************************** diff --git a/nuttx/netutils/webclient/webclient.c b/nuttx/netutils/webclient/webclient.c index 25d68558b..823863a51 100644 --- a/nuttx/netutils/webclient/webclient.c +++ b/nuttx/netutils/webclient/webclient.c @@ -48,7 +48,7 @@ * Included Files ****************************************************************************/ -#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST +#ifndef CONFIG_WEBCLIENT_HOST # include # include # include @@ -107,14 +107,14 @@ struct wget_s /* Buffer HTTP header data and parse line at a time */ - char line[CONFIG_NETUTILS_WEBCLIENT_MAXHTTPLINE]; + char line[CONFIG_WEBCLIENT_MAXHTTPLINE]; int ndx; #ifdef CONFIG_WEBCLIENT_GETMIMETYPE - char mimetype[CONFIG_NETUTILS_WEBCLIENT_MAXMIMESIZE]; + char mimetype[CONFIG_WEBCLIENT_MAXMIMESIZE]; #endif - char hostname[CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME]; - char filename[CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME]; + char hostname[CONFIG_WEBCLIENT_MAXHOSTNAME]; + char filename[CONFIG_WEBCLIENT_MAXFILENAME]; }; /**************************************************************************** @@ -353,7 +353,7 @@ static inline int wget_parseheaders(struct wget_s *ws) ws->hostname[i] = 0; break; } - else if (i < CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME-1) + else if (i < CONFIG_WEBCLIENT_MAXHOSTNAME-1) { ws->hostname[i] = *dest; } @@ -362,12 +362,12 @@ static inline int wget_parseheaders(struct wget_s *ws) /* Copy the location */ - strncpy(ws->filename, dest, CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME-1); + strncpy(ws->filename, dest, CONFIG_WEBCLIENT_MAXFILENAME-1); /* Make sure that everything is NULL terminated */ - ws->hostname[CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME-1] = '\0'; - ws->filename[CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME-1] = '\0'; + ws->hostname[CONFIG_WEBCLIENT_MAXHOSTNAME-1] = '\0'; + ws->filename[CONFIG_WEBCLIENT_MAXFILENAME-1] = '\0'; nvdbg("New hostname='%s' filename='%s'\n", ws->hostname, ws->filename); } } @@ -416,8 +416,8 @@ int wget(uint16 port, memset(&ws, 0, sizeof(struct wget_s)); ws.buffer = buffer; ws.buflen = buflen; - strncpy(ws.hostname, hostname, CONFIG_NETUTILS_WEBCLIENT_MAXHOSTNAME); - strncpy(ws.filename, filename, CONFIG_NETUTILS_WEBCLIENT_MAXFILENAME); + strncpy(ws.hostname, hostname, CONFIG_WEBCLIENT_MAXHOSTNAME); + strncpy(ws.filename, filename, CONFIG_WEBCLIENT_MAXFILENAME); /* The following sequence may repeat indefinitely if we are redirected */ -- cgit v1.2.3