Copy minimal example to make bootloader

This commit is contained in:
R
2024-04-12 18:07:43 +01:00
parent b2667a535a
commit 7e0ba7151b
5 changed files with 230 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
.PHONY: all clean
RV_ARCH = rv32imacxw
CC = riscv-none-elf-gcc
OBJDUMP = riscv-none-elf-objdump
CFLAGS = -ggdb3 -Os -march=$(RV_ARCH) -ffunction-sections -fdata-sections
LDFLAGS = -ggdb3 -march=$(RV_ARCH) -Wl,--gc-sections --specs=nosys.specs
all: bootloader.elf
bootloader.elf: startup.o bootloader.o
%.elf: linker.lds
$(CC) -Xlinker -Map=$(@:.elf=.map) -Wl,--script=linker.lds -nostartfiles -o $@ $(filter-out linker.lds,$+)
$(OBJDUMP) -xdsS $@ >$(@:.elf=.dump)
%.o: %.S
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o *.elf *.map *.dump