Add "self", example of building uvm32 to run inside uvm32

mandelbrot app is embedded in host-mini, which is then compiled to a .bin
This commit is contained in:
Toby Jaffey 2025-12-08 23:54:14 +00:00
parent 9be9e056cd
commit c37286cf01
5 changed files with 110 additions and 0 deletions

27
apps/self/Makefile Normal file
View file

@ -0,0 +1,27 @@
PROJECT:=self
DOCKER_IMAGE=riscv-dev
DOCKER_CMD:=docker run --rm -v ${PWD}../../../:/data -w /data/apps/${PROJECT} ${DOCKER_IMAGE}
PREFIX:=${DOCKER_CMD} riscv64-unknown-elf-
CFLAGS+=-I../../common -I../../uvm32 -DUVM32_MEMORY_SIZE=8192
CFLAGS+=-fno-stack-protector
CFLAGS+=-static-libgcc -fdata-sections -ffunction-sections
CFLAGS+=-g -Os -march=rv32ima_zicsr -mabi=ilp32 -static
LDFLAGS:= -T ../linker.ld -nostdlib -Wl,--gc-sections
LIBS:= #-lgcc # needed for softfp
SRCS=${PROJECT}.c ../../uvm32/uvm32.c ../crt0.S
all:
${PREFIX}gcc -o ${PROJECT}.elf ${CFLAGS} ${LDFLAGS} ${SRCS} ${LIBS}
$(PREFIX)objcopy ${PROJECT}.elf -O binary ${PROJECT}.bin
disasm: all
$(PREFIX)objdump -S -d -f ${PROJECT}.elf
test: all
../../host/host ${PWD}/${PROJECT}.bin
clean:
rm -f ${PROJECT}.o ${PROJECT}.elf ${PROJECT}.bin