0

我正在尝试使用 Halide-lang AOT 和交叉编译教程。我想做的是交叉 AOT 为 Cortex A9 嵌入式 Linux 目标编译一个 Halide 程序。

我修改了 course_11_cross_compilation.cpp 并进行了以下更改:

Target target;
target.os = Target::Linux; // The operating system
target.arch = Target::ARM;   // The CPU architecture
target.bits = 32;            // The bit-width of the architecture
std::vector<Target::Feature> arm_features; // A list of features to set
arm_features.push_back(Target::ARMv7s);
target.set_features(arm_features);
brighter.compile_to_file("lesson_11_arm_32_linux", args, target); // Pass the target as the last argument.
brighter.compile_to_c("lession_11.c", args, "foo", target);

我使用 course_11_cross_compilation.cpp 文件顶部列出的 g++ 命令编译它。这将生成lession_11 可执行文件。我运行可执行文件并得到一个课程_11_arm_32_linux.h/o 文件。

然后我在该文件上运行我的交叉编译器,以尝试使用以下命令行为我的目标生成一个程序:

/opt/Xilinx/SDK/2014.2/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-g++ -o test -std=c++11 -lpthread course_10_aot_compilation_run.cpp course_11_arm_32_linux.o -mfpu=neon-vfpv4 /opt/Xilinx/SDK/2014.2/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-linux-gnueabi/4.8.1/../../../../arm- xilinx-linux-gnueabi/bin/ld:错误:lesson_11_arm_32_linux.o 使用 VFP 寄存器参数,测试不 /opt/Xilinx/SDK/2014.2/gnu/arm/lin/bin/../lib/gcc/arm-xilinx -linux-gnueabi/4.8.1/../../../../arm-xilinx-linux-gnueabi/bin/ld:未能合并文件课程_11_arm_32_linux.o collect2的目标特定数据:错误:ld返回1 退出状态

Halide 似乎生成了使用 VFP 的代码。我尝试更改 -mfpu 选项和 -mfloat-abi=softfp、软和硬。没有任何效果。有没有办法配置 Halide 来生成某种类型的 FPU 指令?

4

1 回答 1

0

我认为您不需要用于 cortex-a9 的 armv7。对于 32 位 arm,Halide 假定使用 cortex-a9 ,除非您启用了 armv7s。

如果你有一个“gnueabihf”工具链,你可以使用它,它应该可以工作(硬浮动)。如果您愿意自己编译 Halide,您还可以修改 CodeGen_ARM::use_soft_float_abi() ( https://github.com/halide/Halide/blob/master/src/CodeGen_ARM.cpp#L1252 ) 来做您想做的事.

我们可能应该添加一个选择浮动 abi 的目标标志。

于 2015-09-01T23:49:46.363 回答