Apply patch from Tobias Schfer to enable hello-world build. Untested otherwise.

This commit is contained in:
dak664 2010-12-03 21:39:33 +00:00
parent 0f6c089179
commit 1ca7f7f940
6 changed files with 39 additions and 30 deletions

View file

@ -1,7 +1,7 @@
CONTIKI_TARGET_DIRS = . dev apps net loader CONTIKI_TARGET_DIRS = . dev apps net loader
CONTIKI_TARGET_MAIN = ethernut-main.o 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 rtl8019-drv.c rtl8019.c rtl8019dev.c debug.c delay.c
CONTIKIAVR=$(CONTIKI)/cpu/avr CONTIKIAVR=$(CONTIKI)/cpu/avr
@ -9,6 +9,7 @@ CONTIKIBOARD=.
APPS+=webserver telnetd #program-handler shell APPS+=webserver telnetd #program-handler shell
MCU=atmega128 MCU=atmega128
CONTIKI_PLAT_DEFS = -DF_CPU=14745600UL -DAUTO_CRC_PADDING=2
include $(CONTIKIAVR)/Makefile.avr include $(CONTIKIAVR)/Makefile.avr
%.u: %.$(TARGET) %.u: %.$(TARGET)

View file

@ -108,6 +108,9 @@ architecture specific files to work). */
#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 #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_LINELEN 64
#define TELNETD_CONF_NUMLINES 16 #define TELNETD_CONF_NUMLINES 16
@ -153,9 +156,9 @@ architecture specific files to work). */
#define WWW_CONF_PAGEVIEW 1 #define WWW_CONF_PAGEVIEW 1
typedef unsigned char u8_t; #define HAVE_STDINT_H
typedef unsigned short u16_t; #include "avrdef.h"
typedef unsigned long u32_t;
typedef unsigned short uip_stats_t; typedef unsigned short uip_stats_t;

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki OS * 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) main(void)
{ {
uip_ipaddr_t addr; uip_ipaddr_t addr;
/* /*
* GCC depends on register r1 set to 0. * GCC depends on register r1 set to 0.
*/ */
asm volatile ("clr r1"); asm volatile ("clr r1");
/* /*
* No interrupts used. * No interrupts used.
*/ */
cli(); cli();
/* /*
* Enable external data and address * Enable external data and address
* bus. * bus.
*/ */
MCUCR = _BV(SRE) | _BV(SRW); MCUCR = _BV(SRE) | _BV(SRW);
clock_init(); clock_init();
rs232_init(); rs232_init(RS232_PORT_0, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
sei(); sei();
process_init(); process_init();
uip_ipaddr(addr, 193,10,67,152); uip_ipaddr(&addr, 193,10,67,152);
uip_sethostaddr(addr); uip_sethostaddr(&addr);
uip_setethaddr(ethaddr); uip_setethaddr(ethaddr);
procinit_init(); procinit_init();
autostart_start(autostart_processes); autostart_start(autostart_processes);
rs232_print("Initialized\n"); rs232_print(RS232_PORT_0, "Initialized\n");
while(1) { while(1) {
process_run(); process_run();
} }
@ -96,6 +97,6 @@ main(void)
int int
putchar(int c) putchar(int c)
{ {
rs232_send(c); rs232_send(RS232_PORT_0, c);
return c; return c;
} }

View file

@ -1,10 +1,11 @@
CONTIKI_TARGET_DIRS = . dev apps net loader CONTIKI_TARGET_DIRS = . dev apps net loader
CONTIKI_TARGET_MAIN = ethernut-main.o 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 CONTIKIAVR=$(CONTIKI)/cpu/avr
CONTIKIBOARD=. CONTIKIBOARD=.
MCU=atmega128 MCU=atmega128
CONTIKI_PLAT_DEFS = -DF_CPU=14745600UL -DAUTO_CRC_PADDING=2
include $(CONTIKIAVR)/Makefile.avr include $(CONTIKIAVR)/Makefile.avr

View file

@ -111,6 +111,9 @@ architecture specific files to work). */
#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 #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_LINELEN 32
#define TELNETD_CONF_NUMLINES 16 #define TELNETD_CONF_NUMLINES 16
@ -156,9 +159,9 @@ architecture specific files to work). */
#define WWW_CONF_PAGEVIEW 1 #define WWW_CONF_PAGEVIEW 1
typedef unsigned char u8_t; #define HAVE_STDINT_H
typedef unsigned short u16_t; #include "avrdef.h"
typedef unsigned long u32_t;
typedef unsigned short uip_stats_t; typedef unsigned short uip_stats_t;

View file

@ -29,7 +29,7 @@
* *
* This file is part of the Contiki OS * 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) { while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message); PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message);
rs232_print(data); rs232_print(RS232_PORT_0, data);
} }
PROCESS_END(); PROCESS_END();
} }
@ -74,23 +74,23 @@ main(void)
uip_ipaddr_t addr; uip_ipaddr_t addr;
clock_init(); clock_init();
rs232_init(); rs232_init(RS232_PORT_0, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
rs232_set_input(slip_input_byte); rs232_set_input(RS232_PORT_0, slip_input_byte);
sei(); sei();
/* Initialize drivers and event kernal */ /* Initialize drivers and event kernal */
process_init(); process_init();
uip_ipaddr(addr, 172,16,0,2); uip_ipaddr(&addr, 172,16,0,2);
uip_sethostaddr(addr); uip_sethostaddr(&addr);
procinit_init(); procinit_init();
autostart_start(autostart_processes); autostart_start(autostart_processes);
uip_fw_default(&slipif); uip_fw_default(&slipif);
rs232_print_p(PSTR("Initialized\n")); rs232_print_p(RS232_PORT_0, PSTR("Initialized\n"));
while(1) { while(1) {
process_run(); process_run();
} }