From aeb95a78a14d59aad2d023053b7ae40de4e67768 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 13 Dec 2011 19:58:24 +0000 Subject: [PATCH] Fix more STM32 ethernet bugs; Fix some build issues with examples/nettest git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4171 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog.txt | 2 ++ examples/nettest/Makefile | 11 ++++++++--- examples/nettest/nettest.c | 14 +++++++++++++- examples/nettest/nettest_client.c | 7 ++++--- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e71b99a2e..fe03dae6a 100755 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -142,3 +142,5 @@ where network addresses expected (and vice versa). * apps/examples/nettest: May now be built as an NSH built-in application by setting CONFIG_NSH_BUILTIN_APPS. + * apps/examples/nettest: Correct some build issues with the nettest is + built for performance evaluation. diff --git a/examples/nettest/Makefile b/examples/nettest/Makefile index 9f9d79c77..ac07665ab 100644 --- a/examples/nettest/Makefile +++ b/examples/nettest/Makefile @@ -66,6 +66,11 @@ ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_SERVER=1 \ -DCONFIG_EXAMPLE_NETTEST_CLIENTIP="$(CONFIG_EXAMPLE_NETTEST_CLIENTIP)" endif +ifeq ($(CONFIG_EXAMPLE_NETTEST_PERFORMANCE),y) +HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_PERFORMANCE=1 +endif + + HOST_SRCS = host.c ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) @@ -89,7 +94,7 @@ STACKSIZE = 2048 VPATH = -all: .built +all: .built $(HOST_BIN) .PHONY: clean depend disclean $(TARG_AOBJS): %$(OBJEXT): %.S @@ -106,9 +111,9 @@ $(HOST_BIN): $(HOST_OBJS) @echo "LD: $@" @$(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ -.built: $(HOST_BIN) $(TARG_OBJS) +.built: $(TARG_OBJS) @( for obj in $(TARG_OBJS) ; do \ - $(call ARCHIVE, $@, $${obj}); \ + $(call ARCHIVE, $(TARG_BIN), $${obj}); \ done ; ) @touch .built diff --git a/examples/nettest/nettest.c b/examples/nettest/nettest.c index 8ce44e54a..7160e693a 100644 --- a/examples/nettest/nettest.c +++ b/examples/nettest/nettest.c @@ -53,6 +53,18 @@ * Definitions ****************************************************************************/ +/* If CONFIG_NSH_BUILTIN_APPS is defined, then it is assumed that you want + * to execute the DHCPD daemon as an NSH built-in task. + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS +# define MAIN_NAME nettest_main +# define MAIN_NAME_STRING "nettest_main" +#else +# define MAIN_NAME user_start +# define MAIN_NAME_STRING "user_start" +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -65,7 +77,7 @@ * user_start ****************************************************************************/ -int user_start(int argc, char *argv[]) +int MAIN_NAME(int argc, char *argv[]) { struct in_addr addr; #ifdef CONFIG_EXAMPLE_NETTEST_NOMAC diff --git a/examples/nettest/nettest_client.c b/examples/nettest/nettest_client.c index 23036d581..2e54f1f9b 100644 --- a/examples/nettest/nettest_client.c +++ b/examples/nettest/nettest_client.c @@ -127,15 +127,16 @@ void send_client(void) for (;;) { - nbytessent = send(sockfd, outbuf, 512, 0); + nbytessent = send(sockfd, outbuf, SENDSIZE, 0); if (nbytessent < 0) { message("client: send failed: %d\n", errno); goto errout_with_socket; } - else if (nbytessent != 512) + else if (nbytessent != SENDSIZE) { - message("client: Bad send length=%d: %d\n", nbytessent); + message("client: Bad send length=%d: %d of \n", + nbytessent, SENDSIZE); goto errout_with_socket; } }