alpc234 发表于 2012-05-23 10:25

求救哈,编译时出现的错误,请各位大虾指点一下

# gcc -D__KERNEL__ -DMODULE -I /arm2410cl/kernel/linux-2.4.18-2410cl/include/ -Wall -O2 -c gpioctl.c -o gpioctl.o
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:4,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `triple_down':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/pgalloc.h:20,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/highmem.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/pagemap.h:16,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:8,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/proc/cache.h:242:1: warning: "memc_update_mm" redefined
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/mm.h:608:1: warning: this is the location of the previous definition
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/pgalloc.h:20,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/highmem.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/pagemap.h:16,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:8,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/proc/cache.h:243:1: warning: "memc_update_addr" redefined
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/mm.h:607:1: warning: this is the location of the previous definition
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/pgalloc.h:20,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/highmem.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/pagemap.h:16,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:8,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/proc/cache.h:244:1: warning: "memc_clear" redefined
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/locks.h:5,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:6,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/mm.h:609:1: warning: this is the location of the previous definition
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:10,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: At top level:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:45: redefinition of `struct semaphore'
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:10,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:65:1: warning: "__MUTEX_INITIALIZER" redefined
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/fs.h:200,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:4,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:36:1: warning: this is the location of the previous definition
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:10,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:68:1: warning: "__DECLARE_SEMAPHORE_GENERIC" redefined
In file included from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/fs.h:200,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/devfs_fs_kernel.h:4,
               from /arm2410cl/kernel/linux-2.4.18-2410cl/include/linux/miscdevice.h:4,
               from gpioctl.c:1:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:39:1: warning: this is the location of the previous definition
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:75: redefinition of `sema_init'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:46: `sema_init' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:91: redefinition of `init_MUTEX'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:56: `init_MUTEX' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:96: redefinition of `init_MUTEX_LOCKED'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:61: `init_MUTEX_LOCKED' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:116: redefinition of `down'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:83: `down' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: In function `down':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:123: parse error before "LOCK"
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: At top level:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:143: redefinition of `down_interruptible'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:96: `down_interruptible' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: In function `down_interruptible':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:152: parse error before "LOCK"
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: At top level:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:174: redefinition of `down_trylock'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:105: `down_trylock' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: In function `down_trylock':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:183: parse error before "LOCK"
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: At top level:
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:207: redefinition of `up'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:120: `up' previously defined here
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h: In function `up':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm-i386/semaphore.h:213: parse error before "LOCK"
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `down':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `down_interruptible':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:101: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:101: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `down_trylock':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:110: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:110: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `up':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `smb_lock_server':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `smb_unlock_server':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `lock_parent':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `unlock_dir':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `double_down':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `double_up':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `triple_up':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `double_unlock':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `lock_super':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:88: unknown register name `ip' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `unlock_super':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'
—————————————————————————————————源码分割线———————————————————————————————————————————
#include <linux/miscdevice.h> //struct miscdevice
#include <linux/kernel.h>//k
#include <linux/module.h>//mod
#include <linux/init.h> //insmod
#include <asm/hardware.h>

#include <asm/delay.h>
#include <asm/uaccess.h>

static int ctrlgpioMajor = 0;

static int s3c2410_ctrl_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{       
                switch(cmd)
                {
                        case 0:
                        if(arg==0)
                                {
                                        write_gpio_bit(GPIO_C5,1);
                                        return 0;
                                }
                        else if(arg==1)
                                {
                                             write_gpio_bit(GPIO_C7,1);
                                        return 0;
                                }
                        else if(arg==2)
                                {
                                        write_gpio_bit(GPIO_C5,1);
                                        write_gpio_bit(GPIO_C7,1);
                                        return 0;
                                }
                        else if(arg==3)
                                {
                                       
                                        write_gpio_bit(GPIO_C5,0);
                                        write_gpio_bit(GPIO_C7,0);
                                        return        0;       
                                }
                                break;
        }

}
static int s3c2410_ctrl_open(struct inode *inode,struct file *filp)
{
        MOD_INC_USE_COUNT;
        return 0;
}

static int s3c2410_ctrl_release(struct inode *inode,struct file *filp)
{
        MOD_DEC_USE_COUNT;
        return 0;
}

static struct file_operations s3c2410_fops = {
       
        owner:                THIS_MODULE,
        open:                s3c2410_ctrl_open,
        ioctl:                s3c2410_ctrl_ioctl,
        release:        s3c2410_ctrl_release,
};

static int __init s3c2410_ctrl_init(void)
{
        int ret;
        set_gpio_ctrl(GPIO_MODE_OUT|GPIO_C5);
        set_gpio_ctrl(GPIO_MODE_OUT|GPIO_C6);
        set_gpio_ctrl(GPIO_MODE_OUT|GPIO_C7);
        write_gpio_bit(GPIO_C5,0);
        write_gpio_bit(GPIO_C7,0);
        ret = register_chrdev(0,"zzzyznjj",&s3c2410_fops);
        if(ret<0){
                printk("zzzyznjj can't get major number\n");
                return ret;
        }
        ctrlgpioMajor = ret;

        printk("zzzyznjj initialized\n");
       
        return 0;
}

static void __exit s3c2410_ctrl_exit(void)
{
        unregister_chrdev(ctrlgpioMajor,"zzzyznjj");
}

module_init(s3c2410_ctrl_init);
module_exit(s3c2410_ctrl_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("threewater<threewater@up-tech.com>");
MODULE_DESCRIPTION("gpio(ZNJJ) driver for S3C2410");





请各位能人帮帮忙哈,纠结我两天了,我是个新手,一直改不过来,谢谢帮忙

alpc234 发表于 2012-05-23 16:09

用fs.h 头文件就会出现
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h: In function `unlock_super':
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `lr' in `asm'
/arm2410cl/kernel/linux-2.4.18-2410cl/include/asm/semaphore.h:125: unknown register name `ip' in `asm'

这种类似的错误,怎么办?????

xxw19840406 发表于 2012-05-24 15:03

这个要用交叉编译器吧

自己google一下应该就知道了
页: [1]
查看完整版本: 求救哈,编译时出现的错误,请各位大虾指点一下