Skip to content

Commit

Permalink
Merge pull request #67 from cr1901/data-crt0
Browse files Browse the repository at this point in the history
firmware: Update litex submodule, Makefiles, and linker scripts to support crt0-flash startup code.
  • Loading branch information
mithro committed Oct 1, 2018
2 parents 585c1d4 + 2f9efff commit 5760a16
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions firmware/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ include $(UIP_DIRECTORY)/Makefile.mk
LDFLAGS += \

ifeq ($(COPY_TO_MAIN_RAM), 1)
LINKER_LD = linker.ld
CRT0 = ../libbase/crt0-$(CPU)-ctr.o
LINKER_LD = linker-ctr.ld
else
LINKER_LD = linker-flash.ld
CRT0 = ../libbase/crt0-$(CPU)-xip.o
LINKER_LD = linker-xip.ld
endif

all: firmware.bin firmware.fbi
Expand All @@ -82,11 +84,11 @@ all: firmware.bin firmware.fbi

firmware.elf: $(FIRMWARE_DIRECTORY)/$(LINKER_LD) $(OBJECTS)

%.elf: ../libbase/crt0-$(CPU).o ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a ../uip/libuip.a
%.elf: $(CRT0) ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a ../uip/libuip.a
$(LD) $(LDFLAGS) \
-T $(FIRMWARE_DIRECTORY)/$(LINKER_LD) \
-N -o $@ \
../libbase/crt0-$(CPU).o \
$(CRT0) \
$(OBJECTS) \
-L../libbase \
-lbase-nofloat \
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions firmware/linker-flash.ld → firmware/linker-xip.ld
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ SECTIONS
_erodata = .;
} > user_flash

.data :
.data : AT (ADDR(.rodata) + SIZEOF (.rodata))
{
. = ALIGN(4);
_fdata = .;
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
_gp = ALIGN(16);
*(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .;
_edata = ALIGN(16); /* Make sure _edata is >= _gp. */
} > sram

.bss :
Expand Down
4 changes: 2 additions & 2 deletions firmware/stub/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ all: firmware.bin firmware.fbi

firmware.elf: $(STUB_DIRECTORY)/$(LINKER_LD) $(OBJECTS)

%.elf: ../libbase/crt0-$(CPU).o ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a
%.elf: ../libbase/crt0-$(CPU)-xip.o ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a
$(LD) $(LDFLAGS) \
-T $(STUB_DIRECTORY)/$(LINKER_LD) \
-N -o $@ \
../libbase/crt0-$(CPU).o \
../libbase/crt0-$(CPU)-xip.o \
$(OBJECTS) \
-L../libbase \
-lbase-nofloat \
Expand Down
4 changes: 2 additions & 2 deletions firmware/stub/linker.ld
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ SECTIONS
_erodata = .;
} > user_flash

.data :
.data : AT (ADDR(.rodata) + SIZEOF (.rodata))
{
. = ALIGN(4);
_fdata = .;
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
_gp = ALIGN(16);
*(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .;
_edata = ALIGN(16); /* Make sure _edata is >= _gp. */
} > sram

.bss :
Expand Down

0 comments on commit 5760a16

Please sign in to comment.