From d59cec5accdb95372589e93620f23e20511e616a Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 23 Jun 2020 12:23:26 +0200 Subject: [PATCH] software: use a single crt0 (deprecate crt0-ctr/crt0-xip) and avoid unnecessary defines. Since https://github.com/enjoy-digital/litex/issues/566, crt0-ctr and crt0-xip are now similiar so we can get back to a single crt0 and remove the defines that were generated to distinguish the different cases. Since LiteX/MiSoC have diverged and are no longer compatible, we also no longer need to generate the LiteX flag. --- litex/soc/integration/builder.py | 14 ------------- litex/soc/software/bios/Makefile | 4 ++-- litex/soc/software/libbase/Makefile | 31 +++++++++++++++++++---------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index ef7e45e6..e625c588 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -91,20 +91,6 @@ class Builder: for k, v in export.get_cpu_mak(self.soc.cpu, self.compile_software): define(k, v) - # Distinguish between LiteX and MiSoC. - define("LITEX", "1") - # Distinguish between applications running from main RAM and - # flash for user-provided software packages. - exec_profiles = { - "COPY_TO_MAIN_RAM" : "0", - "EXECUTE_IN_PLACE" : "0" - } - if "main_ram" in self.soc.mem_regions.keys(): - exec_profiles["COPY_TO_MAIN_RAM"] = "1" - else: - exec_profiles["EXECUTE_IN_PLACE"] = "1" - for k, v in exec_profiles.items(): - define(k, v) define( "COMPILER_RT_DIRECTORY", get_data_mod("software", "compiler_rt").data_location) diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 35bff237..778757da 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -58,7 +58,7 @@ endif bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) -%.elf: ../libbase/crt0-ctr.o \ +%.elf: ../libbase/crt0.o \ ../libcompiler_rt/libcompiler_rt.a \ ../libbase/libbase-nofloat.a \ ../liblitedram/liblitedram.a \ @@ -66,7 +66,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) ../liblitespi/liblitespi.a \ ../liblitesdcard/liblitesdcard.a $(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ - ../libbase/crt0-ctr.o \ + ../libbase/crt0.o \ $(OBJECTS) \ -L../libcompiler_rt \ -L../libbase \ diff --git a/litex/soc/software/libbase/Makefile b/litex/soc/software/libbase/Makefile index 5974e000..1094ac57 100755 --- a/litex/soc/software/libbase/Makefile +++ b/litex/soc/software/libbase/Makefile @@ -1,11 +1,25 @@ include ../include/generated/variables.mak include $(SOC_DIRECTORY)/software/common.mak -OBJECTS = exception.o libc.o errno.o crc16.o crc32.o console.o \ - system.o id.o uart.o time.o qsort.o strtod.o spiflash.o strcasecmp.o i2c.o \ - div64.o progress.o - -all: crt0-ctr.o crt0-xip.o libbase.a libbase-nofloat.a +OBJECTS = exception.o \ + libc.o \ + errno.o \ + crc16.o \ + crc32.o \ + console.o \ + system.o \ + id.o \ + uart.o \ + time.o \ + qsort.o \ + strtod.o \ + spiflash.o \ + strcasecmp.o \ + i2c.o \ + div64.o \ + progress.o + +all: crt0.o libbase.a libbase-nofloat.a libbase.a: $(OBJECTS) vsnprintf.o $(AR) crs libbase.a $(OBJECTS) vsnprintf.o @@ -25,14 +39,11 @@ vsnprintf-nofloat.o: $(LIBBASE_DIRECTORY)/vsnprintf.c %.o: $(LIBBASE_DIRECTORY)/%.S $(assemble) -crt0-ctr.o: $(CPU_DIRECTORY)/crt0.S +crt0.o: $(CPU_DIRECTORY)/crt0.S $(assemble) -crt0-xip.o: $(CPU_DIRECTORY)/crt0.S - $(CC) -c -DEXECUTE_IN_PLACE $(CFLAGS) -o $@ $< - .PHONY: all clean clean: - $(RM) $(OBJECTS) crt0-$(CPU).o crt0-$(CPU)-flash.o vsnprintf.o vsnprintf-nofloat.o + $(RM) $(OBJECTS) crt0.o vsnprintf.o vsnprintf-nofloat.o $(RM) libbase.a libbase-nofloat.a .*~ *~ -- 2.30.2