Skip to content

Commit

Permalink
firmware: Update Makefiles, and linker scripts to support crt0-flash …
Browse files Browse the repository at this point in the history
…startup code.
  • Loading branch information
cr1901 committed Sep 22, 2018
1 parent 9b7d4f8 commit c0b6b1d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions firmware/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ include $(UIP_DIRECTORY)/Makefile.mk
LDFLAGS += \

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

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
4 changes: 2 additions & 2 deletions firmware/linker-flash.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)-flash.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)-flash.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 c0b6b1d

Please sign in to comment.