-
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.
- Loading branch information
Henrik Karlsson
committed
Oct 26, 2023
1 parent
ea85188
commit b910d9b
Showing
57 changed files
with
334 additions
and
821 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
SUBDIRS=common kernel projects/hello projects/trapped projects/ping-pong projects/demonstrator | ||
export ROOT=${abspath .} | ||
|
||
all: | ||
for i in $(SUBDIRS); do \ | ||
make -C $$i all; \ | ||
done | ||
|
||
$(SUBDIRS): | ||
make -C $@ all | ||
PROJECT?=hello | ||
PLATFORM?=qemu_virt | ||
BUILD?=${ROOT}/build/${PROJECT} | ||
S3K_CONF_H?=${ROOT}/projects/${PROJECT}/s3k_conf.h | ||
|
||
include tools.mk | ||
include common/plat/${PLATFORM}.mk | ||
|
||
all: common kernel projects/${PROJECT} | ||
|
||
common kernel projects/${PROJECT}: | ||
make -C $@ all \ | ||
PLATFORM=${PLATFORM} \ | ||
BUILD=${BUILD} \ | ||
S3K_CONF_H=${S3K_CONF_H} | ||
|
||
qemu gdb: common kernel projects/${PROJECT} | ||
bash scripts/$@.sh ${BUILD} | ||
|
||
clean: | ||
for i in $(SUBDIRS); do \ | ||
make -C $$i clean; \ | ||
done | ||
rm -rf docs | ||
rm -r ${BUILD} | ||
|
||
docs: | ||
doxygen | ||
|
||
format: | ||
clang-format -i $(shell find -name '*.[hc]' -not -path '*/.*') | ||
|
||
.PHONY: all docs clean $(SUBDIRS) | ||
.PHONY: all docs clean qemu gdb kernel common projects/${PROJECT} |
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,14 +1,47 @@ | ||
|
||
PLATFORM?=${patsubst plat/%.mk, %, ${wildcard plat/*.mk}} | ||
include plat/${PLATFORM}.mk | ||
|
||
all: ${PLATFORM} | ||
CFLAGS=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} | ||
CFLAGS+=-DPLATFORM_${PLATFORM} | ||
CFLAGS+=-Os | ||
CFLAGS+=-flto -ffat-lto-objects | ||
CFLAGS+=-nostdlib -Iinc | ||
|
||
${PLATFORM}: | ||
${MAKE} -f build.mk PLATFORM=$@ all | ||
SRCS2OBJS=${patsubst src/%.S, ${BUILD}/common/%.o, ${filter %.S, ${1}}} \ | ||
${patsubst src/%.c, ${BUILD}/common/%.o, ${filter %.c, ${1}}} | ||
|
||
ALTC_SRCS=${wildcard src/altc/*.[cS]} | ||
S3K_SRCS=${wildcard src/s3k/*.[cS]} | ||
START_SRCS=${wildcard src/start/*.S} | ||
|
||
PLAT_OBJS=${call SRCS2OBJS, ${PLAT_SRCS}} | ||
ALTC_OBJS=${call SRCS2OBJS, ${ALTC_SRCS}} | ||
S3K_OBJS=${call SRCS2OBJS, ${S3K_SRCS}} | ||
START_OBJS=${call SRCS2OBJS, ${START_SRCS}} | ||
|
||
all: ${BUILD}/common/libplat.a ${BUILD}/common/libaltc.a ${BUILD}/common/libs3k.a ${START_OBJS} | ||
|
||
${BUILD}/common/libplat.a: ${PLAT_OBJS} | ||
echo ${PLAT_OBJS} | ||
@mkdir -p ${@D} | ||
${AR} cr $@ $^ | ||
|
||
${BUILD}/common/libaltc.a: ${ALTC_OBJS} | ||
@mkdir -p ${@D} | ||
${AR} cr $@ $^ | ||
|
||
${BUILD}/common/libs3k.a: ${S3K_OBJS} | ||
@mkdir -p ${@D} | ||
${AR} cr $@ $^ | ||
|
||
${BUILD}/common/%.o: src/%.c | ||
@mkdir -p ${@D} | ||
${CC} -o $@ $< -c ${CFLAGS} | ||
|
||
${BUILD}/common/%.o: src/%.S | ||
@mkdir -p ${@D} | ||
${CC} -o $@ $< -c ${CFLAGS} | ||
clean: | ||
for i in ${PLATFORM}; do \ | ||
${MAKE} -f build.mk PLATFORM=$$i clean; \ | ||
done | ||
rm -rf ${BUILD} | ||
|
||
.PHONY: all | ||
.PHONY: all clean |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
ARCH=rv64imac_zicsr | ||
ABI=lp64 | ||
CMODEL=medany | ||
COMMON_INC=${ROOT}/common/inc | ||
COMMON_LIB=${ROOT}/common/plat/qemu_virt | ||
STARTFILES=${ROOT}/common/plat/qemu_virt/start | ||
export ARCH=rv64imac_zicsr | ||
export ABI=lp64 | ||
export CMODEL=medany | ||
export QEMU_MACHINE=virt | ||
export QEMU_SMP=4 | ||
export COMMON_INC=${ROOT}/common/inc | ||
export COMMON_LIB=${BUILD}/common | ||
export STARTFILES=${BUILD}/common/start | ||
PLAT_SRCS=src/drivers/uart/ns16550a.c src/drivers/time.c |
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,7 +1,9 @@ | ||
ARCH=rv64imac_zicsr | ||
ABI=lp64 | ||
CMODEL=medany | ||
COMMON_INC=${ROOT}/common/inc | ||
COMMON_LIB=${ROOT}/common/plat/sifive_unleashed | ||
STARTFILES=${ROOT}/common/plat/sifive_unleashed/start | ||
export ARCH=rv64imac_zicsr | ||
export ABI=lp64 | ||
export CMODEL=medany | ||
export QEMU_MACHINE=sifive_u | ||
export QEMU_SMP=5 | ||
export COMMON_INC=${ROOT}/common/inc | ||
export COMMON_LIB=${BUILD}/common | ||
export STARTFILES=${BUILD}/common/start | ||
PLAT_SRCS=src/drivers/uart/sifive.c src/drivers/time.c |
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
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 |
---|---|---|
@@ -1,21 +1,10 @@ | ||
BUILD ?=build | ||
S3K_CONF_H ?=s3k_conf.h | ||
APPS=boot monitor uartppp crypto app0 app1 | ||
|
||
SUBDIRS=../../kernel boot monitor uartppp crypto app0 app1 | ||
|
||
all: ${SUBDIRS} | ||
all: ${APPS} | ||
|
||
boot: monitor uartppp crypto | ||
|
||
${SUBDIRS}: | ||
@${MAKE} -C $@ all \ | ||
BUILD=${abspath ${BUILD}} \ | ||
S3K_CONF_H=${abspath ${S3K_CONF_H}} | ||
|
||
qemu gdb: all | ||
./scripts/$@.sh | ||
|
||
clean: | ||
rm -rf ${BUILD} | ||
${APPS}: | ||
@${MAKE} -f build.mk PROGRAM=$@ all | ||
|
||
.PHONY: all clean ${SUBDIRS} qemu gdb | ||
.PHONY: all ${APPS} |
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
Oops, something went wrong.