aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2016-05-22 00:41:15 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-08-14 11:45:15 +0100
commit81631e49a608be93af0a473ec3f099cb556a2c8a (patch)
tree94d010dfd5604d9889372ffe752ff54be237da7b /contrib
parent0e95629eb1cca652447d9c30514319272af2f337 (diff)
contrib/loaders: Enforce Little Endian ARM machine code
arm-none-eabi target triplet defaults to Little Endian, and so far any submitted machine code snippets have been verified to be Little Endian. However a user might override [ARM_]CROSS_COMPILE with an armeb toolchain, potentially resulting in invalid machine code. Let's be safe and enforce Little Endian mode for assembler and compiler. Change-Id: I9cefe24689eaded25d60ffb1f254b254e8d76f9d Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3498 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/loaders/checksum/Makefile6
-rw-r--r--contrib/loaders/erase_check/Makefile6
-rw-r--r--contrib/loaders/flash/fm4/Makefile4
-rw-r--r--contrib/loaders/flash/kinetis_ke/Makefile4
-rw-r--r--contrib/loaders/flash/xmc1xxx/Makefile4
-rw-r--r--contrib/loaders/watchdog/Makefile4
6 files changed, 20 insertions, 8 deletions
diff --git a/contrib/loaders/checksum/Makefile b/contrib/loaders/checksum/Makefile
index 34430e2f..b9f59b8d 100644
--- a/contrib/loaders/checksum/Makefile
+++ b/contrib/loaders/checksum/Makefile
@@ -4,10 +4,12 @@ ARM_CROSS_COMPILE ?= arm-none-eabi-
ARM_AS ?= $(ARM_CROSS_COMPILE)as
ARM_OBJCOPY ?= $(ARM_CROSS_COMPILE)objcopy
+ARM_AFLAGS = -EL
+
arm: armv4_5_crc.inc armv7m_crc.inc
armv4_5_%.elf: armv4_5_%.s
- $(ARM_AS) $< -o $@
+ $(ARM_AS) $(ARM_AFLAGS) $< -o $@
armv4_5_%.bin: armv4_5_%.elf
$(ARM_OBJCOPY) -Obinary $< $@
@@ -16,7 +18,7 @@ armv4_5_%.inc: armv4_5_%.bin
$(BIN2C) < $< > $@
armv7m_%.elf: armv7m_%.s
- $(ARM_AS) $< -o $@
+ $(ARM_AS) $(ARM_AFLAGS) $< -o $@
armv7m_%.bin: armv7m_%.elf
$(ARM_OBJCOPY) -Obinary $< $@
diff --git a/contrib/loaders/erase_check/Makefile b/contrib/loaders/erase_check/Makefile
index cd4d3221..01e62dea 100644
--- a/contrib/loaders/erase_check/Makefile
+++ b/contrib/loaders/erase_check/Makefile
@@ -4,10 +4,12 @@ ARM_CROSS_COMPILE ?= arm-none-eabi-
ARM_AS ?= $(ARM_CROSS_COMPILE)as
ARM_OBJCOPY ?= $(ARM_CROSS_COMPILE)objcopy
+ARM_AFLAGS = -EL
+
arm: armv4_5_erase_check.inc armv7m_erase_check.inc armv7m_0_erase_check.inc
armv4_5_%.elf: armv4_5_%.s
- $(ARM_AS) $< -o $@
+ $(ARM_AS) $(ARM_AFLAGS) $< -o $@
armv4_5_%.bin: armv4_5_%.elf
$(ARM_OBJCOPY) -Obinary $< $@
@@ -16,7 +18,7 @@ armv4_5_%.inc: armv4_5_%.bin
$(BIN2C) < $< > $@
armv7m_%.elf: armv7m_%.s
- $(ARM_AS) $< -o $@
+ $(ARM_AS) $(ARM_AFLAGS) $< -o $@
armv7m_%.bin: armv7m_%.elf
$(ARM_OBJCOPY) -Obinary $< $@
diff --git a/contrib/loaders/flash/fm4/Makefile b/contrib/loaders/flash/fm4/Makefile
index eb4cbd0c..207b9d0f 100644
--- a/contrib/loaders/flash/fm4/Makefile
+++ b/contrib/loaders/flash/fm4/Makefile
@@ -6,6 +6,8 @@ CC=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
+CFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL
+
all: erase.inc write.inc
.PHONY: clean
@@ -15,7 +17,7 @@ all: erase.inc write.inc
erase.elf write.elf: fm4.h
%.elf: %.S
- $(CC) -static -nostartfiles $< -o $@
+ $(CC) $(CFLAGS) $< -o $@
%.lst: %.elf
$(OBJDUMP) -S $< > $@
diff --git a/contrib/loaders/flash/kinetis_ke/Makefile b/contrib/loaders/flash/kinetis_ke/Makefile
index a0331a2e..7d8dba8c 100644
--- a/contrib/loaders/flash/kinetis_ke/Makefile
+++ b/contrib/loaders/flash/kinetis_ke/Makefile
@@ -4,10 +4,12 @@ CROSS_COMPILE ?= arm-none-eabi-
AS = $(CROSS_COMPILE)as
OBJCOPY = $(CROSS_COMPILE)objcopy
+AFLAGS = -EL
+
all: kinetis_ke_flash.inc kinetis_ke_watchdog.inc
%.elf: %.s
- $(AS) $< -o $@
+ $(AS) $(AFLAGS) $< -o $@
%.bin: %.elf
$(OBJCOPY) -Obinary $< $@
diff --git a/contrib/loaders/flash/xmc1xxx/Makefile b/contrib/loaders/flash/xmc1xxx/Makefile
index 066466ef..b97c602d 100644
--- a/contrib/loaders/flash/xmc1xxx/Makefile
+++ b/contrib/loaders/flash/xmc1xxx/Makefile
@@ -6,6 +6,8 @@ CC=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
+CFLAGS = -static -nostartfiles -mlittle-endian -Wa,-EL
+
all: erase.inc erase_check.inc write.inc
.PHONY: clean
@@ -15,7 +17,7 @@ all: erase.inc erase_check.inc write.inc
erase.elf erase_check.elf write.elf: xmc1xxx.S
%.elf: %.S
- $(CC) -static -nostartfiles $< -o $@
+ $(CC) $(CFLAGS) $< -o $@
%.lst: %.elf
$(OBJDUMP) -S $< > $@
diff --git a/contrib/loaders/watchdog/Makefile b/contrib/loaders/watchdog/Makefile
index d9ef1d2c..623e7440 100644
--- a/contrib/loaders/watchdog/Makefile
+++ b/contrib/loaders/watchdog/Makefile
@@ -4,10 +4,12 @@ ARM_CROSS_COMPILE ?= arm-none-eabi-
ARM_AS ?= $(ARM_CROSS_COMPILE)as
ARM_OBJCOPY ?= $(ARM_CROSS_COMPILE)objcopy
+ARM_AFLAGS = -EL -mthumb
+
arm: armv7m_kinetis_wdog.inc
armv7m_%.elf: armv7m_%.s
- $(ARM_AS) -mthumb $< -o $@
+ $(ARM_AS) $(ARM_AFLAGS) $< -o $@
armv7m_%.bin: armv7m_%.elf
$(ARM_OBJCOPY) -Obinary $< $@