-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize userland libraries, improves naming.
- Loading branch information
Henrik Karlsson
committed
Oct 15, 2023
1 parent
7b6f4e2
commit 96857b7
Showing
48 changed files
with
477 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ARCH=rv64imac_zicsr | ||
ABI=lp64 | ||
CMODEL=medany |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#if defined(PLATFORM_VIRT) | ||
#include "plat/virt.h" | ||
#elif defined(PLATFORM_HIFIVE_UNLEASHED) | ||
#include "plat/hifive_unleashed.h" | ||
#else | ||
#error "Unsupported platform or platform not found" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#define UART_SIFIVE | ||
#define UART0_BASE_ADDR (0x10010000ull) | ||
|
||
#define MTIME_BASE_ADDR 0x200bff8ull | ||
#define MTIMECMP_BASE_ADDR 0x2004000ull | ||
|
||
// Min and max usable hart ID. | ||
#define S3K_MIN_HART 1 | ||
#define S3K_MAX_HART 4 | ||
|
||
// Total number of usable harts. | ||
#define S3K_HART_CNT (S3K_MAX_HART - S3K_MIN_HART + 1ul) | ||
|
||
// Number of PMP slots. | ||
#define S3K_PMP_CNT 8 | ||
|
||
// RTC ticks per second | ||
#define S3K_RTC_HZ 1000000ull | ||
|
||
/// Stack size of 1024 KiB | ||
#define S3K_LOG_STACK_SIZE 10 | ||
|
||
#define UART_SIFIVE | ||
|
||
#define INIT_CAPS \ | ||
{ \ | ||
[0] = cap_mk_pmp(0x20005fff, MEM_RWX), \ | ||
[1] = cap_mk_memory(0x80020000, 0x80100000, MEM_RWX), \ | ||
[2] = cap_mk_memory(0x10010000, 0x10011000, MEM_RW), \ | ||
[3] = cap_mk_memory(0x200b000, 0x200c000, MEM_R), \ | ||
[4] = cap_mk_time(1, 0, S3K_SLOT_CNT), \ | ||
[5] = cap_mk_time(2, 0, S3K_SLOT_CNT), \ | ||
[6] = cap_mk_time(3, 0, S3K_SLOT_CNT), \ | ||
[7] = cap_mk_time(4, 0, S3K_SLOT_CNT), \ | ||
[8] = cap_mk_monitor(0, S3K_PROC_CNT), \ | ||
[9] = cap_mk_channel(0, S3K_CHAN_CNT), \ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,5 @@ | ||
BUILD?=build | ||
PROGRAM?=app0 | ||
PROGRAM=app0 | ||
|
||
ROOT=../../.. | ||
COMMON=${ROOT}/common | ||
PLATFORM=${ROOT}/plat/virt | ||
SRCS=start/start.S main.c s3k/s3k.c s3klib/altio.c | ||
|
||
include ${ROOT}/tools.mk | ||
include ${PLATFORM}/platform.mk | ||
|
||
vpath %.c src ${COMMON}/src | ||
vpath %.S src ${COMMON}/src | ||
|
||
SRCS=init/start.S init/common.S altio/altio.c s3k/s3k.c | ||
SRCS+=${DRIVERS} | ||
SRCS+=main.c | ||
|
||
OBJS=${patsubst %, ${BUILD}/${PROGRAM}/%.o, ${SRCS}} | ||
DEPS=${patsubst %, ${BUILD}/${PROGRAM}/%.d, ${SRCS}} | ||
|
||
CFLAGS+=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} | ||
CFLAGS+=-nostartfiles -nostdlib | ||
CFLAGS+=-DSTACK_SIZE=1024 | ||
CFLAGS+=-T${PLATFORM}/platform.ld -Tlinker.ld | ||
CFLAGS+=-Wl,--no-warn-rwx-segments | ||
CFLAGS+=-O2 | ||
|
||
INC=-Iinc -I${COMMON}/inc -include ${S3K_CONF_H} -include ${PLAT_CONF_H} | ||
|
||
ELF=${BUILD}/${PROGRAM}.elf | ||
BIN=${ELF:.elf=.bin} | ||
DA=${ELF:.elf=.da} | ||
|
||
all: ${ELF} ${BIN} ${DA} | ||
|
||
elf: ${ELF} | ||
bin: ${BIN} | ||
da: ${DA} | ||
|
||
${BUILD}/${PROGRAM}/%.S.o: %.S | ||
@mkdir -p ${@D} | ||
@echo "CC $@" | ||
@${CC} ${CFLAGS} ${INC} -MMD -c -o $@ $< | ||
|
||
${BUILD}/${PROGRAM}/%.c.o: %.c | ||
@mkdir -p ${@D} | ||
@echo "CC $@" | ||
@${CC} ${CFLAGS} ${INC} -MMD -c -o $@ $< | ||
|
||
${ELF}: ${OBJS} | ||
@mkdir -p ${@D} | ||
@echo "CC $@" | ||
@${CC} ${CFLAGS} -MMD ${INC} -o $@ ${OBJS} | ||
|
||
${BIN}: ${ELF} | ||
@echo "OBJCOPY $@" | ||
@${OBJCOPY} -O binary $< $@ | ||
|
||
${DA}: ${ELF} | ||
@echo "OBJDUMP $@" | ||
@${OBJDUMP} -D $< > $@ | ||
|
||
clean: | ||
rm -f ${ELF} ${BIN} ${DA} ${OBJS} ${DEPS} | ||
|
||
.PHONY: all elf bin da clean | ||
|
||
-include ${DEPS} | ||
include ../default.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include "altio/altio.h" | ||
#include "s3k/s3k.h" | ||
#include "s3klib/altio.h" | ||
|
||
#define APP0_PID 0 | ||
#define APP1_PID 1 | ||
|
Oops, something went wrong.