Initial PicoRV32 target
This commit is contained in:
parent
743245e230
commit
57959a53f6
17 changed files with 1714 additions and 0 deletions
77
cpu/pico-rv32/Makefile.pico-rv32
Normal file
77
cpu/pico-rv32/Makefile.pico-rv32
Normal file
|
@ -0,0 +1,77 @@
|
|||
CONTIKI_CPU_DIRS = . dev
|
||||
|
||||
### Define the CPU directory of the AVR port
|
||||
CONTIKI_CPU=$(CONTIKI)/cpu/pico-rv32
|
||||
|
||||
PICORV32_SOURCES = mtarch.c rtimer-arch.c clock.c watchdog.c
|
||||
CONTIKI_TARGET_SOURCEFILES += $(PICORV32_SOURCES) $(SENSORS) $(SYSAPPS) \
|
||||
nullsec.c
|
||||
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
||||
### Compiler definitions
|
||||
CC = riscv32-unknown-elf-gcc
|
||||
CXX = riscv32-unknown-elf-g++
|
||||
LD = riscv32-unknown-elf-gcc
|
||||
AS = riscv32-unknown-elf-as
|
||||
AR = riscv32-unknown-elf-ar
|
||||
ELF_SIZE = riscv32-unknown-elf-size
|
||||
NM = riscv32-unknown-elf-nm
|
||||
OBJCOPY = riscv32-unknown-elf-objcopy
|
||||
STRIP = riscv32-unknown-elf-strip
|
||||
ifdef WERROR
|
||||
CFLAGSWERROR=-Werror
|
||||
endif
|
||||
CFLAGSNO = -Wall -g \
|
||||
-I$(CONTIKI)/platform/$(TARGET) \
|
||||
-I. -I$(CONTIKI)/core -I$(CONTIKI_CPU)
|
||||
CFLAGS += $(CFLAGSNO) -Os
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
AROPTS = -r
|
||||
LDFLAGS += -Wl,-flat_namespace
|
||||
CFLAGS += -DHAVE_SNPRINTF=1 -U__ASSERT_USE_STDERR
|
||||
else
|
||||
ifeq ($(HOST_OS),Linux)
|
||||
LDFLAGS += -Wl,-Map=contiki-$(TARGET).map,-export-dynamic
|
||||
endif
|
||||
endif
|
||||
|
||||
### Setup directory search path for source files
|
||||
|
||||
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
|
||||
$(CONTIKI_TARGET_DIRS)}
|
||||
|
||||
### Compilation rules
|
||||
# Vertical bar | symbol denotes an order-only dependency: Timestamp is
|
||||
# ignored on the directory (otherwise everything would be rebuilt
|
||||
# everytime)
|
||||
|
||||
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJECTDIR)/%.o: %.cpp | $(OBJECTDIR)
|
||||
$(CXX) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.ko: %.o
|
||||
$(STRIP) -K _init -K _fini --strip-unneeded -g -x $< -o $@
|
||||
|
||||
%.elf: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a symbols.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter-out %.a,$^) \
|
||||
$(filter %.a,$^) $(LDLIBS)
|
||||
|
||||
%.hex: %.$(TARGET)
|
||||
$(OBJCOPY) $^ -j .text -j .data -O ihex $@
|
||||
|
||||
%.ihex: %.$(TARGET)
|
||||
$(OBJCOPY) $^ -O ihex $@
|
||||
|
||||
%-stripped.o: %.o
|
||||
$(STRIP) --strip-unneeded -g -x -o $@ $<
|
||||
|
184
cpu/pico-rv32/dev/clock.c
Normal file
184
cpu/pico-rv32/dev/clock.c
Normal file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \brief This module contains PicoRV32-specific code to implement
|
||||
* the Contiki core clock functions.
|
||||
*
|
||||
* \author Ralf Schlatterbeck <rsc@runtux.com>.
|
||||
*
|
||||
*/
|
||||
/** \addtogroup picorv32
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* \defgroup picorv32clock PicoRV32 clock implementation
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* \file
|
||||
* This file contains PicoRV32-specific code to implement the Contiki
|
||||
* core clock functions.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* These routines define the PicoRV32-specific calls declared in
|
||||
* /core/sys/clock.h CLOCK_SECOND is the number of ticks per second.
|
||||
* It is defined through CONF_CLOCK_SECOND in the contiki-conf.h for
|
||||
* each platform.
|
||||
* The usual AVR defaults are 128 or 125 ticks per second, counting a
|
||||
* prescaled CPU clock using the 8 bit timer0.
|
||||
*
|
||||
* clock_time_t is usually declared by the platform as an unsigned 16
|
||||
* bit data type, thus intervals up to 512 or 524 seconds can be
|
||||
* measured with ~8 millisecond precision.
|
||||
* For longer intervals the 32 bit clock_seconds() is available.
|
||||
*/
|
||||
#include "sys/clock.h"
|
||||
#include "sys/etimer.h"
|
||||
|
||||
static volatile clock_time_t count;
|
||||
volatile unsigned long seconds;
|
||||
long sleepseconds;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Start the clock by enabling the timer comparison interrupts.
|
||||
*/
|
||||
void
|
||||
clock_init(void)
|
||||
{
|
||||
//cli ();
|
||||
//OCRSetup();
|
||||
//sei ();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Return the tick counter. When 16 bit it typically wraps every 10 minutes.
|
||||
* The comparison avoids the need to disable clock interrupts for an atomic
|
||||
* read of the multi-byte variable.
|
||||
*/
|
||||
clock_time_t
|
||||
clock_time(void)
|
||||
{
|
||||
static clock_time_t counter = 0;
|
||||
return counter++;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Return seconds, default is time since startup.
|
||||
* The comparison avoids the need to disable clock interrupts for an atomic
|
||||
* read of the four-byte variable.
|
||||
*/
|
||||
unsigned long
|
||||
clock_seconds(void)
|
||||
{
|
||||
unsigned long tmp;
|
||||
do {
|
||||
tmp = seconds;
|
||||
} while(tmp != seconds);
|
||||
return tmp;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Set seconds, e.g. to a standard epoch for an absolute date/time.
|
||||
*/
|
||||
void
|
||||
clock_set_seconds(unsigned long sec)
|
||||
{
|
||||
seconds = sec;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Wait for a number of clock ticks.
|
||||
*/
|
||||
void
|
||||
clock_wait(clock_time_t t)
|
||||
{
|
||||
clock_time_t endticks = clock_time() + t;
|
||||
if (sizeof(clock_time_t) == 1) {
|
||||
while ((signed char )(clock_time() - endticks) < 0) {;}
|
||||
} else if (sizeof(clock_time_t) == 2) {
|
||||
while ((signed short)(clock_time() - endticks) < 0) {;}
|
||||
} else {
|
||||
while ((signed long )(clock_time() - endticks) < 0) {;}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
clock_delay_usec(uint16_t dt)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Delay up to 65535 milliseconds.
|
||||
* \param howlong How many milliseconds to delay.
|
||||
*
|
||||
* Neither interrupts nor the watchdog timer is disabled over the delay.
|
||||
* Platforms are not required to implement this call.
|
||||
* \note This will break for CPUs clocked above 260 MHz.
|
||||
*/
|
||||
void
|
||||
clock_delay_msec(uint16_t howlong)
|
||||
{
|
||||
|
||||
#if F_CPU>=16000000
|
||||
while(howlong--) clock_delay_usec(1000);
|
||||
#elif F_CPU>=8000000
|
||||
uint16_t i=996;
|
||||
while(howlong--) {clock_delay_usec(i);i=999;}
|
||||
#elif F_CPU>=4000000
|
||||
uint16_t i=992;
|
||||
while(howlong--) {clock_delay_usec(i);i=999;}
|
||||
#elif F_CPU>=2000000
|
||||
uint16_t i=989;
|
||||
while(howlong--) {clock_delay_usec(i);i=999;}
|
||||
#else
|
||||
uint16_t i=983;
|
||||
while(howlong--) {clock_delay_usec(i);i=999;}
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Adjust the system current clock time.
|
||||
* \param howmany How many ticks to add
|
||||
*
|
||||
* Typically used to add ticks after an MCU sleep
|
||||
* clock_seconds will increment if necessary to reflect the tick addition.
|
||||
* Leap ticks or seconds can (rarely) be introduced if the ISR is not blocked.
|
||||
*/
|
||||
void
|
||||
clock_adjust_ticks(clock_time_t howmany)
|
||||
{
|
||||
}
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
159
cpu/pico-rv32/mtarch.c
Normal file
159
cpu/pico-rv32/mtarch.c
Normal file
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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 PicoRV32 specific implementation of multithreading architecture
|
||||
*
|
||||
* \author Ralf Schlatterbeck <rsc@runtux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sys/mt.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_start(struct mtarch_thread *t,
|
||||
void (*function)(void *), void *data)
|
||||
{
|
||||
/* Initialize stack with number sequence (used for
|
||||
* measuring stack usage */
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < MTARCH_STACKSIZE; ++i) {
|
||||
t->stack[i] = i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Push pointer to mt_exit and the thread onto our stack:
|
||||
* Caveats:
|
||||
* - The stack is defined as an array of bytes, but pointers are 32 bit wide
|
||||
* - Function pointers are 32-bit addresses in flash ROM
|
||||
*/
|
||||
|
||||
/* Initialize stack. This is done in reverse order ("pushing") the
|
||||
* pre-allocated array */
|
||||
|
||||
/* mt_exit function that is to be invoked if the thread dies
|
||||
* function is the thread handler. Invoked when RET is called in mtarch_exec
|
||||
*/
|
||||
*((uint32_t *)(t->stack + MTARCH_STACKSIZE - 4)) = (uint32_t)mt_exit;
|
||||
*((uint32_t *)(t->stack + MTARCH_STACKSIZE - 8)) = (uint32_t)function;
|
||||
|
||||
/* FIXME: Push args to function and saved registers, check calling
|
||||
* conventions
|
||||
*/
|
||||
|
||||
/* Initialize stack pointer: Space for 2 2-byte-addresses and 32 registers,
|
||||
* post-decrement POP / pre-increment PUSH scheme
|
||||
* FIXME: Need to calculate correct address here
|
||||
*/
|
||||
t->sp = &t->stack[MTARCH_STACKSIZE - 1 - 4 - 32];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static unsigned char *sptmp;
|
||||
static struct mtarch_thread *running;
|
||||
|
||||
static void
|
||||
sw(void)
|
||||
{
|
||||
/* Disable interrupts while we perform the context switch */
|
||||
//cli ();
|
||||
|
||||
/* Push 32 general purpuse registers */
|
||||
|
||||
/* Switch stack pointer */
|
||||
sptmp = running->sp;
|
||||
//running->sp = (unsigned char*)SP;
|
||||
//SP = (unsigned short)sptmp;
|
||||
|
||||
/* Pop 32 general purpose registers */
|
||||
|
||||
/* Renable interrupts */
|
||||
//sei ();
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_exec(struct mtarch_thread *t)
|
||||
{
|
||||
running = t;
|
||||
sw();
|
||||
running = NULL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_remove(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_yield(void)
|
||||
{
|
||||
sw();
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_pstop(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_pstart(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
void
|
||||
mtarch_stop(struct mtarch_thread *t)
|
||||
{
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int
|
||||
mtarch_stack_usage(struct mt_thread *t)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < MTARCH_STACKSIZE; ++i) {
|
||||
if(t->thread.stack[i] != i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return MTARCH_STACKSIZE - i;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
56
cpu/pico-rv32/mtarch.h
Normal file
56
cpu/pico-rv32/mtarch.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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
|
||||
* PicoRV32 specific implementation of multithreading architecture
|
||||
* \author
|
||||
* Ralf Schlatterbeck <rsc@runtux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MTARCH_H_
|
||||
#define MTARCH_H_
|
||||
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#ifdef MTARCH_CONF_STACKSIZE
|
||||
#define MTARCH_STACKSIZE MTARCH_CONF_STACKSIZE
|
||||
#else
|
||||
#define MTARCH_STACKSIZE 512
|
||||
#endif
|
||||
|
||||
struct mtarch_thread {
|
||||
unsigned char stack[MTARCH_STACKSIZE];
|
||||
unsigned char *sp;
|
||||
};
|
||||
|
||||
#endif /* MTARCH_H_ */
|
53
cpu/pico-rv32/rtimer-arch.c
Normal file
53
cpu/pico-rv32/rtimer-arch.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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
|
||||
* PicoRV32-specific rtimer code
|
||||
* \author
|
||||
* Ralf Schlatterbeck <rsc@runtux.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sys/rtimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
|
||||
void
|
||||
rtimer_arch_init(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rtimer_arch_schedule(rtimer_clock_t t)
|
||||
{
|
||||
}
|
44
cpu/pico-rv32/rtimer-arch.h
Normal file
44
cpu/pico-rv32/rtimer-arch.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RTIMER_ARCH_H_
|
||||
#define RTIMER_ARCH_H_
|
||||
|
||||
#include <sys/clock.h>
|
||||
|
||||
// FIXME
|
||||
#define RTIMER_ARCH_SECOND 23
|
||||
|
||||
#define rtimer_arch_now() (clock_time ())
|
||||
|
||||
void rtimer_arch_sleep(rtimer_clock_t howlong);
|
||||
#endif /* RTIMER_ARCH_H_ */
|
51
cpu/pico-rv32/rv32def.h
Normal file
51
cpu/pico-rv32/rv32def.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RV32DEF_H
|
||||
#define RV32DEF_H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef long int32_t;
|
||||
typedef long long int64_t;
|
||||
|
||||
//void cpu_init(void);
|
||||
|
||||
//void *sbrk(int);
|
||||
|
||||
//typedef unsigned char spl_t;
|
||||
//static inline void splx(spl_t s) { SREG = s; }
|
||||
//static inline spl_t splhigh(void) { spl_t s = SREG; cli(); return s; }
|
||||
|
||||
#endif /* RV32DEF_H */
|
62
cpu/pico-rv32/watchdog.c
Normal file
62
cpu/pico-rv32/watchdog.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Dr. Ralf Schlatterbeck Open Source Consulting
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Dummy Watchdog routines for the PicoRV32 */
|
||||
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_init(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_start(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_periodic(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_stop(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_reboot(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
Loading…
Add table
Add a link
Reference in a new issue