diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index 0b4eb9ae3..8d5fd35e8 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -43,7 +43,9 @@ soc_software_packages = [ "libcompiler_rt", # LiteX cores. - "libbase", + "libutils", + "libcomm", + "libmisc", # LiteX Ecosystem cores. "libfatfs", diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 6c0a6aac8..3e60247bf 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -56,9 +56,9 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) vpath %.a $(PACKAGES:%=../%) -%.elf: ../libbase/crt0.o $(LIBS:%=%.a) +%.elf: crt0.o $(LIBS:%=%.a) $(CC) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ - ../libbase/crt0.o \ + crt0.o \ $(OBJECTS) \ $(PACKAGES:%=-L../%) \ -Wl,--whole-archive \ @@ -85,6 +85,9 @@ endif boot-helper.o: $(CPU_DIRECTORY)/boot-helper.S $(assemble) +crt0.o: $(CPU_DIRECTORY)/crt0.S + $(assemble) + clean: $(RM) $(OBJECTS) bios.elf bios.bin .*~ *~ diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 0bb640b66..b40a910c0 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -10,10 +10,7 @@ #include #include #include -#include -#include #include -#include #include #include @@ -23,9 +20,13 @@ #include "sfl.h" #include "boot.h" -#include -#include +#include + +#include +#include +#include +#include #include #include diff --git a/litex/soc/software/bios/cmds/cmd_bios.c b/litex/soc/software/bios/cmds/cmd_bios.c index 25c69f602..e9869e3a1 100644 --- a/litex/soc/software/bios/cmds/cmd_bios.c +++ b/litex/soc/software/bios/cmds/cmd_bios.c @@ -2,9 +2,10 @@ #include #include -#include #include -#include + +#include +#include #include diff --git a/litex/soc/software/bios/cmds/cmd_i2c.c b/litex/soc/software/bios/cmds/cmd_i2c.c index cd6d9fa0d..8a934f31d 100644 --- a/litex/soc/software/bios/cmds/cmd_i2c.c +++ b/litex/soc/software/bios/cmds/cmd_i2c.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include "../command.h" #include "../helpers.h" diff --git a/litex/soc/software/bios/cmds/cmd_litedram.c b/litex/soc/software/bios/cmds/cmd_litedram.c index 25c76035d..3e6746ded 100644 --- a/litex/soc/software/bios/cmds/cmd_litedram.c +++ b/litex/soc/software/bios/cmds/cmd_litedram.c @@ -4,11 +4,11 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/litex/soc/software/bios/cmds/cmd_mem.c b/litex/soc/software/bios/cmds/cmd_mem.c index 16687a7e0..c1adffb5e 100644 --- a/litex/soc/software/bios/cmds/cmd_mem.c +++ b/litex/soc/software/bios/cmds/cmd_mem.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/litex/soc/software/bios/helpers.c b/litex/soc/software/bios/helpers.c index 6d60e7f30..c5387e1c6 100644 --- a/litex/soc/software/bios/helpers.c +++ b/litex/soc/software/bios/helpers.c @@ -3,10 +3,11 @@ // SPDX-License-Identifier: BSD-Source-Code #include -#include -#include #include +#include +#include + #include "readline.h" #include "helpers.h" #include "command.h" diff --git a/litex/soc/software/bios/isr.c b/litex/soc/software/bios/isr.c index 00e28bec1..77bf6c8a2 100644 --- a/litex/soc/software/bios/isr.c +++ b/litex/soc/software/bios/isr.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #if defined(__microwatt__) diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index 3519cfecb..0bcb27f4f 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -17,12 +17,9 @@ #include #include -#include #include -#include #include #include -#include #include "boot.h" #include "readline.h" @@ -34,7 +31,11 @@ #include #include -#include +#include +#include + +#include +#include #include diff --git a/litex/soc/software/bios/readline.c b/litex/soc/software/bios/readline.c index dd27d7bfe..d386a84a5 100644 --- a/litex/soc/software/bios/readline.c +++ b/litex/soc/software/bios/readline.c @@ -13,9 +13,6 @@ #include #include -#include -#include - #include "readline.h" #include "complete.h" diff --git a/litex/soc/software/bios/readline_simple.c b/litex/soc/software/bios/readline_simple.c index b602a6fba..e3e1ab706 100644 --- a/litex/soc/software/bios/readline_simple.c +++ b/litex/soc/software/bios/readline_simple.c @@ -8,9 +8,6 @@ #include #include -#include -#include - #include "readline.h" int readline(char *s, int size) diff --git a/litex/soc/software/libbase/Makefile b/litex/soc/software/libbase/Makefile deleted file mode 100755 index 2b255aa5d..000000000 --- a/litex/soc/software/libbase/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -include ../include/generated/variables.mak -include $(SOC_DIRECTORY)/software/common.mak - -OBJECTS = exception.o \ - crc16.o \ - crc32.o \ - system.o \ - uart.o \ - spiflash.o \ - i2c.o \ - progress.o \ - memtest.o \ - sim_debug.o - -all: crt0.o libbase.a - -libbase.a: $(OBJECTS) - $(AR) crs libbase.a $(OBJECTS) - -# pull in dependency info for *existing* .o files --include $(OBJECTS:.o=.d) - -%.o: $(LIBBASE_DIRECTORY)/%.c - $(compile) - -%.o: $(LIBBASE_DIRECTORY)/%.S - $(assemble) - -crt0.o: $(CPU_DIRECTORY)/crt0.S - $(assemble) - -.PHONY: all clean - -clean: - $(RM) $(OBJECTS) crt0.o - $(RM) libbase.a .*~ *~ diff --git a/litex/soc/software/libc/iob.c b/litex/soc/software/libc/iob.c index 9479c4e24..203cdf527 100644 --- a/litex/soc/software/libc/iob.c +++ b/litex/soc/software/libc/iob.c @@ -1,7 +1,7 @@ #include -#include -#include +#include +#include #include diff --git a/litex/soc/software/libcomm/Makefile b/litex/soc/software/libcomm/Makefile new file mode 100755 index 000000000..7b25f1c25 --- /dev/null +++ b/litex/soc/software/libcomm/Makefile @@ -0,0 +1,24 @@ +include ../include/generated/variables.mak +include $(SOC_DIRECTORY)/software/common.mak + +OBJECTS = \ + uart.o \ + spiflash.o \ + i2c.o \ + +all: libcomm.a + +libcomm.a: $(OBJECTS) + $(AR) crs libcomm.a $(OBJECTS) + +# pull in dependency info for *existing* .o files +-include $(OBJECTS:.o=.d) + +%.o: $(LIBCOMM_DIRECTORY)/%.c + $(compile) + +.PHONY: all clean + +clean: + $(RM) $(OBJECTS) + $(RM) libcomm.a .*~ *~ diff --git a/litex/soc/software/libbase/i2c.c b/litex/soc/software/libcomm/i2c.c similarity index 99% rename from litex/soc/software/libbase/i2c.c rename to litex/soc/software/libcomm/i2c.c index 57827c8f6..c6af33765 100644 --- a/litex/soc/software/libbase/i2c.c +++ b/litex/soc/software/libcomm/i2c.c @@ -1,5 +1,6 @@ // This file is Copyright (c) 2020 Antmicro -#include +#include "i2c.h" + #include #ifdef CSR_I2C_BASE diff --git a/litex/soc/software/include/base/i2c.h b/litex/soc/software/libcomm/i2c.h similarity index 100% rename from litex/soc/software/include/base/i2c.h rename to litex/soc/software/libcomm/i2c.h diff --git a/litex/soc/software/libbase/spiflash.c b/litex/soc/software/libcomm/spiflash.c similarity index 99% rename from litex/soc/software/libbase/spiflash.c rename to litex/soc/software/libcomm/spiflash.c index 936cee303..e39c9a8fc 100644 --- a/litex/soc/software/libbase/spiflash.c +++ b/litex/soc/software/libcomm/spiflash.c @@ -2,7 +2,7 @@ #if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE) -#include +#include "spiflash.h" #define PAGE_PROGRAM_CMD 0x02 #define WRDI_CMD 0x04 diff --git a/litex/soc/software/include/base/spiflash.h b/litex/soc/software/libcomm/spiflash.h similarity index 100% rename from litex/soc/software/include/base/spiflash.h rename to litex/soc/software/libcomm/spiflash.h diff --git a/litex/soc/software/libbase/uart.c b/litex/soc/software/libcomm/uart.c similarity index 99% rename from litex/soc/software/libbase/uart.c rename to litex/soc/software/libcomm/uart.c index 636e023c3..c63727476 100644 --- a/litex/soc/software/libbase/uart.c +++ b/litex/soc/software/libcomm/uart.c @@ -1,4 +1,5 @@ -#include +#include "uart.h" + #include #include diff --git a/litex/soc/software/include/base/uart.h b/litex/soc/software/libcomm/uart.h similarity index 100% rename from litex/soc/software/include/base/uart.h rename to litex/soc/software/libcomm/uart.h diff --git a/litex/soc/software/liblitedram/sdram.c b/litex/soc/software/liblitedram/sdram.c index 50ccdf2b4..1f543b3e1 100644 --- a/litex/soc/software/liblitedram/sdram.c +++ b/litex/soc/software/liblitedram/sdram.c @@ -14,8 +14,9 @@ #include #include -#include -#include + +#include +#include #ifdef CSR_SDRAM_BASE #include diff --git a/litex/soc/software/libliteeth/tftp.c b/litex/soc/software/libliteeth/tftp.c index 1a7c247e0..c2ab86d67 100644 --- a/litex/soc/software/libliteeth/tftp.c +++ b/litex/soc/software/libliteeth/tftp.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include "udp.h" #include "tftp.h" diff --git a/litex/soc/software/libliteeth/udp.c b/litex/soc/software/libliteeth/udp.c index dd434facb..330393962 100644 --- a/litex/soc/software/libliteeth/udp.c +++ b/litex/soc/software/libliteeth/udp.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "udp.h" diff --git a/litex/soc/software/liblitespi/spiflash.c b/litex/soc/software/liblitespi/spiflash.c index c463b39b8..d2e2f05b5 100644 --- a/litex/soc/software/liblitespi/spiflash.c +++ b/litex/soc/software/liblitespi/spiflash.c @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/litex/soc/software/libmisc/Makefile b/litex/soc/software/libmisc/Makefile new file mode 100755 index 000000000..94ba97dfc --- /dev/null +++ b/litex/soc/software/libmisc/Makefile @@ -0,0 +1,23 @@ +include ../include/generated/variables.mak +include $(SOC_DIRECTORY)/software/common.mak + +OBJECTS = \ + exception.o \ + sim_debug.o + +all: libmisc.a + +libmisc.a: $(OBJECTS) + $(AR) crs libmisc.a $(OBJECTS) + +# pull in dependency info for *existing* .o files +-include $(OBJECTS:.o=.d) + +%.o: $(LIBMISC_DIRECTORY)/%.c + $(compile) + +.PHONY: all clean + +clean: + $(RM) $(OBJECTS) + $(RM) libmisc.a .*~ *~ diff --git a/litex/soc/software/libbase/exception.c b/litex/soc/software/libmisc/exception.c similarity index 100% rename from litex/soc/software/libbase/exception.c rename to litex/soc/software/libmisc/exception.c diff --git a/litex/soc/software/libbase/sim_debug.c b/litex/soc/software/libmisc/sim_debug.c similarity index 97% rename from litex/soc/software/libbase/sim_debug.c rename to litex/soc/software/libmisc/sim_debug.c index 30a37a9a6..d7644b90d 100644 --- a/litex/soc/software/libbase/sim_debug.c +++ b/litex/soc/software/libmisc/sim_debug.c @@ -1,4 +1,4 @@ -#include +#include "sim_debug.h" #include #include diff --git a/litex/soc/software/include/base/sim_debug.h b/litex/soc/software/libmisc/sim_debug.h similarity index 100% rename from litex/soc/software/include/base/sim_debug.h rename to litex/soc/software/libmisc/sim_debug.h diff --git a/litex/soc/software/libutils/Makefile b/litex/soc/software/libutils/Makefile new file mode 100755 index 000000000..7dc3dbc8d --- /dev/null +++ b/litex/soc/software/libutils/Makefile @@ -0,0 +1,26 @@ +include ../include/generated/variables.mak +include $(SOC_DIRECTORY)/software/common.mak + +OBJECTS = \ + crc16.o \ + crc32.o \ + system.o \ + progress.o \ + memtest.o + +all: libutils.a + +libutils.a: $(OBJECTS) + $(AR) crs libutils.a $(OBJECTS) + +# pull in dependency info for *existing* .o files +-include $(OBJECTS:.o=.d) + +%.o: $(LIBUTILS_DIRECTORY)/%.c + $(compile) + +.PHONY: all clean + +clean: + $(RM) $(OBJECTS) + $(RM) libutils.a .*~ *~ diff --git a/litex/soc/software/include/base/console.h b/litex/soc/software/libutils/console.h similarity index 100% rename from litex/soc/software/include/base/console.h rename to litex/soc/software/libutils/console.h diff --git a/litex/soc/software/include/base/crc.h b/litex/soc/software/libutils/crc.h similarity index 100% rename from litex/soc/software/include/base/crc.h rename to litex/soc/software/libutils/crc.h diff --git a/litex/soc/software/libbase/crc16.c b/litex/soc/software/libutils/crc16.c similarity index 99% rename from litex/soc/software/libbase/crc16.c rename to litex/soc/software/libutils/crc16.c index 6fc6de761..732c3c587 100644 --- a/litex/soc/software/libbase/crc16.c +++ b/litex/soc/software/libutils/crc16.c @@ -1,4 +1,4 @@ -#include +#include "crc.h" #ifndef SMALL_CRC static const unsigned int crc16_table[256] = { diff --git a/litex/soc/software/libbase/crc32.c b/litex/soc/software/libutils/crc32.c similarity index 99% rename from litex/soc/software/libbase/crc32.c rename to litex/soc/software/libutils/crc32.c index 07abbd9b2..54bdf8750 100644 --- a/litex/soc/software/libbase/crc32.c +++ b/litex/soc/software/libutils/crc32.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include +#include "crc.h" #ifndef SMALL_CRC static const unsigned int crc_table[256] = { diff --git a/litex/soc/software/include/base/jsmn.h b/litex/soc/software/libutils/jsmn.h similarity index 100% rename from litex/soc/software/include/base/jsmn.h rename to litex/soc/software/libutils/jsmn.h diff --git a/litex/soc/software/include/base/lfsr.h b/litex/soc/software/libutils/lfsr.h similarity index 100% rename from litex/soc/software/include/base/lfsr.h rename to litex/soc/software/libutils/lfsr.h diff --git a/litex/soc/software/libbase/memtest.c b/litex/soc/software/libutils/memtest.c similarity index 99% rename from litex/soc/software/libbase/memtest.c rename to litex/soc/software/libutils/memtest.c index 598db5480..52de87520 100644 --- a/litex/soc/software/libbase/memtest.c +++ b/litex/soc/software/libutils/memtest.c @@ -1,7 +1,7 @@ -#include +#include "memtest.h" +#include "lfsr.h" #include -#include #include #include diff --git a/litex/soc/software/include/base/memtest.h b/litex/soc/software/libutils/memtest.h similarity index 100% rename from litex/soc/software/include/base/memtest.h rename to litex/soc/software/libutils/memtest.h diff --git a/litex/soc/software/libbase/progress.c b/litex/soc/software/libutils/progress.c similarity index 96% rename from litex/soc/software/libbase/progress.c rename to litex/soc/software/libutils/progress.c index 1b46fb6d8..d4d510c69 100644 --- a/litex/soc/software/libbase/progress.c +++ b/litex/soc/software/libutils/progress.c @@ -17,12 +17,11 @@ * */ -#include #include #include #include -#include +#include "progress.h" #define FILESIZE_MAX 100000000 #define HASHES_PER_LINE 40 diff --git a/litex/soc/software/include/base/progress.h b/litex/soc/software/libutils/progress.h similarity index 100% rename from litex/soc/software/include/base/progress.h rename to litex/soc/software/libutils/progress.h diff --git a/litex/soc/software/libbase/system.c b/litex/soc/software/libutils/system.c similarity index 100% rename from litex/soc/software/libbase/system.c rename to litex/soc/software/libutils/system.c