From 614277dd7cd470e41febd6fb16b9f8e71d55cdb6 Mon Sep 17 00:00:00 2001 From: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> Date: Sat, 28 Mar 2009 13:14:13 +0000 Subject: [PATCH] Fix examples/wget build git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1649 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 4 ++- Documentation/NuttX.html | 6 ++-- configs/c5471evm/defconfig | 31 ++++++++++++++------ configs/c5471evm/dhcpconfig | 31 ++++++++++++++------ configs/c5471evm/netconfig | 31 ++++++++++++++------ configs/c5471evm/nshconfig | 31 ++++++++++++++------ configs/ez80f910200kitg/ostest/defconfig | 15 ++++++++++ configs/ez80f910200zco/dhcpd/defconfig | 15 ++++++++++ configs/ez80f910200zco/httpd/defconfig | 15 ++++++++++ configs/ez80f910200zco/nettest/defconfig | 17 ++++++++++- configs/ez80f910200zco/nsh/defconfig | 15 ++++++++++ configs/ez80f910200zco/ostest/defconfig | 15 ++++++++++ configs/ez80f910200zco/poll/defconfig | 15 ++++++++++ examples/README.txt | 36 +++++++++++++++++++++++- examples/wget/Makefile.host | 2 +- examples/wget/target.c | 17 ++++++++++- include/net/uip/webclient.h | 18 ++++++------ netutils/webclient/webclient.c | 22 +++++++-------- 18 files changed, 277 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 424dacb91b..e250ac7ef9 100644 --- a/ChangeLog +++ b/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/Documentation/NuttX.html b/Documentation/NuttX.html index 59e40d1d67..a592cf57a5 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -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: March 25, 2009</p> + <p>Last Updated: March 28, 2009</p> </td> </tr> </table> @@ -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/configs/c5471evm/defconfig b/configs/c5471evm/defconfig index 8bd0ddba61..3c778d294c 100644 --- a/configs/c5471evm/defconfig +++ b/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/configs/c5471evm/dhcpconfig b/configs/c5471evm/dhcpconfig index d8be43c1ca..50596e3370 100644 --- a/configs/c5471evm/dhcpconfig +++ b/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/configs/c5471evm/netconfig b/configs/c5471evm/netconfig index fc735fa866..312b11414c 100644 --- a/configs/c5471evm/netconfig +++ b/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/configs/c5471evm/nshconfig b/configs/c5471evm/nshconfig index 74120c99d9..ac0ca2582c 100644 --- a/configs/c5471evm/nshconfig +++ b/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/configs/ez80f910200kitg/ostest/defconfig b/configs/ez80f910200kitg/ostest/defconfig index b5a04b2024..51d6c3e0be 100644 --- a/configs/ez80f910200kitg/ostest/defconfig +++ b/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/configs/ez80f910200zco/dhcpd/defconfig b/configs/ez80f910200zco/dhcpd/defconfig index 5d59fabcc2..6ffc906119 100644 --- a/configs/ez80f910200zco/dhcpd/defconfig +++ b/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/configs/ez80f910200zco/httpd/defconfig b/configs/ez80f910200zco/httpd/defconfig index 7e49a0011f..04ad0cb998 100644 --- a/configs/ez80f910200zco/httpd/defconfig +++ b/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/configs/ez80f910200zco/nettest/defconfig b/configs/ez80f910200zco/nettest/defconfig index f4cc622fc9..2aff4d370e 100644 --- a/configs/ez80f910200zco/nettest/defconfig +++ b/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/configs/ez80f910200zco/nsh/defconfig b/configs/ez80f910200zco/nsh/defconfig index 2cf6cf5812..352542fb53 100644 --- a/configs/ez80f910200zco/nsh/defconfig +++ b/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/configs/ez80f910200zco/ostest/defconfig b/configs/ez80f910200zco/ostest/defconfig index 1b49f66dab..95243d13fd 100644 --- a/configs/ez80f910200zco/ostest/defconfig +++ b/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/configs/ez80f910200zco/poll/defconfig b/configs/ez80f910200zco/poll/defconfig index c73a568c73..21521105fa 100644 --- a/configs/ez80f910200zco/poll/defconfig +++ b/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/examples/README.txt b/examples/README.txt index 2c83dcd4f7..f90dbffc54 100644 --- a/examples/README.txt +++ b/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/examples/wget/Makefile.host b/examples/wget/Makefile.host index 057649902b..267a4e435c 100644 --- a/examples/wget/Makefile.host +++ b/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/examples/wget/target.c b/examples/wget/target.c index 68bd47f4a6..9f0b69b40f 100644 --- a/examples/wget/target.c +++ b/examples/wget/target.c @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -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/include/net/uip/webclient.h b/include/net/uip/webclient.h index 1e485559da..58664335c6 100644 --- a/include/net/uip/webclient.h +++ b/include/net/uip/webclient.h @@ -46,7 +46,7 @@ * Included Files ****************************************************************************/ -#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST +#ifndef CONFIG_WEBCLIENT_HOST # include <nuttx/config.h> #endif #include <sys/types.h> @@ -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/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index 25d68558bf..823863a510 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -48,7 +48,7 @@ * Included Files ****************************************************************************/ -#ifndef CONFIG_NETUTILS_WEBCLIENT_HOST +#ifndef CONFIG_WEBCLIENT_HOST # include <nuttx/config.h> # include <nuttx/compiler.h> # include <debug.h> @@ -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 */ -- GitLab