Skip to contentSkip to conversation

target-xtensa: tests: pre-process tests linker script

PATCH New Max Filippov 1 participant 1 message Sep 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-xtensa: tests: pre-process tests linker script

Xtensa cores have configurable interrupt vectors and endiannes. This information is needed to link executable images correctly for a specific core configuration. Instead of hard-coding dc232 defaults pull endianness, number of high-priority interrupts and location of vectors from the core configuration and pass it through the C preprocessor.

While at it clean up tabs and align the initial stack on 16 bytes.

---
 tests/tcg/xtensa/Makefile    |  10 +++-
 tests/tcg/xtensa/linker.ld   | 112 -------------------------------------
 tests/tcg/xtensa/linker.ld.S | 130 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+), 115 deletions(-)
 delete mode 100644 tests/tcg/xtensa/linker.ld
 create mode 100644 tests/tcg/xtensa/linker.ld.S
tests/tcg/xtensa/Makefile +7 -3
index a70c92b..522a63e 100644
@@ -13,6 +13,7 @@ SIMFLAGS = --xtensa-core=DC_B_232L --exit_with_target_code $(EXTFLAGS)
 SIMDEBUG = --gdbserve=0
 endif
 
+HOST_CC = gcc
 CC      = $(CROSS)gcc
 AS      = $(CROSS)gcc -x assembler-with-cpp
 LD      = $(CROSS)ld
@@ -21,7 +22,7 @@ XTENSA_SRC_PATH = $(SRC_PATH)/tests/tcg/xtensa
 INCLUDE_DIRS = $(XTENSA_SRC_PATH) $(SRC_PATH)/target-xtensa/core-$(CORE)
 XTENSA_INC = $(addprefix -I,$(INCLUDE_DIRS))
 
-LDFLAGS = -T$(XTENSA_SRC_PATH)/linker.ld
+LDFLAGS = -Tlinker.ld
 
 CRT        = crt.o vectors.o
 
@@ -59,13 +60,16 @@ TESTCASES += test_windowed.tst
 
 all: build
 
+linker.ld: $(XTENSA_SRC_PATH)/linker.ld.S
+	$(HOST_CC) $(XTENSA_INC) -E -P $< -o $@
+
 %.o: $(XTENSA_SRC_PATH)/%.c
 	$(CC) $(XTENSA_INC) $(CFLAGS) -c $< -o $@
 
 %.o: $(XTENSA_SRC_PATH)/%.S
 	$(CC) $(XTENSA_INC) $(ASFLAGS) -c $< -o $@
 
-%.tst: %.o $(XTENSA_SRC_PATH)/macros.inc $(CRT) Makefile
+%.tst: %.o linker.ld $(XTENSA_SRC_PATH)/macros.inc $(CRT) Makefile
 	$(LD) $(LDFLAGS) $(NOSTDFLAGS) $(CRT) $< -o $@
 
 build: $(TESTCASES)
@@ -85,4 +89,4 @@ host-debug-%.tst: %.tst
 	gdb --args $(SIM) $(SIMFLAGS) ./$<
 
 clean:
-	$(RM) -fr $(TESTCASES) $(CRT)
+	$(RM) -fr $(TESTCASES) $(CRT) linker.ld
tests/tcg/xtensa/linker.ld deleted +0 -112

112 lines not on this page · raw message

tests/tcg/xtensa/linker.ld.S new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
1.8.1.4