software: create liblitedram and move sdram init/test code to it.

This commit is contained in:
Florent Kermarrec 2020-05-18 22:39:59 +02:00
parent c95084e5c6
commit 920d0ee536
7 changed files with 34 additions and 5 deletions

View File

@ -25,6 +25,7 @@ __all__ = ["soc_software_packages", "soc_directory",
soc_software_packages = [ soc_software_packages = [
"libcompiler_rt", "libcompiler_rt",
"libbase", "libbase",
"liblitedram",
"libliteeth", "libliteeth",
"bios" "bios"
] ]

View File

@ -11,7 +11,6 @@ CFLAGS += -DTFTP_SERVER_PORT=$(TFTP_SERVER_PORT)
endif endif
OBJECTS = isr.o \ OBJECTS = isr.o \
sdram.o \
sdcard.o \ sdcard.o \
main.o \ main.o \
boot-helper.o \ boot-helper.o \
@ -59,15 +58,20 @@ endif
bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
%.elf: ../libbase/crt0-ctr.o ../libliteeth/libliteeth.a ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a %.elf: ../libbase/crt0-ctr.o \
../libcompiler_rt/libcompiler_rt.a \
../libbase/libbase-nofloat.a \
../liblitedram/liblitedram.a \
../libliteeth/libliteeth.a
$(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ $(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \
../libbase/crt0-ctr.o \ ../libbase/crt0-ctr.o \
$(OBJECTS) \ $(OBJECTS) \
-L../libliteeth \
-L../libbase \
-L../libcompiler_rt \ -L../libcompiler_rt \
-L../libbase \
-L../liblitedram \
-L../libliteeth \
$(BP_LIBS) \ $(BP_LIBS) \
-lliteeth -lbase-nofloat -lcompiler_rt \ -lcompiler_rt -lbase-nofloat -llitedram -lliteeth \
$(BP_FLAGS) $(BP_FLAGS)
ifneq ($(OS),Windows_NT) ifneq ($(OS),Windows_NT)

View File

@ -50,6 +50,7 @@ INCLUDES = -I$(SOC_DIRECTORY)/software/include/base \
-I$(SOC_DIRECTORY)/common \ -I$(SOC_DIRECTORY)/common \
-I$(BUILDINC_DIRECTORY) \ -I$(BUILDINC_DIRECTORY) \
-I$(CPU_DIRECTORY) \ -I$(CPU_DIRECTORY) \
-I$(SOC_DIRECTORY)/software/liblitedram \
-I$(SOC_DIRECTORY)/software/libliteeth -I$(SOC_DIRECTORY)/software/libliteeth
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes

View File

@ -0,0 +1,23 @@
include ../include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.mak
OBJECTS=sdram.o
all: liblitedram.a
liblitedram.a: $(OBJECTS)
$(AR) crs liblitedram.a $(OBJECTS)
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
%.o: $(LIBLITEDRAM_DIRECTORY)/%.c
$(compile)
%.o: %.S
$(assemble)
.PHONY: all clean
clean:
$(RM) $(OBJECTS) liblitedram.a .*~ *~