mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Removed the stk500/stk501 platforms
This commit is contained in:
parent
d68ce09fd5
commit
eb99534c43
@ -1,7 +0,0 @@
|
||||
all: contiki-stk500-main.out
|
||||
upload: contiki-stk500-main.u
|
||||
|
||||
CONTIKI=../..
|
||||
TARGET=stk500
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
@ -1,19 +0,0 @@
|
||||
CONTIKI_TARGET_DIRS = . dev apps loader
|
||||
CONTIKI_TARGET_MAIN = contiki-stk500-main.o
|
||||
|
||||
CONTIKI_SOURCEFILES += rs232.c contiki-stk500-main.c
|
||||
|
||||
CONTIKI_NO_NET=1
|
||||
CONTIKIAVR=$(CONTIKI)/cpu/avr
|
||||
CONTIKIBOARD=.
|
||||
|
||||
//MCU=atmega8
|
||||
MCU=atmega8515
|
||||
//MCU=atmega644
|
||||
//MCU=atmega328p
|
||||
//MCU=atmega16
|
||||
//MCU=atmega32
|
||||
|
||||
CONTIKI_PLAT_DEFS = -DF_CPU=8000000UL -DAUTO_CRC_PADDING=2
|
||||
|
||||
include $(CONTIKIAVR)/Makefile.avr
|
@ -1,91 +0,0 @@
|
||||
#ifndef __CONTIKI_CONF_H__
|
||||
#define __CONTIKI_CONF_H__
|
||||
|
||||
#include<stdint.h>
|
||||
|
||||
/* Platform name, type, and MCU clock rate */
|
||||
#define PLATFORM_NAME "STK500"
|
||||
#define PLATFORM_TYPE STK500
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 8000000UL
|
||||
#endif
|
||||
|
||||
#define CCIF
|
||||
#define CLIF
|
||||
|
||||
/* The AVR tick interrupt usually is done with an 8 bit counter around 128 Hz.
|
||||
* 125 Hz needs slightly more overhead during the interrupt, as does a 32 bit
|
||||
* clock_time_t.
|
||||
*/
|
||||
/* Clock ticks per second */
|
||||
#define CLOCK_CONF_SECOND 125
|
||||
#if 1
|
||||
/* 16 bit counter overflows every ~10 minutes */
|
||||
typedef unsigned short clock_time_t;
|
||||
#define CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
||||
#define INFINITE_TIME 0xffff
|
||||
#define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
|
||||
#define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
|
||||
#else
|
||||
typedef unsigned long clock_time_t;
|
||||
#define CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0)
|
||||
#define INFINITE_TIME 0xffffffff
|
||||
#endif
|
||||
/* These routines are not part of the contiki core but can be enabled in cpu/avr/clock.c */
|
||||
void clock_delay_msec(uint16_t howlong);
|
||||
void clock_adjust_ticks(clock_time_t howmany);
|
||||
|
||||
#define SLIP_PORT 0
|
||||
|
||||
#if UIP_CONF_IPV6
|
||||
#define RIMEADDR_CONF_SIZE 8
|
||||
#define UIP_CONF_ICMP6 1
|
||||
#define UIP_CONF_UDP 1
|
||||
#define UIP_CONF_TCP 1
|
||||
//#define UIP_CONF_IPV6_RPL 0
|
||||
|
||||
/* See uip-ds6.h */
|
||||
#define NBR_TABLE_CONF_MAX_NEIGHBORS 20
|
||||
#define UIP_CONF_DS6_DEFRT_NBU 2
|
||||
#define UIP_CONF_DS6_PREFIX_NBU 3
|
||||
#define UIP_CONF_MAX_ROUTES 20
|
||||
#define UIP_CONF_DS6_ADDR_NBU 3
|
||||
#define UIP_CONF_DS6_MADDR_NBU 0
|
||||
#define UIP_CONF_DS6_AADDR_NBU 0
|
||||
|
||||
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
||||
#define NETSTACK_CONF_MAC nullmac_driver
|
||||
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
|
||||
#define NETSTACK_CONF_RDC sicslowmac_driver
|
||||
#define NETSTACK_CONF_FRAMER framer_802154
|
||||
#define NETSTACK_CONF_RADIO rf230_driver
|
||||
#define CHANNEL_802_15_4 26
|
||||
/* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
|
||||
#define RF230_CONF_AUTOACK 1
|
||||
/* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
|
||||
#define SICSLOWPAN_CONF_ACK_ALL 0
|
||||
/* Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */
|
||||
#define RF230_CONF_AUTORETRIES 2
|
||||
#define SICSLOWPAN_CONF_FRAG 1
|
||||
/* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
|
||||
#define SICSLOWPAN_CONF_MAXAGE 3
|
||||
/* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
|
||||
#define UIP_CONF_WAIT_TIMEOUT 5
|
||||
|
||||
#else
|
||||
/* ip4 should build but is largely untested */
|
||||
#define RIMEADDR_CONF_SIZE 2
|
||||
#define NETSTACK_CONF_NETWORK rime_driver
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
||||
/* These names are deprecated, use C99 names. */
|
||||
typedef uint8_t u8_t;
|
||||
typedef int8_t s8_t;
|
||||
typedef uint16_t u16_t;
|
||||
typedef int16_t s16_t;
|
||||
typedef uint32_t u32_t;
|
||||
typedef int32_t s32_t;
|
||||
|
||||
#endif /* __CONTIKI_CONF_H__ */
|
@ -1,236 +0,0 @@
|
||||
|
||||
/* Copyright (c) 2008, Daniel Willmann <daniel@totalueberwachung.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki OS
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "dev/rs232.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <stdio.h>
|
||||
#include <dev/watchdog.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define PRINTA(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#define PRINTD PRINTA
|
||||
#else
|
||||
#define PRINTD(...)
|
||||
#endif
|
||||
|
||||
/* Test rtimers, also stack monitor and time stamps */
|
||||
#define TESTRTIMER 1
|
||||
#if TESTRTIMER
|
||||
#define STAMPS 30
|
||||
#define STACKMONITOR 128
|
||||
|
||||
uint8_t rtimerflag=1;
|
||||
uint16_t rtime;
|
||||
struct rtimer rt;
|
||||
void rtimercycle(void) {rtimerflag=1;}
|
||||
#endif /* TESTRTIMER */
|
||||
|
||||
#if defined (__AVR_ATmega8__)
|
||||
FUSES =
|
||||
{
|
||||
.low = 0xe0,
|
||||
.high = 0xd9,
|
||||
};
|
||||
#elif defined (__AVR_ATmega16__)
|
||||
FUSES =
|
||||
{
|
||||
.low = 0xe0,
|
||||
.high = 0x99,
|
||||
};
|
||||
#elif defined (__AVR_ATmega644__)
|
||||
FUSES =
|
||||
{
|
||||
.low = 0xe0,
|
||||
.high = 0x99,
|
||||
.extended = 0xff,
|
||||
};
|
||||
|
||||
//MCU=atmega8515
|
||||
//MCU=atmega328p
|
||||
//MCU=atmega32
|
||||
#endif
|
||||
|
||||
|
||||
PROCESS(led_process, "LED process");
|
||||
PROCESS_THREAD(led_process, ev, data)
|
||||
{
|
||||
static struct etimer etimer;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
while (1) {
|
||||
PRINTD("LED1\r\n");
|
||||
PORTB |= (1<<PB1);
|
||||
PORTD |= (1<<PD3);
|
||||
etimer_set(&etimer, CLOCK_SECOND*0.5);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
PORTB &= ~(1<<PB1);
|
||||
PORTD &= ~(1<<PD3);
|
||||
etimer_set(&etimer, CLOCK_SECOND*0.5);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
PROCESS(led2_process, "LED process");
|
||||
PROCESS_THREAD(led2_process, ev, data)
|
||||
{
|
||||
static struct etimer etimer;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
while (1) {
|
||||
PRINTD("LED2\r\n");
|
||||
PORTB |= (1<<PB0);
|
||||
PORTD |= (1<<PD2);
|
||||
etimer_set(&etimer, CLOCK_SECOND*0.3);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
PORTB &= ~(1<<PB0);
|
||||
PORTD &= ~(1<<PD2);
|
||||
etimer_set(&etimer, CLOCK_SECOND*0.3);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
void led_init()
|
||||
{
|
||||
DDRB |= (1<<PB1)|(1<<PB0);
|
||||
PORTB &= ~((1<<PB1)|(1<<PB0));
|
||||
DDRD |= (1<<PD2)|(1<<PD3);
|
||||
PORTD &= ~((1<<PD2)|(1<<PD3));
|
||||
}
|
||||
|
||||
/* These can also be explicitly started below */
|
||||
PROCINIT(&etimer_process, &led_process, &led2_process);
|
||||
|
||||
void
|
||||
initialize(void)
|
||||
{
|
||||
watchdog_init();
|
||||
watchdog_start();
|
||||
|
||||
#if STACKMONITOR
|
||||
/* Simple stack pointer highwater monitor. Checks for magic numbers in the main
|
||||
* loop. In conjuction with TESTRTIMER, never-used stack will be printed
|
||||
* every STACKMONITOR seconds.
|
||||
*/
|
||||
{
|
||||
extern uint16_t __bss_end;
|
||||
uint16_t p=(uint16_t)&__bss_end;
|
||||
do {
|
||||
*(uint16_t *)p = 0x4242;
|
||||
p+=4;
|
||||
} while (p<SP-4); //don't overwrite our own stack
|
||||
}
|
||||
#endif
|
||||
|
||||
/* rtimers needed for radio cycling */
|
||||
rtimer_init();
|
||||
|
||||
rs232_init(RS232_PORT_0, BAUD_RATE(38400), USART_DATA_BITS_8 | USART_PARITY_NONE | USART_STOP_BITS_1);
|
||||
rs232_redirect_stdout(RS232_PORT_0);
|
||||
|
||||
clock_init();
|
||||
sei();
|
||||
|
||||
/* Initialize drivers and event kernel */
|
||||
process_init();
|
||||
|
||||
led_init();
|
||||
|
||||
#if 0
|
||||
procinit_init();
|
||||
#else
|
||||
process_start(&etimer_process, NULL);
|
||||
process_start(&led_process, NULL);
|
||||
process_start(&led2_process, NULL);
|
||||
#endif
|
||||
|
||||
PRINTA(CONTIKI_VERSION_STRING " started\r\n");
|
||||
|
||||
/* Comment this out if autostart_processes not defined at link */
|
||||
/* Note AUTOSTART_PROCESSES(...) is only effective in the .co module */
|
||||
autostart_start(autostart_processes);
|
||||
|
||||
}
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
initialize();
|
||||
|
||||
while(1) {
|
||||
process_run();
|
||||
|
||||
#if TESTRTIMER
|
||||
/* Timeout can be increased up to 8 seconds maximum.
|
||||
* A one second cycle is convenient for triggering the various debug printouts.
|
||||
* The triggers are staggered to avoid printing everything at once.
|
||||
*/
|
||||
if (rtimerflag) {
|
||||
rtimer_set(&rt, RTIMER_NOW()+ RTIMER_ARCH_SECOND*1UL, 1,(void *) rtimercycle, NULL);
|
||||
rtimerflag=0;
|
||||
|
||||
#if STAMPS
|
||||
if ((rtime%STAMPS)==0) {
|
||||
PRINTA("%us ",rtime);
|
||||
}
|
||||
#endif
|
||||
rtime+=1;
|
||||
|
||||
#if STACKMONITOR
|
||||
if ((rtime%STACKMONITOR)==3) {
|
||||
extern uint16_t __bss_end;
|
||||
uint16_t p=(uint16_t)&__bss_end;
|
||||
do {
|
||||
if (*(uint16_t *)p != 0x4242) {
|
||||
PRINTA("Never-used stack > %d bytes\n",p-(uint16_t)&__bss_end);
|
||||
break;
|
||||
}
|
||||
p+=4;
|
||||
} while (p<RAMEND-4);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif /* TESTRTIMER */
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
# $$
|
||||
|
||||
all: contiki-stk501-main.out loadable_prg.ko
|
||||
upload: contiki-stk501-main.eep contiki-stk501-main.u
|
||||
|
||||
CONTIKI=../..
|
||||
TARGET=stk501
|
||||
APPS=codeprop
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
@ -1,31 +0,0 @@
|
||||
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-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
|
||||
|
||||
# For usb devices, you may either use PORT=usb, or (e.g. if you have more than one
|
||||
# programmer connected) you can use the following trick to find out the serial number:
|
||||
#
|
||||
# The example is for an JTAGICE mkII used to program an ATmega128:
|
||||
# avrdude -v -P usb:xxxx -c jtag2 -p atmega128
|
||||
AVRDUDE_PORT=usb:00A0000010EB
|
||||
|
||||
# Additional avrdude options
|
||||
# Verify off
|
||||
AVRDUDE_OPTIONS=-V
|
||||
|
||||
include $(CONTIKIAVR)/Makefile.avr
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$$
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Configuration for sample STK 501 Contiki kernel
|
||||
*
|
||||
* \author
|
||||
* Simon Barner <barner@in.tum.de
|
||||
*/
|
||||
|
||||
#ifndef __CONTIKI_CONF_H__
|
||||
#define __CONTIKI_CONF_H__
|
||||
|
||||
/*
|
||||
* MCU and clock rate. Various MCUs can be inserted in the ZIF socket.
|
||||
*/
|
||||
/* Platform name, type, and MCU clock rate */
|
||||
#define PLATFORM_NAME "STK501"
|
||||
#define PLATFORM_TYPE STK501
|
||||
#ifndef MCU
|
||||
#define MCU atmega128
|
||||
#endif
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
#define HAVE_STDINT_H
|
||||
#include "avrdef.h"
|
||||
|
||||
/* The AVR tick interrupt usually is done with an 8 bit counter around 128 Hz.
|
||||
* 125 Hz needs slightly more overhead during the interrupt, as does a 32 bit
|
||||
* clock_time_t.
|
||||
*/
|
||||
/* Clock ticks per second */
|
||||
#define CLOCK_CONF_SECOND 125
|
||||
#if 1
|
||||
/* 16 bit counter overflows every ~10 minutes */
|
||||
typedef unsigned short clock_time_t;
|
||||
#define CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
||||
#define INFINITE_TIME 0xffff
|
||||
#define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
|
||||
#define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
|
||||
#else
|
||||
typedef unsigned long clock_time_t;
|
||||
#define CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0)
|
||||
#define INFINITE_TIME 0xffffffff
|
||||
#endif
|
||||
/* These routines are not part of the contiki core but can be enabled in cpu/avr/clock.c */
|
||||
void clock_delay_msec(uint16_t howlong);
|
||||
void clock_adjust_ticks(clock_time_t howmany);
|
||||
|
||||
/* COM port to be used for SLIP connection */
|
||||
#define SLIP_PORT RS232_PORT_0
|
||||
|
||||
/* Pre-allocated memory for loadable modules heap space (in bytes)*/
|
||||
#define MMEM_CONF_SIZE 256
|
||||
|
||||
/* Use the following address for code received via the codeprop
|
||||
* facility
|
||||
*/
|
||||
#define EEPROMFS_ADDR_CODEPROP 0x8000
|
||||
|
||||
#define CCIF
|
||||
#define CLIF
|
||||
|
||||
#define UIP_CONF_PINGADDRCONF 0
|
||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||
#define UIP_CONF_MAX_LISTENPORTS 4
|
||||
#define UIP_CONF_BUFFER_SIZE 100
|
||||
#define UIP_CONF_TCP_SPLIT 1
|
||||
#define UIP_CONF_FWCACHE_SIZE 2
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
#define UIP_UDP 1
|
||||
|
||||
#define HAVE_STDINT_H
|
||||
#include "avrdef.h"
|
||||
|
||||
typedef unsigned short uip_stats_t;
|
||||
typedef unsigned long off_t;
|
||||
|
||||
#endif /* __CONTIKI_CONF_H__ */
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* Author: Simon Barner <barner@in.tum.de>
|
||||
*
|
||||
* @(#)$$
|
||||
*/
|
||||
#include "contiki-stk501.h"
|
||||
|
||||
void
|
||||
init_lowlevel(void)
|
||||
{
|
||||
/* Configure default slip port with 115200 baud */
|
||||
rs232_init(RS232_PORT_0, USART_BAUD_115200, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
|
||||
|
||||
/* Second rs232 port for debugging */
|
||||
rs232_init(RS232_PORT_1, USART_BAUD_9600, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8);
|
||||
|
||||
/* Redirect stdout to second port */
|
||||
rs232_redirect_stdout (RS232_PORT_1);
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* Author: Simon Barner <barner@in.tum.de>
|
||||
*
|
||||
* @(#)$$
|
||||
*/
|
||||
|
||||
#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);
|
||||
process_start(&slip_process, NULL);
|
||||
|
||||
uip_ipaddr(&hostaddr, 10, 100, 0, 2);
|
||||
uip_sethostaddr(&hostaddr);
|
||||
|
||||
uip_fw_register(&slipif);
|
||||
// uip_fw_default(&slipif);
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$$
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Sample Contiki kernel for STK 501 development board
|
||||
*
|
||||
* \author
|
||||
* 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 "../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 "../apps/codeprop/codeprop.h"
|
||||
#include "sys/mt.h"
|
||||
|
||||
/* Uncomment to enable demonstration of multi-threading libary */
|
||||
/* #define MT_DEMO */
|
||||
|
||||
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
|
||||
//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];
|
||||
|
||||
static
|
||||
void thread_handler1 (void* data) {
|
||||
while (1) {
|
||||
PRINTF ("Thread 1. Data: 0x%x, %d\n", data, *(uint8_t*)data );
|
||||
mt_yield ();
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void thread_handler2 (void* data) {
|
||||
while (1) {
|
||||
PRINTF ("Thread 2. Data: 0x%x, %d\n", data, *(uint8_t*)data );
|
||||
mt_yield ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PROCESS(contiki_stk501_main_init_process, "Contiki STK501 init process");
|
||||
PROCESS_THREAD(contiki_stk501_main_init_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* Network support (uIP) */
|
||||
init_net();
|
||||
|
||||
/* Initalize heap allocator */
|
||||
mmem_init ();
|
||||
|
||||
/* Code propagator */
|
||||
/* 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
|
||||
mt_init ();
|
||||
#endif
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
#ifdef MT_DEMO
|
||||
static uint8_t d1=1, d2=2, d3=3;
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
/*
|
||||
* GCC depends on register r1 set to 0.
|
||||
*/
|
||||
asm volatile ("clr r1");
|
||||
|
||||
/* Initialize hardware */
|
||||
init_lowlevel();
|
||||
|
||||
/* Clock */
|
||||
clock_init();
|
||||
|
||||
/* Process subsystem */
|
||||
process_init();
|
||||
|
||||
/* Register initial processes */
|
||||
procinit_init();
|
||||
|
||||
/* Perform rest of initializations */
|
||||
process_start(&contiki_stk501_main_init_process, NULL);
|
||||
|
||||
PRINTF("Initialized.\n");
|
||||
|
||||
#ifdef MT_DEMO
|
||||
mt_start (&threads[0], thread_handler1, &d1);
|
||||
mt_start (&threads[1], thread_handler2, &d2);
|
||||
mt_start (&threads[2], thread_handler2, &d3);
|
||||
|
||||
uint8_t i;
|
||||
#endif
|
||||
|
||||
/* Main scheduler loop */
|
||||
while(1) {
|
||||
|
||||
process_run();
|
||||
|
||||
#ifdef MT_DEMO
|
||||
for (i=0; i<3; ++i) {
|
||||
mt_exec (&threads[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$$
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Sample Contiki kernel for STK 501 development board
|
||||
*
|
||||
* \author
|
||||
* Simon Barner <barner@in.tum.de
|
||||
*/
|
||||
|
||||
#ifndef __CONTIKI_STK501_H__
|
||||
#define __CONTIKI_STK501_H__
|
||||
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
#include "contiki-lib.h"
|
||||
|
||||
#include "dev/rs232.h"
|
||||
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/slip.h"
|
||||
|
||||
void init_lowlevel(void);
|
||||
void init_net(void);
|
||||
|
||||
|
||||
#endif /* #ifndef __CONTIKI_STK501_H__ */
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Technical University of Munich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Sample loadable module
|
||||
*
|
||||
* \author
|
||||
* Simon Barner <barner@in.tum.de>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "dev/rs232.h"
|
||||
#include "contiki.h"
|
||||
|
||||
PROCESS(test_process1, "Test process");
|
||||
PROCESS_THREAD(test_process1, ev, data)
|
||||
{
|
||||
static struct etimer etimer;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
rs232_print (RS232_PORT_1, "test_process 1 starting\n");
|
||||
|
||||
while(1) {
|
||||
etimer_set(&etimer, CLOCK_SECOND);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
rs232_print (RS232_PORT_1, "Tick\n");
|
||||
etimer_set(&etimer, CLOCK_SECOND);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
|
||||
rs232_print (RS232_PORT_1, "Tack\n");
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
const struct process *autostart_processes[] = {&test_process1};
|
Loading…
Reference in New Issue
Block a user