initial commit

This commit is contained in:
2022-04-11 09:22:28 +02:00
commit cc687eaf4b
103 changed files with 7211 additions and 0 deletions

3
fw/hello-world/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/hello
/hello.dis
/firmware.map

18
fw/hello-world/Makefile Normal file
View File

@ -0,0 +1,18 @@
TARGET = hello
C_SRCS = $(wildcard *.c)
HEADERS = $(wildcard *.h)
CFLAGS += -O0 -g
BOARD=tgfs-vp
LINK_TARGET=flash
RISCV_ARCH:=rv32i
RISCV_ABI:=ilp32
LDFLAGS := -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI)
compiler := $(shell which riscv32-unknown-elf-gcc)
TOOL_DIR=$(dir $(compiler))
TRIPLET=riscv32-unknown-elf
BSP_BASE = ../bsp
include $(BSP_BASE)/env/common-gcc.mk

26
fw/hello-world/hello.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include "platform.h"
#include "encoding.h"
int factorial(int i){
volatile int result = 1;
for (int ii = 1; ii <= i; ii++) {
result = result * ii;
}
return result;
}
int main()
{
*(uint32_t*)(GPIO_CTRL_ADDR+GPIO_IOF_SEL) &= ~IOF0_UART0_MASK;
*(uint32_t*)(GPIO_CTRL_ADDR+GPIO_IOF_EN) |= IOF0_UART0_MASK;
volatile int result = factorial (10);
printf("Factorial is %d\n", result);
printf("End of execution");
return 0;
}

BIN
fw/hello-world/prebuilt/hello.elf Executable file

Binary file not shown.