mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 13:16:35 +00:00
afboot-stm32: use the Buildroot toolchain
By default, the afboot-stm32 Makefile uses "CROSS_COMPILE = arm-none-eabi-". Since I had such a toolchain installed on my system when testing afboot-stm32, I didn't realize it wasn't using the Buildroot toolchain. However, using the Buildroot toolchain doesn't immediately works for FLAT toolchains, as gcc automatically wants to create a FLAT binary. So we need to adjust the afboot-stm32 Makefile to use directly 'ld' and not 'gcc' when linking. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
97354fd229
commit
a354e3828d
@ -0,0 +1,61 @@
|
|||||||
|
From 0d581abe6620ac69adec321b94390e009802f36a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||||
|
Date: Sun, 13 Mar 2016 14:32:33 +0100
|
||||||
|
Subject: [PATCH] Use ld instead of gcc for linking
|
||||||
|
|
||||||
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||||
|
---
|
||||||
|
Makefile | 11 ++++++-----
|
||||||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index ce40314..271bb4f 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
CROSS_COMPILE ?= arm-none-eabi-
|
||||||
|
|
||||||
|
CC = $(CROSS_COMPILE)gcc
|
||||||
|
+LD = $(CROSS_COMPILE)ld
|
||||||
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||||
|
SIZE = $(CROSS_COMPILE)size
|
||||||
|
@@ -10,7 +11,7 @@ OPENOCD = openocd
|
||||||
|
CFLAGS := -mthumb -mcpu=cortex-m4
|
||||||
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
CFLAGS += -Os -std=gnu99 -Wall
|
||||||
|
-LDFLAGS := -nostartfiles -Wl,--gc-sections
|
||||||
|
+LINKERFLAGS := -nostartfiles --gc-sections
|
||||||
|
|
||||||
|
obj-y += gpio.o mpu.o
|
||||||
|
obj-f4 += $(obj-y) usart-f4.o
|
||||||
|
@@ -22,22 +23,22 @@ all: stm32f429i-disco stm32429i-eval stm32f469i-disco stm32746g-eval
|
||||||
|
$(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
stm32f429i-disco: stm32f429i-disco.o $(obj-f4)
|
||||||
|
- $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32f429i-disco.elf stm32f429i-disco.o $(obj-f4)
|
||||||
|
+ $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32f429i-disco.elf stm32f429i-disco.o $(obj-f4)
|
||||||
|
$(OBJCOPY) -Obinary stm32f429i-disco.elf stm32f429i-disco.bin
|
||||||
|
$(SIZE) stm32f429i-disco.elf
|
||||||
|
|
||||||
|
stm32429i-eval: stm32429i-eval.o $(obj-f4)
|
||||||
|
- $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32429i-eval.elf stm32429i-eval.o $(obj-f4)
|
||||||
|
+ $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32429i-eval.elf stm32429i-eval.o $(obj-f4)
|
||||||
|
$(OBJCOPY) -Obinary stm32429i-eval.elf stm32429i-eval.bin
|
||||||
|
$(SIZE) stm32429i-eval.elf
|
||||||
|
|
||||||
|
stm32f469i-disco: stm32f469i-disco.o $(obj-f4)
|
||||||
|
- $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32f469i-disco.elf stm32f469i-disco.o $(obj-f4)
|
||||||
|
+ $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32f469i-disco.elf stm32f469i-disco.o $(obj-f4)
|
||||||
|
$(OBJCOPY) -Obinary stm32f469i-disco.elf stm32f469i-disco.bin
|
||||||
|
$(SIZE) stm32f469i-disco.elf
|
||||||
|
|
||||||
|
stm32746g-eval: stm32746g-eval.o $(obj-f7)
|
||||||
|
- $(CC) -T stm32f429.lds $(LDFLAGS) -o stm32746g-eval.elf stm32746g-eval.o $(obj-f7)
|
||||||
|
+ $(LD) -T stm32f429.lds $(LINKERFLAGS) -o stm32746g-eval.elf stm32746g-eval.o $(obj-f7)
|
||||||
|
$(OBJCOPY) -Obinary stm32746g-eval.elf stm32746g-eval.bin
|
||||||
|
$(SIZE) stm32746g-eval.elf
|
||||||
|
|
||||||
|
--
|
||||||
|
2.6.4
|
||||||
|
|
@ -8,7 +8,7 @@ AFBOOT_STM32_VERSION = v0.1
|
|||||||
AFBOOT_STM32_SITE = $(call github,mcoquelin-stm32,afboot-stm32,$(AFBOOT_STM32_VERSION))
|
AFBOOT_STM32_SITE = $(call github,mcoquelin-stm32,afboot-stm32,$(AFBOOT_STM32_VERSION))
|
||||||
|
|
||||||
define AFBOOT_STM32_BUILD_CMDS
|
define AFBOOT_STM32_BUILD_CMDS
|
||||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) all
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) all
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define AFBOOT_STM32_INSTALL_TARGET_CMDS
|
define AFBOOT_STM32_INSTALL_TARGET_CMDS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user