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_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)

View file

@ -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;

View file

@ -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;
}

View file

@ -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

View file

@ -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;

View file

@ -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();
}