mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
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.
This commit is contained in:
parent
6768763601
commit
8ecc0ac652
@ -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; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user