One might want to select the symbols to be relocated inside a file or a library. To do this, one can use the FILTER argument of zephyr_code_relocate which must contain a regular expression of the section names to be selected for relocation. The test_function_in_sram2 test case in `tests/application_development/code_relocation` has been updated to verify that only one function `function_in_sram()` is relocated to ram and that the function `function_not_relocated()` is not being relocated when using relocation filter. Signed-off-by: Sylvain Chouleur <sylvain.chouleur@gmail.com> Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
33 lines
721 B
C
33 lines
721 B
C
/*
|
|
* Copyright (c) 2012-2014 Wind River Systems, Inc.
|
|
* Copyright (c) 2022, NXP
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/kernel.h>
|
|
#include <zephyr/sys/printk.h>
|
|
#include <zephyr/ztest.h>
|
|
|
|
void function_in_sram(int32_t value)
|
|
{
|
|
char src[8] = "data\n";
|
|
char dst[8];
|
|
|
|
printk("Hello World! %s\n", CONFIG_BOARD);
|
|
memcpy(dst, src, 8);
|
|
printk("Address of memcpy %p\n\n", &memcpy);
|
|
zassert_mem_equal(src, dst, 8, "memcpy compare error");
|
|
}
|
|
|
|
void function_not_relocated(int32_t value)
|
|
{
|
|
char src[8] = "data\n";
|
|
char dst[8];
|
|
|
|
printk("Hello World! %s\n", CONFIG_BOARD);
|
|
memcpy(dst, src, 8);
|
|
printk("Address of memcpy %p\n\n", &memcpy);
|
|
zassert_mem_equal(src, dst, 8, "memcpy compare error");
|
|
}
|