From 9961f080c9bfd5fcba01b694ead1c2646f43f343 Mon Sep 17 00:00:00 2001 From: mariusmonton Date: Thu, 20 Sep 2018 12:24:07 +0200 Subject: [PATCH] examples updated --- .gitignore | 1 + C/forloop/Makefile | 2 +- C/trace2/Makefile | 1 - C/trace3/trace3.c | 6 ++---- asm/Memoryaccess.asm | 12 +++++++----- asm/trace2.asm | 16 ---------------- 6 files changed, 11 insertions(+), 27 deletions(-) delete mode 100644 asm/trace2.asm diff --git a/.gitignore b/.gitignore index fe64b6d..dcf12cf 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ Log.txt helper.ods *.swp RISCV_TLM +dump diff --git a/C/forloop/Makefile b/C/forloop/Makefile index ed1360b..91110ad 100644 --- a/C/forloop/Makefile +++ b/C/forloop/Makefile @@ -1,4 +1,4 @@ -TARGET = trace +TARGET = forloop TARGET_ARCH=riscv32 diff --git a/C/trace2/Makefile b/C/trace2/Makefile index 6e98f6d..ec102f3 100644 --- a/C/trace2/Makefile +++ b/C/trace2/Makefile @@ -4,7 +4,6 @@ TARGET_ARCH=riscv32 CC = riscv32-unknown-linux-gnu-gcc # compiling flags here -#CFLAGS = -Wall -I. -O0 -nostartfiles -march=rv32i -mabi=ilp32 CFLAGS = -Wall -I. -O0 -nostdlib -march=rv32i -mabi=ilp32 LINKER = riscv32-unknown-linux-gnu-gcc diff --git a/C/trace3/trace3.c b/C/trace3/trace3.c index 8ce1430..3a7483d 100644 --- a/C/trace3/trace3.c +++ b/C/trace3/trace3.c @@ -1,12 +1,10 @@ #define TRACE (*(unsigned char *)0x40000000) - - void main(void) { - char msg[] = "Hello world\n"; + char msg[] = "abcdefg\n"; int i; - for (i=0; msg[i] != '\0'; i++) { + for (i=0; i<5; i++) { TRACE = msg[i]; } } diff --git a/asm/Memoryaccess.asm b/asm/Memoryaccess.asm index 2fec136..c1ccc5e 100644 --- a/asm/Memoryaccess.asm +++ b/asm/Memoryaccess.asm @@ -1,6 +1,8 @@ -li t1, 150 +li t1, 0xCAFE li t2, 300 -li t3, -250 -sw t1, -4(t2) -li t1, 500 -#lw t1, -4(t2) +li t3, 0xBEEF +sb t1, -6(t2) +sb t3, -13(t2) +li t1, 23 +lbu t1, -6(t2) +lbu t3, -13(t2) diff --git a/asm/trace2.asm b/asm/trace2.asm deleted file mode 100644 index 3066b0e..0000000 --- a/asm/trace2.asm +++ /dev/null @@ -1,16 +0,0 @@ -.equ TRACE_BASE, 0x40000000 - -.section .text -.globl _start -_start: - - la a0, msg - -1: li a2, TRACE_BASE -# addi a0, a0, 1 -# j 1b - - -#.section .rodata -msg: - .string "Hello World\n"