From 1ca7f7f940aefd82c726407f013856060e36933f Mon Sep 17 00:00:00 2001 From: dak664 Date: Fri, 3 Dec 2010 21:39:33 +0000 Subject: [PATCH] =?UTF-8?q?Apply=20patch=20from=20Tobias=20Sch=E4fer=20to?= =?UTF-8?q?=20enable=20=20hello-world=20build.=20Untested=20otherwise.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/ethernut1/Makefile.ethernut1 | 3 ++- platform/ethernut1/contiki-conf.h | 9 ++++++--- platform/ethernut1/ethernut-main.c | 27 ++++++++++++++------------- platform/ethernut2/Makefile.ethernut2 | 3 ++- platform/ethernut2/contiki-conf.h | 9 ++++++--- platform/ethernut2/ethernut-main.c | 18 +++++++++--------- 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/platform/ethernut1/Makefile.ethernut1 b/platform/ethernut1/Makefile.ethernut1 index 8c88c0dc9..726a9ee1f 100644 --- a/platform/ethernut1/Makefile.ethernut1 +++ b/platform/ethernut1/Makefile.ethernut1 @@ -1,7 +1,7 @@ CONTIKI_TARGET_DIRS = . dev apps net loader CONTIKI_TARGET_MAIN = ethernut-main.o -CONTIKI_TARGET_SOURCEFILES += slip.c rs232.c serial.c ethernut-main.c \ +CONTIKI_TARGET_SOURCEFILES += slip.c rs232.c ethernut-main.c \ rtl8019-drv.c rtl8019.c rtl8019dev.c debug.c delay.c CONTIKIAVR=$(CONTIKI)/cpu/avr @@ -9,6 +9,7 @@ CONTIKIBOARD=. APPS+=webserver telnetd #program-handler shell MCU=atmega128 +CONTIKI_PLAT_DEFS = -DF_CPU=14745600UL -DAUTO_CRC_PADDING=2 include $(CONTIKIAVR)/Makefile.avr %.u: %.$(TARGET) diff --git a/platform/ethernut1/contiki-conf.h b/platform/ethernut1/contiki-conf.h index 28b5f0e02..2e569cf22 100644 --- a/platform/ethernut1/contiki-conf.h +++ b/platform/ethernut1/contiki-conf.h @@ -108,6 +108,9 @@ architecture specific files to work). */ #define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 +/* COM port to be used for SLIP connection */ +#define SLIP_PORT RS232_PORT_0 + #define TELNETD_CONF_LINELEN 64 #define TELNETD_CONF_NUMLINES 16 @@ -153,9 +156,9 @@ architecture specific files to work). */ #define WWW_CONF_PAGEVIEW 1 -typedef unsigned char u8_t; -typedef unsigned short u16_t; -typedef unsigned long u32_t; +#define HAVE_STDINT_H +#include "avrdef.h" + typedef unsigned short uip_stats_t; diff --git a/platform/ethernut1/ethernut-main.c b/platform/ethernut1/ethernut-main.c index 50d53f25d..1ad9a4ffb 100644 --- a/platform/ethernut1/ethernut-main.c +++ b/platform/ethernut1/ethernut-main.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: ethernut-main.c,v 1.4 2008/02/10 22:41:05 oliverschmidt Exp $ + * $Id: ethernut-main.c,v 1.5 2010/12/03 21:39:33 dak664 Exp $ * */ @@ -51,41 +51,42 @@ int main(void) { uip_ipaddr_t addr; - + /* * GCC depends on register r1 set to 0. */ asm volatile ("clr r1"); - + /* * No interrupts used. */ cli(); - + /* * Enable external data and address * bus. */ MCUCR = _BV(SRE) | _BV(SRW); - + clock_init(); - rs232_init(); + rs232_init(RS232_PORT_0, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); + sei(); process_init(); - uip_ipaddr(addr, 193,10,67,152); - uip_sethostaddr(addr); + uip_ipaddr(&addr, 193,10,67,152); + uip_sethostaddr(&addr); uip_setethaddr(ethaddr); - + procinit_init(); - + autostart_start(autostart_processes); - rs232_print("Initialized\n"); - + rs232_print(RS232_PORT_0, "Initialized\n"); + while(1) { process_run(); } @@ -96,6 +97,6 @@ main(void) int putchar(int c) { - rs232_send(c); + rs232_send(RS232_PORT_0, c); return c; } diff --git a/platform/ethernut2/Makefile.ethernut2 b/platform/ethernut2/Makefile.ethernut2 index 7f2c2d531..6774a8ae2 100644 --- a/platform/ethernut2/Makefile.ethernut2 +++ b/platform/ethernut2/Makefile.ethernut2 @@ -1,10 +1,11 @@ CONTIKI_TARGET_DIRS = . dev apps net loader CONTIKI_TARGET_MAIN = ethernut-main.o -CONTIKI_SOURCEFILES += slip.c rs232.c serial.c ethernut-main.c +CONTIKI_SOURCEFILES += slip.c rs232.c ethernut-main.c CONTIKIAVR=$(CONTIKI)/cpu/avr CONTIKIBOARD=. MCU=atmega128 +CONTIKI_PLAT_DEFS = -DF_CPU=14745600UL -DAUTO_CRC_PADDING=2 include $(CONTIKIAVR)/Makefile.avr diff --git a/platform/ethernut2/contiki-conf.h b/platform/ethernut2/contiki-conf.h index 4b86d1847..132144712 100644 --- a/platform/ethernut2/contiki-conf.h +++ b/platform/ethernut2/contiki-conf.h @@ -111,6 +111,9 @@ architecture specific files to work). */ #define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 +/* COM port to be used for SLIP connection */ +#define SLIP_PORT RS232_PORT_0 + #define TELNETD_CONF_LINELEN 32 #define TELNETD_CONF_NUMLINES 16 @@ -156,9 +159,9 @@ architecture specific files to work). */ #define WWW_CONF_PAGEVIEW 1 -typedef unsigned char u8_t; -typedef unsigned short u16_t; -typedef unsigned long u32_t; +#define HAVE_STDINT_H +#include "avrdef.h" + typedef unsigned short uip_stats_t; diff --git a/platform/ethernut2/ethernut-main.c b/platform/ethernut2/ethernut-main.c index 7197584f0..d124c4496 100644 --- a/platform/ethernut2/ethernut-main.c +++ b/platform/ethernut2/ethernut-main.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: ethernut-main.c,v 1.3 2009/03/17 20:32:22 adamdunkels Exp $ + * $Id: ethernut-main.c,v 1.4 2010/12/03 21:39:33 dak664 Exp $ * */ @@ -60,7 +60,7 @@ PROCESS_THREAD(serial_test, ev, data) while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message); - rs232_print(data); + rs232_print(RS232_PORT_0, data); } PROCESS_END(); } @@ -74,23 +74,23 @@ main(void) uip_ipaddr_t addr; clock_init(); - rs232_init(); - rs232_set_input(slip_input_byte); - + rs232_init(RS232_PORT_0, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); + rs232_set_input(RS232_PORT_0, slip_input_byte); + sei(); /* Initialize drivers and event kernal */ process_init(); - uip_ipaddr(addr, 172,16,0,2); - uip_sethostaddr(addr); + uip_ipaddr(&addr, 172,16,0,2); + uip_sethostaddr(&addr); procinit_init(); autostart_start(autostart_processes); uip_fw_default(&slipif); - rs232_print_p(PSTR("Initialized\n")); - + rs232_print_p(RS232_PORT_0, PSTR("Initialized\n")); + while(1) { process_run(); }