software: create liblitescard and move sdcard init/test code to it.

This commit is contained in:
Florent Kermarrec 2020-05-18 22:49:12 +02:00
parent 920d0ee536
commit 403355a8ed
8 changed files with 38 additions and 10 deletions

View File

@ -27,6 +27,7 @@ soc_software_packages = [
"libbase",
"liblitedram",
"libliteeth",
"liblitesdcard",
"bios"
]

View File

@ -11,18 +11,17 @@ CFLAGS += -DTFTP_SERVER_PORT=$(TFTP_SERVER_PORT)
endif
OBJECTS = isr.o \
sdcard.o \
main.o \
boot-helper.o \
boot.o \
helpers.o \
cmd_bios.o \
cmd_mem.o \
cmd_boot.o \
cmd_spiflash.o \
cmd_litedram.o \
cmd_liteeth.o \
cmd_mem.o \
cmd_litesdcard.o \
cmd_spiflash.o \
cmd_litesdcard.o \
main.o
ifneq "$(or $(TERM_NO_COMPLETE),$(TERM_MINI))" ""
CFLAGS += -DTERM_NO_COMPLETE
@ -62,7 +61,8 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
../libcompiler_rt/libcompiler_rt.a \
../libbase/libbase-nofloat.a \
../liblitedram/liblitedram.a \
../libliteeth/libliteeth.a
../libliteeth/libliteeth.a \
../liblitesdcard/liblitesdcard.a
$(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \
../libbase/crt0-ctr.o \
$(OBJECTS) \
@ -70,8 +70,9 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
-L../libbase \
-L../liblitedram \
-L../libliteeth \
-L../liblitesdcard \
$(BP_LIBS) \
-lcompiler_rt -lbase-nofloat -llitedram -lliteeth \
-lcompiler_rt -lbase-nofloat -llitedram -lliteeth -llitesdcard \
$(BP_FLAGS)
ifneq ($(OS),Windows_NT)

View File

@ -5,9 +5,10 @@
#include <generated/csr.h>
#include "sdram.h"
#include "../command.h"
#include "../helpers.h"
#include "../sdram.h"
/**
* Command "sdrrow"

View File

@ -5,9 +5,10 @@
#include <generated/csr.h>
#include "sdcard.h"
#include "../command.h"
#include "../helpers.h"
#include "../sdcard.h"
/**
* Command "sdclk"

View File

@ -51,7 +51,8 @@ INCLUDES = -I$(SOC_DIRECTORY)/software/include/base \
-I$(BUILDINC_DIRECTORY) \
-I$(CPU_DIRECTORY) \
-I$(SOC_DIRECTORY)/software/liblitedram \
-I$(SOC_DIRECTORY)/software/libliteeth
-I$(SOC_DIRECTORY)/software/libliteeth \
-I$(SOC_DIRECTORY)/software/liblitesdcard
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding

View File

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