Fork of the vendor (Boundary Devices) u-boot for Reform 2, with minor tweaks. The goal is to migrate to mainstream u-boot or barebox ASAP. The main impediment so far is the 4GB RAM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

174 lines
4.8 KiB

  1. # SPDX-License-Identifier: GPL-2.0+
  2. #
  3. # (C) Copyright 2000-2002
  4. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. ifndef CONFIG_STANDALONE_LOAD_ADDR
  6. ifneq ($(CONFIG_ARCH_OMAP2PLUS),)
  7. CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
  8. else
  9. CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
  10. endif
  11. endif
  12. CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections
  13. CFLAGS_EFI := -fpic -fshort-wchar
  14. LDFLAGS_FINAL += --gc-sections
  15. PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
  16. -fno-common -ffixed-r9
  17. PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
  18. $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  19. # LLVM support
  20. LLVM_RELFLAGS := $(call cc-option,-mllvm,) \
  21. $(call cc-option,-mno-movt,)
  22. PLATFORM_RELFLAGS += $(LLVM_RELFLAGS)
  23. PLATFORM_CPPFLAGS += -D__ARM__
  24. ifdef CONFIG_ARM64
  25. PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64
  26. else
  27. PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
  28. endif
  29. # Choose between ARM/Thumb instruction sets
  30. ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
  31. AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always)
  32. PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \
  33. $(call cc-option, -mthumb -mthumb-interwork,\
  34. $(call cc-option,-marm,)\
  35. $(call cc-option,-mno-thumb-interwork,)\
  36. )
  37. else
  38. PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
  39. $(call cc-option,-mno-thumb-interwork,)
  40. endif
  41. # Only test once
  42. ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
  43. archprepare: checkthumb checkgcc6
  44. checkthumb:
  45. @if test "$(call cc-name)" = "gcc" -a \
  46. "$(call cc-version)" -lt "0404"; then \
  47. echo -n '*** Your GCC does not produce working '; \
  48. echo 'binaries in THUMB mode.'; \
  49. echo '*** Your board is configured for THUMB mode.'; \
  50. false; \
  51. fi
  52. else
  53. archprepare: checkgcc6
  54. endif
  55. checkgcc6:
  56. @if test "$(call cc-name)" = "gcc" -a \
  57. "$(call cc-version)" -lt "0600"; then \
  58. echo '*** Your GCC is older than 6.0 and is not supported'; \
  59. false; \
  60. fi
  61. # Try if EABI is supported, else fall back to old API,
  62. # i. e. for example:
  63. # - with ELDK 4.2 (EABI supported), use:
  64. # -mabi=aapcs-linux
  65. # - with ELDK 4.1 (gcc 4.x, no EABI), use:
  66. # -mabi=apcs-gnu
  67. # - with ELDK 3.1 (gcc 3.x), use:
  68. # -mapcs-32
  69. PF_CPPFLAGS_ABI := $(call cc-option,\
  70. -mabi=aapcs-linux,\
  71. $(call cc-option,\
  72. -mapcs-32,\
  73. $(call cc-option,\
  74. -mabi=apcs-gnu,\
  75. )\
  76. )\
  77. )
  78. PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
  79. # For EABI, make sure to provide raise()
  80. ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
  81. # This file is parsed many times, so the string may get added multiple
  82. # times. Also, the prefix needs to be different based on whether
  83. # CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
  84. # before adding the correct one.
  85. PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
  86. $(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
  87. endif
  88. # needed for relocation
  89. LDFLAGS_u-boot += -pie
  90. #
  91. # FIXME: binutils versions < 2.22 have a bug in the assembler where
  92. # branches to weak symbols can be incorrectly optimized in thumb mode
  93. # to a short branch (b.n instruction) that won't reach when the symbol
  94. # gets preempted
  95. #
  96. # http://sourceware.org/bugzilla/show_bug.cgi?id=12532
  97. #
  98. ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
  99. ifeq ($(GAS_BUG_12532),)
  100. export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
  101. then echo y; else echo n; fi)
  102. endif
  103. ifeq ($(GAS_BUG_12532),y)
  104. PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
  105. endif
  106. endif
  107. ifneq ($(CONFIG_SPL_BUILD),y)
  108. # Check that only R_ARM_RELATIVE relocations are generated.
  109. ALL-y += checkarmreloc
  110. # The movt / movw can hardcode 16 bit parts of the addresses in the
  111. # instruction. Relocation is not supported for that case, so disable
  112. # such usage by requiring word relocations.
  113. PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
  114. PLATFORM_CPPFLAGS += $(call cc-option, -fno-pic)
  115. endif
  116. # limit ourselves to the sections we want in the .bin.
  117. ifdef CONFIG_ARM64
  118. OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
  119. -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
  120. -j .binman_sym_table
  121. else
  122. OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
  123. -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
  124. -j .binman_sym_table
  125. endif
  126. # if a dtb section exists we always have to include it
  127. # there are only two cases where it is generated
  128. # 1) OF_EMBEDED is turned on
  129. # 2) unit tests include device tree blobs
  130. OBJCOPYFLAGS += -j .dtb.init.rodata
  131. ifdef CONFIG_EFI_LOADER
  132. OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel
  133. endif
  134. ifneq ($(CONFIG_IMX_CONFIG),)
  135. ifdef CONFIG_SPL
  136. ifndef CONFIG_SPL_BUILD
  137. ALL-y += SPL
  138. endif
  139. else
  140. ifeq ($(CONFIG_OF_SEPARATE),y)
  141. ALL-y += u-boot-dtb.imx
  142. else
  143. ALL-y += u-boot.imx
  144. endif
  145. endif
  146. ifneq ($(CONFIG_VF610),)
  147. ALL-y += u-boot.vyb
  148. endif
  149. endif
  150. EFI_LDS := elf_arm_efi.lds
  151. EFI_CRT0 := crt0_arm_efi.o
  152. EFI_RELOC := reloc_arm_efi.o