aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/mips/Makefile.inc63
-rw-r--r--src/arch/mips/bootblock.ld1
-rw-r--r--src/arch/mips/ramstage.ld1
-rw-r--r--src/arch/mips/romstage.ld1
4 files changed, 11 insertions, 55 deletions
diff --git a/src/arch/mips/Makefile.inc b/src/arch/mips/Makefile.inc
index 42c3007754..9636333e39 100644
--- a/src/arch/mips/Makefile.inc
+++ b/src/arch/mips/Makefile.inc
@@ -35,6 +35,8 @@ endif
ifeq ($(CONFIG_ARCH_BOOTBLOCK_MIPS),y)
bootblock-y += boot.c
+bootblock-y += bootblock.S
+bootblock-y += bootblock_simple.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += early_console.c
bootblock-y += stages.c
bootblock-y += timer.c
@@ -44,44 +46,15 @@ bootblock-y += ../../lib/memset.c
bootblock_lds = $(src)/arch/mips/bootblock.ld
-bootblock_inc += $(src)/arch/mips/bootblock.S
-bootblock_inc += $(objgenerated)/bootblock.inc
-
# Much of the assembly code is generated by the compiler, and may contain
# terms which the preprocessor will happily go on to replace. For example
# "mips" would be replaced with "1". Clear all the built in definitions to
# prevent that.
bootblock-S-ccopts += -undef
-$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
- @printf " GEN $(subst $(obj)/,,$(@))\n"
- printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@
-
-$(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
- @printf " GEN $(subst $(obj)/,,$(@))\n"
- printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@
-
-$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) $(bootblock-S-ccopts) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
-
-$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) $(bootblock-S-ccopts) -MMD -x assembler-with-cpp -E \
- -I$(src)/include -I$(src)/arch/mips/include -I$(obj) \
- -include $(obj)/build.h -include $(obj)/config.h -I. \
- -I$(src) $< -o $@
-
-$(objgenerated)/bootblock.inc: $(src)/arch/mips/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(bootblock_custom) $(obj)/config.h
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) $(bootblock-c-ccopts) $(CFLAGS_bootblock) -MM \
- -MT$(objgenerated)/bootblock.inc \
- $< > $(objgenerated)/bootblock.inc.d
- $(CC_bootblock) $(bootblock-c-ccopts) -c -S $(CFLAGS_bootblock) -I. $< -o $@
-
-$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld $$(bootblock-objs) $(obj)/config.h
+$(objcbfs)/bootblock.debug: $(src)/arch/mips/bootblock.ld $$(bootblock-objs) $(obj)/config.h $(obj)/ldoptions
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(CC_bootblock) $(CFLAGS_bootblock) -nostdlib -Wl,--gc-sections -nostartfiles -include $(obj)/config.h -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $(objgenerated)/bootblock.o $(bootblock-objs) -Wl,--end-group
+ $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/bootblock.ld --start-group $(bootblock-objs) --end-group
endif # CONFIG_ARCH_BOOTBLOCK_MIPS
@@ -99,17 +72,9 @@ romstage-y += ../../lib/memcpy.c
romstage-y += ../../lib/memmove.c
romstage-y += ../../lib/memset.c
-romstage-lds = $(src)/arch/mips/romstage.ld
-
-$(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld
+$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/mips/romstage.ld $(obj)/ldoptions
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(CC_romstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage.ld -Wl,--start-group $(romstage-objs) -Wl,--end-group
-
-$(objgenerated)/romstage.ld: $$(romstage-lds) $(obj)/ldoptions
- @printf " GEN $(subst $(obj)/,,$(@))\n"
- rm -f $@
- printf '$(foreach ldscript,ldoptions $(romstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
- mv $@.tmp $@
+ $(LD_romstage) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/romstage.ld --start-group $(romstage-objs) --end-group
endif # CONFIG_ARCH_ROMSTAGE_MIPS
@@ -129,20 +94,8 @@ ramstage-y += ../../lib/memmove.c
ramstage-y += ../../lib/memset.c
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
-ramstage-lds = $(src)/arch/mips/ramstage.ld
-
-$(objgenerated)/ramstage.ld: $$(ramstage-lds) $(obj)/ldoptions
- @printf " GEN $(subst $(obj)/,,$(@))\n"
- rm -f $@
- printf '$(foreach ldscript,ldoptions $(ramstage-lds),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp
- mv $@.tmp $@
-
-$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(objgenerated)/ramstage.ld
- @printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_ramstage) -nostdlib -Wl,--gc-sections -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/ramstage.ld $<
-
-$(objgenerated)/ramstage.o: $$(ramstage-objs)
+$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/mips/ramstage.ld $(obj)/ldoptions
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--start-group $(ramstage-objs) -Wl,--end-group
+ $(LD_ramstage) --gc-sections -static -o $@ -L$(obj) -T $(src)/arch/mips/ramstage.ld --start-group $(ramstage-objs) --end-group
endif # CONFIG_ARCH_RAMSTAGE_MIPS
diff --git a/src/arch/mips/bootblock.ld b/src/arch/mips/bootblock.ld
index 3721f85641..8e1b1e353e 100644
--- a/src/arch/mips/bootblock.ld
+++ b/src/arch/mips/bootblock.ld
@@ -20,6 +20,7 @@
*/
OUTPUT_ARCH(mips)
+INCLUDE ldoptions
ENTRY(_start)
diff --git a/src/arch/mips/ramstage.ld b/src/arch/mips/ramstage.ld
index 405244446f..cba90eb597 100644
--- a/src/arch/mips/ramstage.ld
+++ b/src/arch/mips/ramstage.ld
@@ -24,6 +24,7 @@
*/
OUTPUT_ARCH(mips)
+INCLUDE ldoptions
ENTRY(stage_entry)
diff --git a/src/arch/mips/romstage.ld b/src/arch/mips/romstage.ld
index 8964285230..f776bc8bb1 100644
--- a/src/arch/mips/romstage.ld
+++ b/src/arch/mips/romstage.ld
@@ -20,6 +20,7 @@
*/
OUTPUT_ARCH(mips)
+INCLUDE ldoptions
ENTRY(stage_entry)