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

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

问题描述

我正在与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 Project中包含目标文件还是汇编文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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