目的:
我正在尝试将某些功能从DDR重新映射到L3缓存,它被编程为SRAM。我使用GNU Embedded Tools GCC 4.7.4作为我的编译器。
我做了什么(这将导致我的问题):
void __attribute__ ((noinline, section ("msmc_program"))) my_func1(unsigned int param0) {
//function body
}
这适用于大多数功能。它编译成功,我可以从地图文件确认映射。
但是,我的问题是我无法使用其他一些函数进行编译。存在链接错误:
arm-none-eabi / bin / ld.exe:最终链接失败:部分没有内容 collect2.exe:错误:ld返回1退出状态
问题:
此链接错误的原因是什么(最终链接失败:部分没有内容)?我在下面提供了一些额外的信息。
当我检查代码时,我看到这些函数在常量表中使用并被称为回调函数。
这就是我的所作所为:
constant_table_file.h:
struct job_element_info_table_s
{
const unsigned int (* jeit_job_exec_func)();
};
constant_table_file.c:
extern void __attribute__ ((externally_visible, long_call, noinline, section ("msmc_program"))) my_func_2(unsigned int param0);
const struct job_element_info_table_s job_info_table[] =
{
{
(const unsigned int (* )())my_func_2,
}
};
another_c_file.c:
void __attribute__ ((externally_visible, long_call, noinline, , section ("msmc_program"))) my_func_2(unsigned int param0) {
//function_body
}
Atrributes" external_visible"和" long_call"是我的实验情况,因为DDR和L3缓存地址相互之间很远。但我没有运气或没有运气。
我还尝试映射常量表" job_info_table"进入msmc_program部分,但我仍然得到同样的错误。
另一个有趣的观点是,如果我将函数映射到任意DDR部分,它会成功编译。例如:
void __attribute__ ((externally_visible, long_call, noinline, , section ("arbitrary_sec_123"))) my_func_2(unsigned int param0) {
//function_body
}
在此示例中,它会自动在DDR中创建一个名为arbitrary_sec_123的部分,并将该函数映射到此部分。
我的编译选项是:
# Compile options.
C_OPTS = -Wall \
-Werror=uninitialized \
-Werror=maybe-uninitialized \
-Werror=overflow \
-mcpu=cortex-a15 \
-mtune=cortex-a15 \
-mabi=aapcs \
-mapcs \
-mfpu=neon \
-ftree-vectorize \
-ftree-vectorizer-verbose=2 \
-mfloat-abi=hard \
-O3 \
-g \
-flto \
-marm \
-fno-gcse \
-fno-strict-aliasing \
-fno-delete-null-pointer-checks \
-fno-strict-overflow \
-fuse-linker-plugin \
-falign-functions=64
# Linker options.
L_OPTS = -nostartfiles \
-static \
-Wl,--gc-sections \
-Wl,-Map,$(BUILD_DIR)/$(PROJ).map \
-mcpu=cortex-a15 \
-mtune=cortex-a15 \
-mabi=aapcs \
-mapcs \
-mfpu=neon \
-ftree-vectorize \
-ftree-vectorizer-verbose=2 \
-mfloat-abi=hard \
-O3 \
-g \
-flto \
-marm \
-fno-gcse \
-fno-strict-aliasing \
-fno-delete-null-pointer-checks \
-fno-strict-overflow \
-fuse-linker-plugin \
-falign-functions=64
LIBS = -lgcc -lc -lm -lrdimon