Andre Przywara 4fb307f1e4 fel: thunks: Use armv5te architecture for thunks
Almost all thunks are already ARMv5 safe, so we can just require this
architecture on the gas command line, to enforce compatibility with the
F1Cx00 series. This prevents accidental changes in the future.

The RMR thunk uses the ARMv7 only DSB/ISB instructions, but this runs on
ARMv8 cores only anyway, so we just force ARMv7 for this file, and avoid
code changes.

Signed-off-by: Andre Przywara <osp@andrep.de>
2022-03-06 00:47:47 +00:00

36 lines
1.0 KiB
Makefile

#
# build "preprocessed" .h files for inclusion of ARM scratch code
#
SPL_THUNK := fel-to-spl-thunk.h
THUNKS := clrsetbits.h
THUNKS += memcpy.h
THUNKS += readl_writel.h
THUNKS += rmr-thunk.h
THUNKS += sid_read_root.h
all: $(SPL_THUNK) $(THUNKS)
# clean up object files afterwards
rm -f *.o
# This empty prerequisite enforces a rebuild of all the headers on every run
FORCE:
# If not specified explicitly: try to guess a suitable ARM toolchain prefix
CROSS_COMPILE ?= $(shell ../find-arm-gcc.sh)
AS := $(CROSS_COMPILE)as
OBJDUMP := $(CROSS_COMPILE)objdump
AWK_O_TO_H := LC_ALL=C awk -f objdump_to_h.awk
# The SPL thunk requires a different output format. The "style" variable for
# awk controls this, and causes the htole32() conversion to be omitted.
fel-to-spl-thunk.h: fel-to-spl-thunk.S FORCE
$(AS) -o $(subst .S,.o,$<) -march=armv5te $<
$(OBJDUMP) -d $(subst .S,.o,$<) | $(AWK_O_TO_H) -v style=old > $@
$(THUNKS): %.h: %.S FORCE
$(AS) -o $(subst .S,.o,$<) -march=armv5te $<
$(OBJDUMP) -d $(subst .S,.o,$<) | $(AWK_O_TO_H) > $@