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.
This commit is contained in:
Florent Kermarrec 2020-06-23 12:23:26 +02:00
parent 384646c6be
commit d59cec5acc
3 changed files with 22 additions and 25 deletions

View File

@ -91,20 +91,6 @@ class Builder:
for k, v in export.get_cpu_mak(self.soc.cpu, self.compile_software): for k, v in export.get_cpu_mak(self.soc.cpu, self.compile_software):
define(k, v) 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( define(
"COMPILER_RT_DIRECTORY", "COMPILER_RT_DIRECTORY",
get_data_mod("software", "compiler_rt").data_location) get_data_mod("software", "compiler_rt").data_location)

View File

@ -58,7 +58,7 @@ endif
bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS) bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
%.elf: ../libbase/crt0-ctr.o \ %.elf: ../libbase/crt0.o \
../libcompiler_rt/libcompiler_rt.a \ ../libcompiler_rt/libcompiler_rt.a \
../libbase/libbase-nofloat.a \ ../libbase/libbase-nofloat.a \
../liblitedram/liblitedram.a \ ../liblitedram/liblitedram.a \
@ -66,7 +66,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
../liblitespi/liblitespi.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.o \
$(OBJECTS) \ $(OBJECTS) \
-L../libcompiler_rt \ -L../libcompiler_rt \
-L../libbase \ -L../libbase \

View File

@ -1,11 +1,25 @@
include ../include/generated/variables.mak include ../include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.mak include $(SOC_DIRECTORY)/software/common.mak
OBJECTS = exception.o libc.o errno.o crc16.o crc32.o console.o \ OBJECTS = exception.o \
system.o id.o uart.o time.o qsort.o strtod.o spiflash.o strcasecmp.o i2c.o \ libc.o \
div64.o progress.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 all: crt0.o libbase.a libbase-nofloat.a
libbase.a: $(OBJECTS) vsnprintf.o libbase.a: $(OBJECTS) vsnprintf.o
$(AR) crs 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 %.o: $(LIBBASE_DIRECTORY)/%.S
$(assemble) $(assemble)
crt0-ctr.o: $(CPU_DIRECTORY)/crt0.S crt0.o: $(CPU_DIRECTORY)/crt0.S
$(assemble) $(assemble)
crt0-xip.o: $(CPU_DIRECTORY)/crt0.S
$(CC) -c -DEXECUTE_IN_PLACE $(CFLAGS) -o $@ $<
.PHONY: all clean .PHONY: all clean
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 .*~ *~ $(RM) libbase.a libbase-nofloat.a .*~ *~