master
Alessandro Mauri 1 year ago
parent 8f27b1a576
commit 1c0b7f92f9
  1. 0
      kernel/-kernel
  2. 1
      kernel/.gitignore
  3. 12
      kernel/Makefile
  4. BIN
      kernel/kernel
  5. 2
      qemu_run.sh

1
kernel/.gitignore vendored

@ -1,4 +1,5 @@
**/*.o
*.img
*.elf
*.sym
compile_commands.json

@ -1,6 +1,7 @@
CC = $(TARGET)-gcc
LD = $(TARGET)-ld
AS = $(TARGET)-gcc
OBJCOPY = $(TARGET)-objcopy
KERN_WARNINGS = -Wall -Wextra -Wpedantic -Wuninitialized -Wunused-result
KERN_FLAGS = -ffreestanding -nostartfiles -nostdlib -nodefaultlibs --std=gnu2x
@ -8,7 +9,7 @@ MACHINE_FLAGS = -march=rv64gc -mabi=lp64 -mcmodel=medany
PATH_FLAGS = -I./
CFLAGS = ${MACHINE_FLAGS} -g -O0 ${KERN_WARNINGS} ${KERN_FLAGS} ${PATH_FLAGS}
LDFLAGS = -m elf64lriscv --gc-sections -T rv64-sifive_u.ld
LDFLAGS = -m elf64lriscv --gc-sections -nostdlib -T rv64-sifive_u.ld
ASFLAGS = ${CFLAGS}
.SUFFIXES: .c .o .S
@ -19,9 +20,15 @@ ASFLAGS = ${CFLAGS}
.S.o:
${AS} ${ASFLAGS} -o $@ -c $<
.PHONY: all test clean
all: kernel.elf kernel.sym
kernel.elf: kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o
${LD} ${LDFLAGS} -o kernel.elf kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o
kernel.sym: kernel.elf
${OBJCOPY} --only-keep-debug kernel.elf kernel.sym
kernel.o: kernel.c
platform/FU740/uart.o: platform/FU740/uart.c
@ -30,9 +37,6 @@ platform/FU740/clock.o: platform/FU740/clock.c
crt0.o: crt0.S
.PHONY: all test clean
all: kernel.img
test:
clean:

Binary file not shown.

@ -15,7 +15,7 @@ kern_img=''
while [ "${1:-}" != "" ]; do
case "$1" in
"--debug")
EMU_EXTRA='-D'
EMU_EXTRA='-S'
;;
"--dump-dts"|"--dump")
# shellcheck disable=SC2086

Loading…
Cancel
Save