OpenCores
URL https://opencores.org/ocsvn/potato/potato/trunk

Subversion Repositories potato

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /potato/trunk/benchmarks
    from Rev 24 to Rev 45
    Reverse comparison

Rev 24 → Rev 45

/hello/main.c
0,0 → 1,26
// The Potato Processor Benchmark Applications
// (c) Kristian Klomsten Skordal 2015 <kristian.skordal@wafflemail.net>
// Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
 
#include <stdint.h>
#include "../platform.h"
 
void exception_handler(uint32_t cause, void * epc, void * regbase)
{
// Not used in this application
}
 
int main(void)
{
const char * hello_string = "Hello world\n\r";
volatile uint32_t * uart = IO_ADDRESS(UART_BASE);
 
for(int i = 0; hello_string[i] != 0; ++i)
{
while(uart[UART_STATUS >> 2] & (1 << 3));
uart[UART_TX >> 2] = hello_string[i] & 0x000000ff;
}
 
return 0;
}
 
/hello/Makefile
0,0 → 1,46
# The Potato Processor Benchmark Applications
# (c) Kristian Klomsten Skordal 2015 <kristian.skordal@wafflemail.net>
# Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
 
.PHONY: all clean
 
TARGET_PREFIX ?= riscv64-unknown-elf
TARGET_CC := $(TARGET_PREFIX)-gcc
TARGET_LD := $(TARGET_PREFIX)-ld
TARGET_SIZE := $(TARGET_PREFIX)-size
TARGET_OBJCOPY := $(TARGET_PREFIX)-objcopy
HEXDUMP ?= hexdump
 
TARGET_CFLAGS += -m32 -march=RV32I -Wall -O2 -fomit-frame-pointer \
-ffreestanding -fno-builtin -I.. -std=gnu99
TARGET_LDFLAGS += -m elf32lriscv -T../benchmark.ld
 
OBJECTS := main.o start.o
 
all: hello.coe
 
hello.elf: $(OBJECTS)
$(TARGET_LD) -o hello.elf $(TARGET_LDFLAGS) $(OBJECTS)
$(TARGET_SIZE) hello.elf
 
hello.bin: hello.elf
$(TARGET_OBJCOPY) -j .text -j .data -O binary hello.elf hello.bin
 
hello.coe: hello.bin
echo "memory_initialization_radix=16;" > hello.coe
echo "memory_initialization_vector=" >> hello.coe
$(HEXDUMP) -v -e '1/4 "%08x\n"' hello.bin >> hello.coe
echo ";" >> hello.coe
 
clean:
-$(RM) $(OBJECTS)
-$(RM) hello.elf hello.bin hello.coe
 
# Object file rules:
 
main.o: main.c ../platform.h ../potato.h
$(TARGET_CC) -c -o $@ $(TARGET_CFLAGS) $<
 
start.o: ../start.S ../platform.h
$(TARGET_CC) -c -o $@ $(TARGET_CFLAGS) $<
 
/platform.h
9,7 → 9,7
#define PLATFORM_H
 
// Clock frequency in Hz:
#define SYSTEM_CLK_FREQ 60000000
#define SYSTEM_CLK_FREQ 50000000
 
// Macro for using the addresses below in C code:
#define IO_ADDRESS(x) ((volatile void *) x)
/potato.h
52,6 → 52,13
#define potato_disable_interrupts() asm volatile("csrci %[status], 1 << %[ei_bit] | 1 << %[pei_bit]\n" \
:: [status] "i" (CSR_STATUS), [ei_bit] "i" (STATUS_EI), [pei_bit] "i" (STATUS_PEI))
 
#define potato_write_host(data) \
do { \
register uint32_t temp = data; \
asm volatile("csrw %[tohost], %[temp]\n" \
:: [tohost] "i" (CSR_TOHOST), [temp] "r" (temp)); \
} while(0);
 
#define potato_enable_irq(n) \
do { \
register uint32_t temp = 0; \

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.