在 C 项目中包含目标文件或汇编文件? [英] Include object file or assembler file in C Project?

查看:33
本文介绍了在 C 项目中包含目标文件或汇编文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft 的 ELL 库/编译器来将简单的学习算法部署到微控制器.但我过去对嵌入式开发的了解更好.问题如下:

I am playing around a bit bit with Microsofts ELL library/compiler to deploy a simple learning algorithm to a micro controller. But my knowledge regarding embedded development has been better in the past. The Problem is the following:

ELL 从 CNTK 机器学习模型创建一个 LLVM IR 文件和一个 C 头文件(没有纯 c/c++ 文件).到现在为止还挺好.现在我可以使用 IR 告诉 llc 为所需的目标制作汇编程序或目标文件(在我的情况下为 ARM Cortex M4).

ELL creates an LLVM IR file and a C Header file from a CNTK machine learning model (There are no pure c/c++ files). So far so good. Now I can use the IR to tell llc to make an assembler or object file for the desired target from it (ARM Cortex M4 in my case).

所以我最终得到一个头文件 model.h 和一个汇编文件 model.s目标文件 model.o.现在我想在我的嵌入式项目中包含这个带有头文件和预编译模型的模型.开发方面,我使用Bosch XDK,IDE基本是Eclipse.那么,有没有办法可以在我的代码中包含预编译模型?什么时候是,如何?我如何正确地将它包含在 Eclipse 中?还是我必须做进一步的步骤?我还考虑过从目标文件中制作一个静态库,但我对此没有任何经验,到目前为止我的尝试并没有成功结束.感谢您的帮助.

So I end up with a header file model.h and an assembler file model.s or an object file model.o. Now I want to include this model with the header and the precompiled model in my embedded project. For developing, I use the Bosch XDK, the IDE is basically Eclipse. So, is there a way, that I can include the precompiled model in my code? When yes, how? And how do I correctly include it in Eclipse? Or do I have to do further steps? I also thought about making a static library out of the object file, but I do not have any experience on this and my tries did not end successfully so far. Thanks for your kind help.

推荐答案

如果您从目标文件制作静态库,链接器将简单地提取目标文件并链接它.这是一个不必要的步骤,您可以直接将目标文件添加到链接器命令行.或者,将 .s 源文件添加到您的项目中 - 默认构建规则应将其标识为汇编语言文件并调用汇编器而不是编译器.

If you make a static library from the object file, the linker will simply extract the object file and link it. That is an unnecessary step, you can add the object file to the linker command line directly. Alternatively add the .s source file to your project - the default build rules should identify it as an assembly language file and invoke the assembler rather then the compiler.

这篇关于在 C 项目中包含目标文件或汇编文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆