如何为Linux驱动程序&准备QTCreator内核开发 [英] Howto prepare QTCreator for linux driver & kernel development

查看:352
本文介绍了如何为Linux驱动程序&准备QTCreator内核开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上尝试了一些IDE来开发C语言的驱动程序.QtCreator最适合我. 我只需要IDE来实现智能(代码完成,单击即可跳转到函数等),以便更快地进行编码.

i tried a few IDEs on linux to develop driver in C. QtCreator suits best for me. I need the IDE just for the intellisence (codecompletion, jump to functions on click.. etc.) for quicker coding.

是否有人为此配置了QTCreator. 例如.我该怎么做才能获得结构的智慧?

Has anyone configured QTCreator for such needs. E.g. what do i have to do to get intellisence for a struct?

致谢 骆驼.

推荐答案

更好的解决方案是使用导入现有项目"导入linux源. 添加ARCH所需的所有文件. 创建完成后,请编辑.includes文件并删除列出的所有包含目录.

A better solution is to import the linux source with "Import Existing Project". Add all the files your ARCH requires. Once created edit the .includes file and remove all the include dirs listed.

然后只添加Linux使用的少数几个.

Then just add the few that linux uses.

include
arch/<ARCH>/include
arch/<ARCH>/mach-<MACH>/include
arch/<ARCH>/<PLATFORM>/include

现在编辑.config,这是最好的位. 添加如下内容.

Now edit .config, this is the best bit. Add something like the following.

#define __KERNEL__
#define __arm__
#define __LINUX_ARM_ARCH__ 7

#include <linux/kconfig.h>

这是#include,它可以带来您最想要的所有autoconf东西.

It's the #include that brings in all of the autoconf stuff you mostly want.

执行make V = 1以查看内核定义使用的标准定义.

Do a make V=1 to see the standard defines that the Kernel build uses.

如果您使用的是交叉编译器,请照常在构建并运行"编译器标签中进行设置.

Also if you're using a cross compiler, set up as usual in "Build & Run" Compilers tab.

这篇关于如何为Linux驱动程序&amp;准备QTCreator内核开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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