From 8c346dd7628daf37e635d620b1f279a3bc7b790a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 21 Jun 2015 16:39:12 +0200 Subject: [PATCH 1/3] Removed (dysfunctional) dependency generation from cc65 .co file rule. The default gcc .co file rule doesn't support dependency generation too. --- cpu/6502/Makefile.customrules-6502 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/6502/Makefile.customrules-6502 b/cpu/6502/Makefile.customrules-6502 index d477a1d15..e0953362d 100644 --- a/cpu/6502/Makefile.customrules-6502 +++ b/cpu/6502/Makefile.customrules-6502 @@ -6,7 +6,7 @@ $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) CUSTOM_RULE_C_TO_CO = 1 %.co: %.c $(TRACE_CC) - $(Q)$(CC) -c -o $@ $(CFLAGS) -DAUTOSTART_ENABLE --create-dep $(@:.o=.d) $< + $(Q)$(CC) -c -o $@ $(CFLAGS) -DAUTOSTART_ENABLE $< CUSTOM_RULE_LINK = 1 %.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a From fc9d38cabafe94d5bfa22884bc3b5483040f62fc Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 21 Jun 2015 17:53:19 +0200 Subject: [PATCH 2/3] Reduced default for number of connections. Save some memory by reducing the the default for number of connections from 10 to 2. --- cpu/6502/6502def.h | 2 +- cpu/6502/README.md | 2 +- examples/webserver/Makefile.apple2enh.defines | 2 +- examples/webserver/Makefile.atarixl.defines | 2 +- examples/webserver/Makefile.c128.defines | 2 +- examples/webserver/Makefile.c64.defines | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpu/6502/6502def.h b/cpu/6502/6502def.h index 441768153..352acc5a5 100644 --- a/cpu/6502/6502def.h +++ b/cpu/6502/6502def.h @@ -84,7 +84,7 @@ typedef unsigned short uip_stats_t; #if CONNECTIONS #define UIP_CONF_MAX_CONNECTIONS CONNECTIONS #else /* CONNECTIONS */ -#define UIP_CONF_MAX_CONNECTIONS 10 +#define UIP_CONF_MAX_CONNECTIONS 2 #endif /* CONNECTIONS */ #if WITH_LOGGING diff --git a/cpu/6502/README.md b/cpu/6502/README.md index a928d81bd..3ab367a52 100644 --- a/cpu/6502/README.md +++ b/cpu/6502/README.md @@ -37,7 +37,7 @@ high-level configuration macros may be set: - Purpose: Set the Maximum Transfer Unit size. - CONNECTIONS - - Default: 10 + - Default: 2 - Purpose: Set the maximum number of concurrent TCP connections. - ETHERNET diff --git a/examples/webserver/Makefile.apple2enh.defines b/examples/webserver/Makefile.apple2enh.defines index 70fa579ff..461a038bb 100644 --- a/examples/webserver/Makefile.apple2enh.defines +++ b/examples/webserver/Makefile.apple2enh.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_BOOST,CONNECTIONS=5 +DEFINES = CONNECTIONS=4,WITH_LOGGING,WITH_BOOST diff --git a/examples/webserver/Makefile.atarixl.defines b/examples/webserver/Makefile.atarixl.defines index a17e2c1c1..461a038bb 100644 --- a/examples/webserver/Makefile.atarixl.defines +++ b/examples/webserver/Makefile.atarixl.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_BOOST +DEFINES = CONNECTIONS=4,WITH_LOGGING,WITH_BOOST diff --git a/examples/webserver/Makefile.c128.defines b/examples/webserver/Makefile.c128.defines index ac4b8c2d8..43f7fe613 100644 --- a/examples/webserver/Makefile.c128.defines +++ b/examples/webserver/Makefile.c128.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_BOOST,WITH_PFS,CONNECTIONS=5 +DEFINES = CONNECTIONS=4,WITH_LOGGING,WITH_BOOST,WITH_PFS diff --git a/examples/webserver/Makefile.c64.defines b/examples/webserver/Makefile.c64.defines index 0c6ef3678..43f7fe613 100644 --- a/examples/webserver/Makefile.c64.defines +++ b/examples/webserver/Makefile.c64.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_BOOST,WITH_PFS +DEFINES = CONNECTIONS=4,WITH_LOGGING,WITH_BOOST,WITH_PFS From a70fbf1bbfd773da90f8e01dabac1d65ef2d0cf6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sun, 21 Jun 2015 21:07:41 +0200 Subject: [PATCH 3/3] Reconfigured Telnet server. In order to have the wget command make some sense the write command should be present too. - On the Apple][ reduction of the MTU seems to gain just enough RAM to have the (rather heavy-weight) full-blown C library file I/O working. - On the C128 there's way too little RAM so there's no wget command but only the file commands. - On the CBMs a dummy lseek() was necessary to have the read command link. --- apps/shell/shell-file.c | 28 ++++++------ .../telnet-server/Makefile.apple2enh.defines | 2 +- .../telnet-server/Makefile.atarixl.defines | 2 +- examples/telnet-server/Makefile.c128.defines | 2 +- examples/telnet-server/Makefile.c64.defines | 2 +- examples/telnet-server/telnet-server.c | 11 ++--- platform/c128/Makefile.c128 | 2 +- platform/c128/lib/lseek.c | 43 +++++++++++++++++++ platform/c64/Makefile.c64 | 2 +- platform/c64/lib/lseek.c | 43 +++++++++++++++++++ 10 files changed, 111 insertions(+), 26 deletions(-) create mode 100644 platform/c128/lib/lseek.c create mode 100644 platform/c64/lib/lseek.c diff --git a/apps/shell/shell-file.c b/apps/shell/shell-file.c index 07f6f3d5d..4376c68a3 100644 --- a/apps/shell/shell-file.c +++ b/apps/shell/shell-file.c @@ -51,7 +51,7 @@ PROCESS(shell_ls_process, "ls"); SHELL_COMMAND(ls_command, "ls", - "ls: list files", + "ls : list files", &shell_ls_process); PROCESS(shell_append_process, "append"); SHELL_COMMAND(append_command, @@ -82,19 +82,21 @@ PROCESS_THREAD(shell_ls_process, ev, data) char buf[32]; PROCESS_BEGIN(); - if(cfs_opendir(&dir, "/") != 0) { - shell_output_str(&ls_command, "Cannot open directory", ""); - } else { - totsize = 0; - while(cfs_readdir(&dir, &dirent) == 0) { - totsize += dirent.size; - sprintf(buf, "%lu ", (unsigned long)dirent.size); - /* printf("'%s'\n", dirent.name);*/ - shell_output_str(&ls_command, buf, dirent.name); + if(data != NULL) { + if(cfs_opendir(&dir, data) != 0) { + shell_output_str(&ls_command, "Cannot open directory", ""); + } else { + totsize = 0; + while(cfs_readdir(&dir, &dirent) == 0) { + totsize += dirent.size; + sprintf(buf, "%lu ", (unsigned long)dirent.size); + /* printf("'%s'\n", dirent.name);*/ + shell_output_str(&ls_command, buf, dirent.name); + } + cfs_closedir(&dir); + sprintf(buf, "%lu", (unsigned long)totsize); + shell_output_str(&ls_command, "Total size: ", buf); } - cfs_closedir(&dir); - sprintf(buf, "%lu", (unsigned long)totsize); - shell_output_str(&ls_command, "Total size: ", buf); } PROCESS_END(); } diff --git a/examples/telnet-server/Makefile.apple2enh.defines b/examples/telnet-server/Makefile.apple2enh.defines index 3dbfd3e2f..c11112c3c 100644 --- a/examples/telnet-server/Makefile.apple2enh.defines +++ b/examples/telnet-server/Makefile.apple2enh.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS +DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS,MTU_SIZE=1000 diff --git a/examples/telnet-server/Makefile.atarixl.defines b/examples/telnet-server/Makefile.atarixl.defines index 405794c09..bcd39d550 100644 --- a/examples/telnet-server/Makefile.atarixl.defines +++ b/examples/telnet-server/Makefile.atarixl.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS +DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS diff --git a/examples/telnet-server/Makefile.c128.defines b/examples/telnet-server/Makefile.c128.defines index 84c86ef72..5e74716aa 100644 --- a/examples/telnet-server/Makefile.c128.defines +++ b/examples/telnet-server/Makefile.c128.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS,CONNECTIONS=2,MTU_SIZE=500 +DEFINES = WITH_LOGGING diff --git a/examples/telnet-server/Makefile.c64.defines b/examples/telnet-server/Makefile.c64.defines index 3dbfd3e2f..bcd39d550 100644 --- a/examples/telnet-server/Makefile.c64.defines +++ b/examples/telnet-server/Makefile.c64.defines @@ -1 +1 @@ -DEFINES = WITH_LOGGING,WITH_CLIENT,WITH_DNS,WITH_PFS +DEFINES = CONNECTIONS=3,WITH_LOGGING,WITH_CLIENT,WITH_DNS diff --git a/examples/telnet-server/telnet-server.c b/examples/telnet-server/telnet-server.c index a0862886e..0164d2744 100644 --- a/examples/telnet-server/telnet-server.c +++ b/examples/telnet-server/telnet-server.c @@ -48,21 +48,18 @@ PROCESS_THREAD(shell_init_process, ev, data) { PROCESS_BEGIN(); -#ifdef __CC65__ - shell_ps_init(); - shell_netstat_init(); - shell_wget_init(); - shell_memdebug_init(); -#else /* __CC65__ */ shell_file_init(); +#ifndef __CC65__ shell_httpd_init(); shell_irc_init(); shell_ps_init(); shell_run_init(); shell_text_init(); shell_time_init(); +#endif /* !__CC65__ */ +#ifndef __C128__ shell_wget_init(); -#endif /* __CC65__ */ +#endif /* !__C128__ */ PROCESS_END(); } diff --git a/platform/c128/Makefile.c128 b/platform/c128/Makefile.c128 index 6b73ff04c..b186fac60 100644 --- a/platform/c128/Makefile.c128 +++ b/platform/c128/Makefile.c128 @@ -31,7 +31,7 @@ # Author: Oliver Schmidt # -CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S +CONTIKI_TARGET_SOURCEFILES += lseek.c pfs.S pfs_write.S CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 diff --git a/platform/c128/lib/lseek.c b/platform/c128/lib/lseek.c new file mode 100644 index 000000000..d79f9e529 --- /dev/null +++ b/platform/c128/lib/lseek.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, Swedish Institute of Computer Science. + * All rights reserved. + * + * 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * This file is part of the Contiki operating system. + * + * Author: Oliver Schmidt + * + */ + +#include + +/*-----------------------------------------------------------------------------------*/ +off_t +__fastcall__ lseek(int fd, off_t offset, int whence) +{ + return (off_t)-1; +} +/*-----------------------------------------------------------------------------------*/ diff --git a/platform/c64/Makefile.c64 b/platform/c64/Makefile.c64 index ddc94d586..ed548463b 100644 --- a/platform/c64/Makefile.c64 +++ b/platform/c64/Makefile.c64 @@ -31,7 +31,7 @@ # Author: Oliver Schmidt # -CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S +CONTIKI_TARGET_SOURCEFILES += lseek.c pfs.S pfs_write.S CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 diff --git a/platform/c64/lib/lseek.c b/platform/c64/lib/lseek.c new file mode 100644 index 000000000..d79f9e529 --- /dev/null +++ b/platform/c64/lib/lseek.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, Swedish Institute of Computer Science. + * All rights reserved. + * + * 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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. + * + * This file is part of the Contiki operating system. + * + * Author: Oliver Schmidt + * + */ + +#include + +/*-----------------------------------------------------------------------------------*/ +off_t +__fastcall__ lseek(int fd, off_t offset, int whence) +{ + return (off_t)-1; +} +/*-----------------------------------------------------------------------------------*/