mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cortexm_common_ldscript: add test for linker FW_ROM_LEN
Compile an elf file with a length equals to half the rom length.
This commit is contained in:
parent
7dad2e7096
commit
6768763601
@ -20,12 +20,12 @@ BOARD_WHITELIST += stm32mindev
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # #
|
||||
# Compile time tests for ROM_OFFSET #
|
||||
# # # # # # # # # # # # # # # # # # #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# Compile time tests for ROM_OFFSET and FW_ROM_LENGTH #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
COMPILE_TESTS = test-elffile-overflow test-elffile-fw_rom_length
|
||||
COMPILE_TESTS += tests-offsets
|
||||
COMPILE_TESTS += tests-offsets tests-fw_rom_len
|
||||
|
||||
all: compile-tests
|
||||
|
||||
@ -98,3 +98,26 @@ $(BINDIR)/$(APPLICATION)_offset_%.elf: ROM_OFFSET=$*
|
||||
$(BINDIR)/$(APPLICATION)_offset_%.elf: $(ELFFILES_DEPS)
|
||||
$(Q)$(_LINK) -o $@
|
||||
.PRECIOUS: $(BINDIR)/$(APPLICATION)_offset_%.elf
|
||||
|
||||
|
||||
# Compile elf files with FW_ROM_LEN and verify the length is taken into account
|
||||
# I arbitrarily do 'half' size because I needed to take a value and
|
||||
# that it is similar to what is required for doing dual firmware in rom ota
|
||||
|
||||
tests-fw_rom_len: test-fw_len_half_rom
|
||||
|
||||
.PHONY: test-fw_len_half_rom
|
||||
test-fw_len_half_rom: $(BINDIR)/$(APPLICATION)_fw_len_half_rom.elf
|
||||
$(Q)echo -n "Test compilation with half ROM length: "
|
||||
$(Q)\
|
||||
TEST_FW_LEN=$$($(PREFIX)readelf --symbols $^ 2>/dev/null | awk '/_fw_rom_length/{printf "0x%s\n", $$2}'); \
|
||||
EXPECT_FW_LEN=$$(printf "0x%08x" $$(( $(ROM_LEN_BYTES) / 2 ))); \
|
||||
if test $${TEST_FW_LEN} != $${EXPECT_FW_LEN}; then \
|
||||
echo "[ERROR] Linker firmware length not used $${TEST_FW_LEN} != $${EXPECT_FW_LEN}" >&2; \
|
||||
exit 1;\
|
||||
fi
|
||||
$(Q)echo [OK]
|
||||
$(BINDIR)/$(APPLICATION)_fw_len_half_rom.elf: FW_ROM_LEN=$$(($(ROM_LEN_BYTES)/2))
|
||||
$(BINDIR)/$(APPLICATION)_fw_len_half_rom.elf: $(ELFFILES_DEPS)
|
||||
$(Q)$(_LINK) -o $@
|
||||
.PRECIOUS: $(BINDIR)/$(APPLICATION)_fw_len_half_rom.elf
|
||||
|
Loading…
Reference in New Issue
Block a user