diff options
author | Gabe Black <gabeblack@google.com> | 2013-09-29 03:02:55 -0700 |
---|---|---|
committer | Isaac Christensen <isaac.christensen@se-eng.com> | 2014-08-22 22:23:11 +0200 |
commit | 8b685398a74065d832fe2a3dfcfb313f0f4f11c3 (patch) | |
tree | eb01a01843aad059fb4221563fac25fa78e7d109 /src/arch | |
parent | bc349b81e97350b13d7d70c400e46d0bb8e4d1aa (diff) |
ARM: Overhaul the ARM Makefile.
The ARM Makefile was copied from x86 and then modified, and as a result it
was carrying a lot of baggage. On top of that, the extra complication made it
inflexible, and we need a lot of flexiblity in order to support the fact that
the Tegra124 starts on an ARMv4 coprocessor instead of one of the ARMv7 main
CPUs.
Change-Id: Ia6ddc27619bdb51e152ad0c628ad6f3037c103ce
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/171017
Reviewed-by: Ronald Minnich <rminnich@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 512d942788336c8d52470135b43ee4e6a1c95f6c)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6709
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/armv7/Kconfig | 8 | ||||
-rw-r--r-- | src/arch/armv7/Makefile.inc | 112 | ||||
-rw-r--r-- | src/arch/armv7/bootblock.S (renamed from src/arch/armv7/bootblock.inc) | 0 | ||||
-rw-r--r-- | src/arch/armv7/bootblock.ld (renamed from src/arch/armv7/bootblock.lds) | 1 | ||||
-rw-r--r-- | src/arch/armv7/bootblock_simple.c | 10 | ||||
-rw-r--r-- | src/arch/armv7/id.S (renamed from src/arch/armv7/id.inc) | 2 | ||||
-rw-r--r-- | src/arch/armv7/include/bootblock_common.h | 14 | ||||
-rw-r--r-- | src/arch/armv7/romstage.ld | 4 |
8 files changed, 42 insertions, 109 deletions
diff --git a/src/arch/armv7/Kconfig b/src/arch/armv7/Kconfig index ec24e17f58..a7f5b23e8e 100644 --- a/src/arch/armv7/Kconfig +++ b/src/arch/armv7/Kconfig @@ -10,3 +10,11 @@ config ARCH_ROMSTAGE_ARMV7 config ARCH_RAMSTAGE_ARMV7 bool default n + +config CPU_HAS_BOOTBLOCK_INIT + bool + default n + +config MAINBOARD_HAS_BOOTBLOCK_INIT + bool + default n
\ No newline at end of file diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc index f633644cd7..a18398a58c 100644 --- a/src/arch/armv7/Makefile.inc +++ b/src/arch/armv7/Makefile.inc @@ -51,6 +51,13 @@ endif # CONFIG_ARCH_ARMV7 ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARMV7),y) +bootblock-y += id.S +bootblock-y += bootblock.S + +$(obj)/arch/arm/id.bootblock.o: $(obj)/build.h +bootblock-y += $(call strip_quotes,$(CONFIG_BOOTBLOCK_SOURCE)) + +bootblock-y += stages.c bootblock-y += cache.c bootblock-y += eabi_compat.c bootblock-y += memset.S @@ -58,46 +65,12 @@ bootblock-y += memcpy.S bootblock-y += memmove.S bootblock-y += mmu.c -bootblock_lds = $(src)/arch/armv7/bootblock.lds -bootblock_lds += $(chipset_bootblock_lds) - -bootblock_inc += $(src)/arch/armv7/bootblock.inc -bootblock_inc += $(src)/arch/armv7/id.inc -bootblock_inc += $(chipset_bootblock_inc) -bootblock_inc += $(objgenerated)/bootblock.inc - -bootblock_custom = $(src)/$(call strip_quotes,$(CONFIG_BOOTBLOCK_CPU_INIT)) -bootblock_custom += $(src)/$(call strip_quotes,$(CONFIG_BOOTBLOCK_MAINBOARD_INIT)) - -$(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) $(CPPFLAGS_bootblock) -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) $(CPPFLAGS_bootblock) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/armv7/include -I$(obj) -include $(obj)/build.h -include $(obj)/config.h -I. -I$(src) $< -o $@ - -$(objgenerated)/bootblock.inc: $(src)/arch/armv7/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(bootblock_custom) $(OPTION_TABLE_H) $(obj)/config.h - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_bootblock) $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) -MM \ - -MT$(objgenerated)/bootblock.inc \ - $< > $(objgenerated)/bootblock.inc.d - $(CC_bootblock) -c -S $(CFLAGS_bootblock) -I. $(CPPFLAGS_bootblock) $< -o $@ - -$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld $$(bootblock-objs) $(stages) $(obj)/config.h +$(objcbfs)/bootblock.debug: $(src)/arch/armv7/bootblock.ld $(obj)/ldoptions $$(bootblock-objs) $(obj)/config.h @printf " LINK $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) - $(LD_bootblock) -m armelf_linux_eabi -include $(obj)/config.h -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld + $(LD_bootblock) -m armelf_linux_eabi -static -o $@ -L$(obj) $< -T $(src)/arch/armv7/bootblock.ld else - $(CC_bootblock) -nostdlib -nostartfiles -include $(obj)/config.h -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $(objgenerated)/bootblock.o $(bootblock-objs) $(stages) $(LIBGCC_FILE_NAME_bootblock) -Wl,--end-group + $(CC_bootblock) $(CFLAGS_bootblock) -nostartfiles -include $(obj)/config.h -static -o $@ -L$(obj) -T $(src)/arch/armv7/bootblock.ld -Wl,--start-group $(bootblock-objs) $(LIBGCC_FILE_NAME_bootblock) -Wl,--end-group endif endif # CONFIG_ARCH_BOOTBLOCK_ARMV7 @@ -108,50 +81,24 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARMV7 ifeq ($(CONFIG_ARCH_ROMSTAGE_ARMV7),y) +romstage-y += stages.c romstage-y += cache.c romstage-y += div0.c romstage-y += eabi_compat.c romstage-y += memset.S romstage-y += memcpy.S romstage-y += memmove.S -romstage-srcs += $(objgenerated)/crt0.s - -ldscripts = -ldscripts += $(src)/arch/armv7/romstage.ld -crt0s += $(cpu_incs) -crt0s += $(cpu_incs-y) +VBOOT_STUB_DEPS += $(obj)/arch/armv7/eabi_compat.rmodules_arm.o -$(objcbfs)/romstage.debug: $$(romstage-objs) $(stages_o) $(objgenerated)/romstage.ld +$(objcbfs)/romstage.debug: $$(romstage-objs) $(src)/arch/armv7/romstage.ld $(obj)/ldoptions @printf " LINK $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) - $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) $(romstage-objs) -T $(objgenerated)/romstage.ld + $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) $(romstage-objs) -T $(src)/arch/armv7/romstage.ld else - $(CC_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/romstage.ld -Wl,--start-group $(romstage-objs) $(stages_o) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group + $(CC_romstage) $(CFLAGS_romstage) -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/armv7/romstage.ld -Wl,--start-group $(romstage-objs) $(LIBGCC_FILE_NAME_romstage) -Wl,--end-group endif -$(objgenerated)/romstage.ld: $$(ldscripts) $(obj)/ldoptions - @printf " GEN $(subst $(obj)/,,$(@))\n" - rm -f $@ - printf '$(foreach ldscript,ldoptions $(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@.tmp - mv $@.tmp $@ - -$(objgenerated)/crt0.romstage.S: $$(crt0s) - @printf " GEN $(subst $(obj)/,,$(@))\n" - printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ - -$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.s - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_romstage) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm - -$(objgenerated)/crt0.s: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_romstage) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/armv7/include -I$(obj) -include $(obj)/config.h -include $(obj)/build.h -I. -I$(src) $< -o $@ - -$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h $(obj)/config.h - @printf " CC romstage.inc\n" - $(CC_romstage) -MMD $(CFLAGS_romstage) $(CPPFLAGS_romstage) -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@ - endif # CONFIG_ARCH_ROMSTAGE_ARMV7 ############################################################################### @@ -160,6 +107,7 @@ endif # CONFIG_ARCH_ROMSTAGE_ARMV7 ifeq ($(CONFIG_ARCH_RAMSTAGE_ARMV7),y) +ramstage-y += stages.c ramstage-y += exception.c ramstage-y += exception_asm.S ramstage-y += div0.c @@ -174,12 +122,12 @@ ramstage-y += memcpy.S ramstage-y += memmove.S ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) -$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/armv7/ramstage.ld +$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) $(src)/arch/armv7/ramstage.ld $(obj)/ldoptions @printf " CC $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) $(LD_ramstage) -m armelf_linux_eabi -o $@ -L$(obj) $< -T $(src)/arch/armv7/ramstage.ld else - $(CC_ramstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/armv7/ramstage.ld $< + $(CC_ramstage) $(CFLAGS_ramstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) -Wl,--start-group $(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) -Wl,--end-group -T $(src)/arch/armv7/ramstage.ld endif $(objgenerated)/ramstage.o: $(stages_o) $$(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) @@ -190,28 +138,4 @@ else $(CC_ramstage) $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) -nostdlib -r -o $@ -Wl,--start-group $(stages_o) $(ramstage-objs) $(LIBGCC_FILE_NAME_ramstage) -Wl,--end-group endif -ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c -endif -ifeq ($(CONFIG_BOARD_HAS_HARD_RESET),y) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c -endif -ifeq ($(CONFIG_GENERATE_ACPI_TABLES),y) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl -# make doesn't have arithmetic operators or greater-than comparisons -ifeq ($(subst 5,4,$(CONFIG_ACPI_SSDTX_NUM)),4) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl -endif -ifeq ($(CONFIG_ACPI_SSDTX_NUM),5) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl -endif -endif - -ifeq ($(CONFIG_HAVE_BUS_CONFIG),y) -ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c -endif - endif # CONFIG_ARCH_RAMSTAGE_ARMV7 diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.S index b28a787839..b28a787839 100644 --- a/src/arch/armv7/bootblock.inc +++ b/src/arch/armv7/bootblock.S diff --git a/src/arch/armv7/bootblock.lds b/src/arch/armv7/bootblock.ld index f16e72b858..706f0a2c2e 100644 --- a/src/arch/armv7/bootblock.lds +++ b/src/arch/armv7/bootblock.ld @@ -21,6 +21,7 @@ /* We use ELF as output format. So that we can debug the code in some form. */ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) +INCLUDE ldoptions PHDRS { diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c index bc3ef53ae5..bcd83b8c36 100644 --- a/src/arch/armv7/bootblock_simple.c +++ b/src/arch/armv7/bootblock_simple.c @@ -19,16 +19,14 @@ * MA 02110-1301 USA */ -#include <bootblock_common.h> #include <arch/cache.h> #include <arch/hlt.h> #include <arch/stages.h> +#include <bootblock_common.h> #include <cbfs.h> #include <console/console.h> #include <smp/node.h> -#include "stages.c" - void main(void) { const char *stage_name = "fallback/romstage"; @@ -51,10 +49,8 @@ void main(void) sctlr |= SCTLR_Z | SCTLR_I; write_sctlr(sctlr); - if (boot_cpu()) { - bootblock_cpu_init(); - bootblock_mainboard_init(); - } + bootblock_cpu_init(); + bootblock_mainboard_init(); #if CONFIG_BOOTBLOCK_CONSOLE console_init(); diff --git a/src/arch/armv7/id.inc b/src/arch/armv7/id.S index ffe547d748..a588f1e1da 100644 --- a/src/arch/armv7/id.inc +++ b/src/arch/armv7/id.S @@ -1,3 +1,5 @@ +#include <build.h> + .section ".id", "a", %progbits .globl __id_start diff --git a/src/arch/armv7/include/bootblock_common.h b/src/arch/armv7/include/bootblock_common.h index 2fa705f5e1..034a12bc36 100644 --- a/src/arch/armv7/include/bootblock_common.h +++ b/src/arch/armv7/include/bootblock_common.h @@ -1,11 +1,15 @@ -#ifdef CONFIG_BOOTBLOCK_CPU_INIT -#include CONFIG_BOOTBLOCK_CPU_INIT +#if CONFIG_CPU_HAS_BOOTBLOCK_INIT +void bootblock_cpu_init(void); +#else +static void __attribute__((unused)) bootblock_cpu_init(void) +{ +} #endif -#ifdef CONFIG_BOOTBLOCK_MAINBOARD_INIT -#include CONFIG_BOOTBLOCK_MAINBOARD_INIT +#if CONFIG_MAINBOARD_HAS_BOOTBLOCK_INIT +void bootblock_mainboard_init(void); #else -static void bootblock_mainboard_init(void) +static void __attribute__((unused)) bootblock_mainboard_init(void) { } #endif diff --git a/src/arch/armv7/romstage.ld b/src/arch/armv7/romstage.ld index 0ebcd53bae..a9c3f8bf04 100644 --- a/src/arch/armv7/romstage.ld +++ b/src/arch/armv7/romstage.ld @@ -20,13 +20,11 @@ */ /* We use ELF as output format. So that we can debug the code in some form. */ -/* - INCLUDE ldoptions - */ /* We use ELF as output format. So that we can debug the code in some form. */ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) +INCLUDE ldoptions ENTRY(stage_entry) |