mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-06 06:53:39 +00:00
Non-working c3 example
crt0.S comments are a problem and asm format is different
This commit is contained in:
parent
c691c3ebdf
commit
3efe58ac3c
2 changed files with 53 additions and 0 deletions
34
apps/c3-hello/Makefile
Normal file
34
apps/c3-hello/Makefile
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
PROJECT:=c3-hello
|
||||
|
||||
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
|
||||
|
||||
SRCS_C3 := $(wildcard *.c3)
|
||||
|
||||
default: ${PROJECT}.bin
|
||||
|
||||
${PROJECT}.a: $(SRCS_C3)
|
||||
c3c --use-stdlib=no --no-entry --target elf-riscv32 static-lib $(SRCS_C3)
|
||||
|
||||
crt0.o: ../crt0.s
|
||||
${PREFIX}gcc ${CFLAGS} -c -o crt0.o ../crt0.s
|
||||
|
||||
#${PROJECT}.elf: ${PROJECT}.a crt0.o ../linker.ld
|
||||
# ${PREFIX}ld ${LDFLAGS} -o ${PROJECT}.elf crt0.o hello.a
|
||||
|
||||
${PROJECT}.elf: ${PROJECT}.a ../linker.ld
|
||||
${PREFIX}gcc -o ${PROJECT}.elf ${CFLAGS} ${LDFLAGS} ../crt0.s hello.a
|
||||
|
||||
${PROJECT}.bin: ${PROJECT}.elf
|
||||
$(PREFIX)objcopy ${PROJECT}.elf -O binary ${PROJECT}.bin
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a ${PROJECT}.elf ${PROJECT}.bin
|
||||
19
apps/c3-hello/hello.c3
Normal file
19
apps/c3-hello/hello.c3
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
//static uint32_t syscall(uint32_t id, uint32_t param) {
|
||||
// register uint32_t a0 asm("a0") = (uint32_t)(param);
|
||||
// register uint32_t a1 asm("a1");
|
||||
// register uint32_t a7 asm("a7") = (uint32_t)(id);
|
||||
//
|
||||
// asm volatile (
|
||||
// "ecall"
|
||||
// : "=r"(a1) // output
|
||||
// : "r"(a0), "r"(a7) // input
|
||||
// : "memory"
|
||||
// );
|
||||
// return a1;
|
||||
//}
|
||||
|
||||
fn void main() @export("main") {
|
||||
int x = 42;
|
||||
TBD
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue