software: create liblitespi and mode litespi code to it (with some parts commented out for now).

This commit is contained in:
Florent Kermarrec 2020-05-20 09:32:45 +02:00
parent 61238beeae
commit c3a03d0d99
6 changed files with 39 additions and 10 deletions

View File

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

View File

@ -62,6 +62,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
../libbase/libbase-nofloat.a \ ../libbase/libbase-nofloat.a \
../liblitedram/liblitedram.a \ ../liblitedram/liblitedram.a \
../libliteeth/libliteeth.a \ ../libliteeth/libliteeth.a \
../liblitespi/liblitespi.a \
../liblitesdcard/liblitesdcard.a ../liblitesdcard/liblitesdcard.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 \
@ -70,9 +71,10 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
-L../libbase \ -L../libbase \
-L../liblitedram \ -L../liblitedram \
-L../libliteeth \ -L../libliteeth \
-L../liblitespi \
-L../liblitesdcard \ -L../liblitesdcard \
$(BP_LIBS) \ $(BP_LIBS) \
-lcompiler_rt -llitedram -lliteeth -llitesdcard -lbase-nofloat \ -lcompiler_rt -llitedram -lliteeth -llitespi -llitesdcard -lbase-nofloat \
$(BP_FLAGS) $(BP_FLAGS)
ifneq ($(OS),Windows_NT) ifneq ($(OS),Windows_NT)

View File

@ -44,7 +44,7 @@
#include "sdram.h" #include "sdram.h"
#include "sdcard.h" #include "sdcard.h"
#include "spi.h" //#include "spi.h"
#include "boot.h" #include "boot.h"
#include "readline.h" #include "readline.h"
#include "helpers.h" #include "helpers.h"
@ -135,9 +135,9 @@ int main(int i, char **c)
printf("Memory initialization failed\n"); printf("Memory initialization failed\n");
printf("\n"); printf("\n");
#endif #endif
#ifdef CSR_SPI_BASE //#ifdef CSR_SPI_BASE
spi_autoconfig(); // spi_autoconfig();
#endif //#endif
if(sdr_ok) { if(sdr_ok) {
printf("--============== \e[1mBoot\e[0m ==================--\n"); printf("--============== \e[1mBoot\e[0m ==================--\n");

View File

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

View File

@ -8,10 +8,11 @@
#include <generated/csr.h> #include <generated/csr.h>
#include <generated/mem.h> #include <generated/mem.h>
#include <hw/flags.h>
#include <system.h> #include <system.h>
#include "spi.h" #include "spiflash.h"
#ifdef SPIXIP_BASE
#define DEBUG 0 #define DEBUG 0
#define USER_DEFINED_DUMMY_BITS 0 #define USER_DEFINED_DUMMY_BITS 0
@ -60,6 +61,8 @@ int spi_frequency_test(void)
return lowest_div; return lowest_div;
} }
#endif
void spi_dummy_bits_setup(unsigned int dummy_bits) void spi_dummy_bits_setup(unsigned int dummy_bits)
{ {
spi_dummy_bits_write((uint32_t)dummy_bits); spi_dummy_bits_write((uint32_t)dummy_bits);

View File

@ -1,5 +1,5 @@
#ifndef __SPI_H #ifndef __LITESPI_FLASH_H
#define __SPI_H #define __LITESPI_FLASH_H
#include <generated/csr.h> #include <generated/csr.h>
@ -15,4 +15,4 @@ int spi_frequency_test(void);
void spi_dummy_bits_setup(unsigned int dummy_bits); void spi_dummy_bits_setup(unsigned int dummy_bits);
void spi_autoconfig(void); void spi_autoconfig(void);
#endif /* __SPI_H */ #endif /* __LITESPI_FLASH_H */