为ARM Cortex A9生成AOT卤化物对象文件

Generate AOT Halide object file for ARM Cortex A9

本文关键字:卤化物 对象 文件 AOT 生成 ARM Cortex A9      更新时间:2023-10-16

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

我对lesson_11_cross_compile .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_compile .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. cppo -mfpu = neon-vfpv4/opt/Xilinx/SDK/2014.2/gnu/胳膊/林/bin/. ./lib/gcc/arm-xilinx-linux-gnueabi/4.8.1/../../../../arm-xilinx-linux-gnueabi/bin/ld: error: lesson_11_arm_32_linux. xmlo使用VFP寄存器参数,test不使用/opt/Xilinx/SDK/2014.2/gnu/胳膊/林/bin/. ./lib/gcc/arm-xilinx-linux-gnueabi/4.8.1/../../../../arm-xilinx-linux-gnueabi/bin/ld: failed to merge target specific data of file lesson_11_arm_32_linux.o

收集2:error: ld returned 1 exit status

似乎Halide生成了使用VFP的代码。我试过改变-mfpu选项和-mfloat-abi=softfp、soft和hard。没有什么工作。是否有一种方法可以配置卤化物来生成某种类型的FPU指令?

我不认为你想要armv7s的皮质-a9。对于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的目标标志。