Skip to content
Snippets Groups Projects
Unverified Commit 8ecc0ac6 authored by Gaëtan Harter's avatar Gaëtan Harter Committed by cladmi
Browse files

cortexm_common_ldscript: add test for _fw_rom_length overflow

Verify that specifying a too big _fw_rom_length for the rom is detected and
prevent compilation.
parent 67687636
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ include $(RIOTBASE)/Makefile.include
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
COMPILE_TESTS = test-elffile-overflow test-elffile-fw_rom_length
COMPILE_TESTS += tests-offsets tests-fw_rom_len
COMPILE_TESTS += tests-offsets tests-fw_rom_len tests-rom-overflow
all: compile-tests
......@@ -121,3 +121,24 @@ $(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
# Test FW_ROM_LEN overflow detection
OVERFLOW_TESTS = too_big_for_rom offset_and_romlen
tests-rom-overflow: $(OVERFLOW_TESTS:%=test-assert_overflow_%)
# Simple FW_ROM_LEN overflow
test-assert_overflow_too_big_for_rom: FW_ROM_LEN=$$(($(ROM_LEN_BYTES) + 1))
# ROM_OFFSET and FW_ROM_LEN set ROM_LEN
test-assert_overflow_offset_and_romlen: ROM_OFFSET=0x1000
test-assert_overflow_offset_and_romlen: FW_ROM_LEN=$(ROM_LEN_BYTES)
.PHONY: test-assert_overflow_%
test-assert_overflow_%: $(ELFFILES_DEPS)
$(Q) echo -n "Test ROM overflow detection ($*): "
$(Q)\
{ $(_LINK) -o /dev/null 2>&1 | grep -q 'Specified firmware size does not fit in ROM' ; } \
&& echo [OK] || { echo [ERROR] Compilation should have failed >&2; exit 1; }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment