diff --git a/apps/codeprop/codeprop-tmp.c b/apps/codeprop/codeprop-tmp.c index 662cf94b2..d766d6bf2 100644 --- a/apps/codeprop/codeprop-tmp.c +++ b/apps/codeprop/codeprop-tmp.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: codeprop-tmp.c,v 1.3 2006/12/18 15:17:47 fros4943 Exp $ + * @(#)$Id: codeprop-tmp.c,v 1.4 2007/03/18 13:15:01 ksb Exp $ */ /** \addtogroup esb @@ -115,6 +115,7 @@ struct codeprop_udphdr { struct codeprop_tcphdr { u16_t len; + u16_t pad; }; static void uipcall(void *state); diff --git a/apps/codeprop/codeprop.h b/apps/codeprop/codeprop.h index acec1b436..4b5f967db 100644 --- a/apps/codeprop/codeprop.h +++ b/apps/codeprop/codeprop.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: codeprop.h,v 1.1 2006/06/18 07:44:36 adamdunkels Exp $ + * @(#)$Id: codeprop.h,v 1.2 2007/03/18 13:15:01 ksb Exp $ */ #ifndef __CODEPROP_H__ #define __CODEPROP_H__ @@ -39,6 +39,7 @@ struct codeprop_tcphdr { u16_t len; + u16_t pad; }; PROCESS_NAME(codeprop_process); diff --git a/cpu/at91sam7s/loader/codeprop-otf.c b/cpu/at91sam7s/loader/codeprop-otf.c index 38e6b421f..263982487 100644 --- a/cpu/at91sam7s/loader/codeprop-otf.c +++ b/cpu/at91sam7s/loader/codeprop-otf.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: codeprop-otf.c,v 1.1 2007/03/07 16:07:26 ksb Exp $ + * @(#)$Id: codeprop-otf.c,v 1.2 2007/03/18 13:15:02 ksb Exp $ */ /** \addtogroup esb @@ -117,6 +117,7 @@ struct codeprop_udphdr { struct codeprop_tcphdr { u16_t len; + u16_t pad; }; static void uipcall(void *state); @@ -366,7 +367,7 @@ PT_THREAD(recv_udpthread(struct pt *pt)) } /*---------------------------------------------------------------------*/ -#define CODEPROP_TCPHDR_SIZE 2 +#define CODEPROP_TCPHDR_SIZE sizeof(struct codeprop_tcphdr) static PT_THREAD(recv_tcpthread(struct pt *pt)) diff --git a/platform/stepper-robot/Makefile b/platform/stepper-robot/Makefile index 35ee47aca..09972d548 100644 --- a/platform/stepper-robot/Makefile +++ b/platform/stepper-robot/Makefile @@ -33,10 +33,13 @@ CFLAGS+= -I stepper cfs-ram.o: CFLAGS+= -DCFS_RAM_CONF_SIZE=4096 -all: $(KERNELS) +all: $(KERNELS) codeprop sys-tst.elf: sys-tst.o $(ARCH) $(SYSTEM) robot-main-syms.elf: robot-main.o stepper-process.o $(ARCH) $(SYSTEM) $(SYSLIB) $(UIP) $(UIPDRIVERS) $(STEPPER) $(CODEPROP) $(DEBUG_IO) +codeprop: $(CONTIKI)/tools/codeprop.c + cc -g -Wall $< -o $@ + include $(CONTIKI)/cpu/at91sam7s/Makefile.at91sam7s diff --git a/tools/codeprop.c b/tools/codeprop.c index ff4d8208c..3e66bf080 100644 --- a/tools/codeprop.c +++ b/tools/codeprop.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: codeprop.c,v 1.2 2006/08/02 14:33:37 bg- Exp $ + * @(#)$Id: codeprop.c,v 1.3 2007/03/18 13:15:00 ksb Exp $ */ #include #include @@ -48,6 +48,9 @@ #include #include +/* Should be included from codeprop.h, but the include paths in the makefiles + isn't set up for that. */ +#define HDR_SIZE 4 int main(int argc, char **argv) { @@ -96,7 +99,7 @@ main(int argc, char **argv) { char buf[64000]; int len; - len = read(fd, &buf[2], sizeof(buf) - 2); + len = read(fd, &buf[HDR_SIZE], sizeof(buf) - HDR_SIZE); if(len == 0) { printf("File successfully sent (%d bytes)\n", total); len = read(s, buf, sizeof(buf)); @@ -118,7 +121,7 @@ main(int argc, char **argv) { total += len; buf[0] = len >> 8; buf[1] = len & 0xff; - if(write(s, buf, len + 2) == -1) { + if(write(s, buf, len + HDR_SIZE) == -1) { perror("network send failed"); exit(1); }