Update platform build for hello-world, includes patch from Tobias Schfer

This commit is contained in:
dak664 2010-12-05 20:21:19 +00:00
parent 8e38f5ee34
commit e06dada659
4 changed files with 41 additions and 11 deletions

View file

@ -1,14 +1,19 @@
CONTIKI_TARGET_DIRS = . dev apps net loader
CONTIKI_TARGET_DIRS = . dev apps net loader ../../apps/codeprop
CONTIKI_CORE=contiki-stk501-main
CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o
CONTIKI_TARGET_SOURCEFILES += rs232.c slip.c cfs-eeprom.c eeprom.c random.c \
mmem.c contiki-stk501-default-init-lowlevel.c \
contiki-stk501-default-init-net.c
contiki-stk501-default-init-net.c contiki-stk501-main.c
#elfloader-avr.c has 16/32 bit pointer problems and won't compile properly for this platform
#CONTIKI_TARGET_SOURCEFILES += codeprop.c elfloader-avr.c
CONTIKIAVR=$(CONTIKI)/cpu/avr
CONTIKIBOARD=.
CONTIKI_PLAT_DEFS = -DF_CPU=16000000UL -DAUTO_CRC_PADDING=2
MCU=atmega128
AVRDUDE_PROGRAMMER=jtag2

View file

@ -43,13 +43,19 @@
#define __CONTIKI_CONF_H__
/*
* MCU and clock rate
* MCU and clock rate. Various MCUs can be inserted in the ZIF socket.
*/
#define MCU_MHZ 16
#ifndef MCU
#define MCU atmega128
#endif
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#define PLATFORM PLATFORM_AVR
/* Cock ticks per second */
#define CLOCK_CONF_SECOND 125
#define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /*Default uses 600*/
/* COM port to be used for SLIP connection */
#define SLIP_PORT RS232_PORT_0
@ -74,10 +80,10 @@
#define UIP_CONF_BROADCAST 1
#define UIP_UDP 1
#define HAVE_STDINT_H
#include "avrdef.h"
typedef unsigned short clock_time_t;
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned long u32_t;
typedef unsigned short uip_stats_t;
typedef unsigned long off_t;

View file

@ -35,12 +35,18 @@
#include "contiki-stk501.h"
#if UIP_CONF_IPV6
#warning ********Explcit IPV4 code bypassed***********
#else
static struct uip_fw_netif slipif =
{UIP_FW_NETIF(10,100,0,0, 255,255,0,0, slip_send)};
#endif
void
init_net(void)
{
#if !UIP_CONF_IPV6
uip_ipaddr_t hostaddr;
rs232_set_input (SLIP_PORT, slip_input_byte);
@ -51,4 +57,5 @@ init_net(void)
uip_fw_register(&slipif);
// uip_fw_default(&slipif);
#endif /* UIP_CONF_IPV6 */
}

View file

@ -39,21 +39,32 @@
* Simon Barner <barner@in.tum.de
*/
/* Patched to allow hello-world ipv4 and ipv6 build */
#include <avr/pgmspace.h>
#include <stdio.h>
#include "net/uip_arp.h"
#include "contiki-stk501.h"
#include "cfs/cfs-eeprom.h"
//#include "../core/cfs/cfs-eeprom.h"
#include "cfs/cfs.h"
#include "dev/eeprom.h"
#include "lib/mmem.h"
#include "loader/symbols-def.h"
#include "loader/symtab.h"
#include "codeprop.h"
#include "../apps/codeprop/codeprop.h"
#include "sys/mt.h"
/* Uncomment to enable demonstration of multi-threading libary */
/* #define MT_DEMO */
PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process, &cfs_eeprom_process);
//TODO: What happened to cfs_eeprom_process?
//PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process, &cfs_eeprom_process);
#if UIP_CONF_IPV6
PROCINIT(&etimer_process, &tcpip_process);
#else
PROCINIT(&etimer_process, &tcpip_process, &uip_fw_process);
#endif
#ifdef MT_DEMO
static struct mt_thread threads[3];
@ -89,7 +100,8 @@ PROCESS_THREAD(contiki_stk501_main_init_process, ev, data)
mmem_init ();
/* Code propagator */
process_start(&codeprop_process, NULL);
/* TODO: The core elfloader-avr.c has 16/32 bit pointer problems so this won't build */
//process_start(&codeprop_process, NULL);
/* Multi-threading support */
#ifdef MT_DEMO