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

cortexm_common_ldscript: add a test that checks if ROM_LEN is used

Trigger an overflow by 1 byte to detect in ROM_LEN is indeed used.
parent d9db2584
No related branches found
No related tags found
No related merge requests found
BOARD ?= samr21-xpro
include ../Makefile.tests_common
# Normally all boards using `cortexm_common/ldscripts/cortexm.ld` linkerscript
# Only tested on these ones for the moment
BOARD_WHITELIST += iotlab-a8-m3
BOARD_WHITELIST += iotlab-m3
BOARD_WHITELIST += samr21-xpro
include $(RIOTBASE)/Makefile.include
# # # # # # # # # # # # # # # # # # #
# Compile time tests for ROM_OFFSET #
# # # # # # # # # # # # # # # # # # #
COMPILE_TESTS = test-elffile-overflow
all: compile-tests
compile-tests: $(COMPILE_TESTS)
.PHONY: compile-tests $(COMPILE_TESTS)
# test-elffile-overflow depends on $(BINFILE) to prevent:
# * ROM_LEN to be passed to $(ELFFILE) generation
# * dummy error message of wc not finding the .bin file (ELFFILE is not enough)
test-elffile-overflow: $(BINFILE) _test-elffile-overflow-runtest
.PHONY: _test-elffile-overflow-runtest
_test-elffile-overflow-runtest: ROM_LEN=$(firstword $(shell wc -c $(BINFILE)))-1+$(if $(ROM_OFFSET),$(ROM_OFFSET),0)
_test-elffile-overflow-runtest: $(BINFILE)
$(Q)echo -n "Test rom offset 1 byte overflow detection: "
$(Q)\
{ $(_LINK) -o /dev/null 2>&1 | grep -q "region \`rom' overflowed by 1 byte" ; } \
&& echo [OK] || { echo [ERROR] Compilation should have failed >&2; exit 1; }
/*
* Copyright (C) 2018 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Empty main file
*
* @author Gaëtan Harter <gaetan.harter@fu-berlin.de>
*
* @}
*/
int main(void)
{
/* The important rules are in the Makefile */
return 0;
}
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