0001-Use-ld-instead-of-gcc-for-linking.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 0d581abe6620ac69adec321b94390e009802f36a Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sun, 13 Mar 2016 14:32:33 +0100
  4. Subject: [PATCH] Use ld instead of gcc for linking
  5. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  6. ---
  7. Makefile | 11 ++++++-----
  8. 1 file changed, 6 insertions(+), 5 deletions(-)
  9. diff --git a/Makefile b/Makefile
  10. index ce40314..271bb4f 100644
  11. --- a/Makefile
  12. +++ b/Makefile
  13. @@ -1,6 +1,7 @@
  14. CROSS_COMPILE ?= arm-none-eabi-
  15. CC = $(CROSS_COMPILE)gcc
  16. +LD = $(CROSS_COMPILE)ld
  17. OBJCOPY = $(CROSS_COMPILE)objcopy
  18. OBJDUMP = $(CROSS_COMPILE)objdump
  19. SIZE = $(CROSS_COMPILE)size
  20. @@ -10,7 +11,7 @@ OPENOCD = openocd
  21. CFLAGS := -mthumb -mcpu=cortex-m4
  22. CFLAGS += -ffunction-sections -fdata-sections
  23. CFLAGS += -Os -std=gnu99 -Wall
  24. -LDFLAGS := -nostartfiles -Wl,--gc-sections
  25. +LINKERFLAGS := -nostartfiles --gc-sections
  26. obj-y += gpio.o mpu.o
  27. obj-f4 += $(obj-y) usart-f4.o
  28. @@ -22,22 +23,22 @@ all: stm32f429i-disco stm32429i-eval stm32f469i-disco stm32746g-eval
  29. $(CC) -c $(CFLAGS) $< -o $@
  30. stm32f429i-disco: stm32f429i-disco.o $(obj-f4)
  31. - $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32f429i-disco.elf stm32f429i-disco.o $(obj-f4)
  32. + $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32f429i-disco.elf stm32f429i-disco.o $(obj-f4)
  33. $(OBJCOPY) -Obinary stm32f429i-disco.elf stm32f429i-disco.bin
  34. $(SIZE) stm32f429i-disco.elf
  35. stm32429i-eval: stm32429i-eval.o $(obj-f4)
  36. - $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32429i-eval.elf stm32429i-eval.o $(obj-f4)
  37. + $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32429i-eval.elf stm32429i-eval.o $(obj-f4)
  38. $(OBJCOPY) -Obinary stm32429i-eval.elf stm32429i-eval.bin
  39. $(SIZE) stm32429i-eval.elf
  40. stm32f469i-disco: stm32f469i-disco.o $(obj-f4)
  41. - $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32f469i-disco.elf stm32f469i-disco.o $(obj-f4)
  42. + $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32f469i-disco.elf stm32f469i-disco.o $(obj-f4)
  43. $(OBJCOPY) -Obinary stm32f469i-disco.elf stm32f469i-disco.bin
  44. $(SIZE) stm32f469i-disco.elf
  45. stm32746g-eval: stm32746g-eval.o $(obj-f7)
  46. - $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32746g-eval.elf stm32746g-eval.o $(obj-f7)
  47. + $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32746g-eval.elf stm32746g-eval.o $(obj-f7)
  48. $(OBJCOPY) -Obinary stm32746g-eval.elf stm32746g-eval.bin
  49. $(SIZE) stm32746g-eval.elf
  50. --
  51. 2.6.4