uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(60):KBUILD_MODNAME

rev 0.1

 

快乐虾

http://blog.csdn.net/lights_joy/

lights@hb165.com

 

本文适用于

ADI bf561 DSP

优视BF561EVB开发板

uclinux-2008r1.5-rc3(smp patch)

Visual DSP++ 5.0(update 5)

 

欢迎转载,但请保留作者信息

 

在一些以模块方式提供的驱动中,使用了module_param这个宏来定义一些参数,这个宏将引起一个语法错误:

"../../drivers/net/dm9000.c", line 124: cc0020:  error: identifier

          "KBUILD_MODNAME" is undefined

  module_param(watchdog, int, 0400);

看看module_param的定义:

#define module_param(name, type, perm)                  /

     module_param_named(name, name, type, perm)

继续找module_param_named的定义:

/* Helper functions: type is byte, short, ushort, int, uint, long,

   ulong, charp, bool or invbool, or XXX if you define param_get_XXX,

   param_set_XXX and param_check_XXX. */

#define module_param_named(name, value, type, perm)             /

     param_check_##type(name, &(value));                   /

     module_param_call(name, param_set_##type, param_get_##type, &value, perm); /

     __MODULE_PARM_TYPE(name, #type)

再展开module_param_call

/* This is the fundamental function for registering boot/module

   parameters.  perm sets the visibility in sysfs: 000 means it's

   not there, read bits mean it's readable, write bits mean it's

   writable. */

#define __module_param_call(prefix, name, set, get, arg, perm)        /

     /* Default value instead of permissions? */             /

     static int __param_perm_check_##name __attribute__((unused)) =   /

     BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2));  /

     static char __param_str_##name[] = prefix #name;        /

     static struct kernel_param const __param_##name              /

     __attribute_used__                        /

    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) /

     = { __param_str_##name, perm, set, get, arg }

 

#define module_param_call(name, set, get, arg, perm)                   /

     __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm)

在这里使用了一个MODULE_PARAM_PREFIX的宏定义:

#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."

错误提示中的KBUILD_MODNAME就出现在这里。

这个宏就是定义了模块的名称,是一个字符串,每个不同的驱动模块都有不同的名称,因此当在linux下编译时,将这个名称写在了Makefile中,因此在编译这个模块文件时,编译器会自动加上-DKBUILD_MODNAME=”xxx”这样的定义。

VDSP下编译时,也必须为此模块文件单独定义一个KBUILD_MODNAME这个的宏。其操作为:

在文件上点右键 -> File Options -> Build with -> File specific settings -> Preprocessor -> Proprocessor definitions,添加如下定义:

KBUILD_MODNAME=/"dm9000/"

注意一定要加上反斜杠。否则将出错。

 

1       参考资料

uclinux-2008R1.5-RC3(bf561)VDSP5的移植(56)L1 data memory overflow(2009-02-03)

uclinux-2008R1.5-RC3(bf561)VDSP5的移植(57)bsz(2009-2-3)

uclinux-2008R1.5-RC3(bf561)VDSP5的移植(58)_cplb_mgr(2009-2-3)

uclinux-2008R1.5-RC3(bf561)VDSP5的移植(59)current_text_addr(2009-2-10)

 

 

如果您对本文有兴趣,可以到http://www.bfin-tools.org/bbs/viewthread.php?tid=14&extra=参与讨论!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值