mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
uvm32 initial version
This commit is contained in:
commit
c9d30b6d28
34 changed files with 2088 additions and 0 deletions
27
apps/sketch/Makefile
Normal file
27
apps/sketch/Makefile
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
PROJECT:=sketch
|
||||
|
||||
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
|
||||
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 ../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
|
||||
../../emulator/emulator ${PWD}/${PROJECT}.bin
|
||||
|
||||
clean:
|
||||
rm -f ${PROJECT}.o ${PROJECT}.elf ${PROJECT}.bin
|
||||
|
||||
18
apps/sketch/sketch.c
Normal file
18
apps/sketch/sketch.c
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "uvm32_target.h"
|
||||
|
||||
uint32_t count;
|
||||
|
||||
bool loop(void) {
|
||||
printd(count);
|
||||
if (count++ >= 10) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue