为ARM Cortex A9生成AOT Halide对象文件

时间:2015-09-01 13:36:01

标签: c++ linux gcc halide

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

我已使用以下更改修改了lesson_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);

我使用在lesson_11_cross_compilation.cpp文件顶部列出的g ++命令编译它。这会生成lession_11可执行文件。我运行可执行文件,我得到一个lesson_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 lesson_10_aot_compilation_run.cpp lesson_11_arm_32_linux.o -mfpu =霓虹灯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:无法合并文件的目标特定数据lesson_11_arm_32_linux.o collect2:错误:ld返回1退出状态

似乎Halide生成使用VFP的代码。我试过更改-mfpu选项和-mfloat-abi = softfp,soft和hard。什么都行不通。有没有办法配置Halide生成某种类型的FPU指令?

1 个答案:

答案 0 :(得分:0)

我认为你不需要armv7s用于皮质-a9。对于32位手臂,Halide假定为cortex-a9 ,除非你已经启用了armv7。

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

我们应该添加一个选择float abi的目标标志。