This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VLYNQ, a compiling issue



The kernel I used is linux-2.6.10_mvl401_LSP_01_30_00_082.

 

I want to use the VLYNQ driver (linux-2.6.10_mvl401_LSP_01_30_00_082\arch\arm\mach-davinci\vlynq) in the user space. So I write a very simple application as follow:

 

 

/** \file   vlynq_sample.c

    \brief  DaVinci Vlynq Sample App

    This file contains DaVinci Vlynq Controller Test  code.

    NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE

          REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT

          TO CHANGE.

    (C) Copyright 2004, Texas Instruments, Inc

    @author         Anuj Aggarwal

    @version    0.1 -

                Created on 05/03/2007

 */

 

#include <linux/module.h>

#include <asm/io.h>

#include <asm/arch/hardware.h>

#include <asm/arch/vlynq/vlynq_os.h>

#include <asm/arch/vlynq/vlynq_dev.h>

 

void  main(void)

{

        printf("VLYNQ MASTER :Data receive completed.\n\r");

}

 

 

The Makefile I used is as follow:

 

DAVINCI_ROOT = /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082

CROSS_COMPILE = /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-

INC = $(DAVINCI_ROOT)/include

 

OBJECT := $(patsubst %.c,%.o,$(wildcard *.c))

EXEC := $(patsubst %.c,%,$(wildcard *.c))

 

CFLAGS = -g -s $(INC:%=-I %) -static $(DEFINES)

 

#$(CROSS_COMPILE)gcc $(CFLAGS) $(OBJECT) -o $(EXEC)

all: $(OBJECT)

       $(CROSS_COMPILE)gcc $(CFLAGS) $(OBJECT) -o $(EXEC)

clean:

       rm -f $(OBJECT)

 

distclean: clean

       rm -f $(EXEC) *.~

 

.c.o:

       $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@

 

 

When I didn’t include the following header file “<linux/module.h> <asm/io.h> <asm/arch/hardware.h><asm/arch/vlynq/vlynq_os.h><asm/arch/vlynq/vlynq_dev.h>”, it compile successful.

The compiling information is as follow:

 

/home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-gcc -g -s -I /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include -static  -c saVlynq.c -o saVlynq.o

saVlynq.c: In function `main':

saVlynq.c:50: warning: return type of 'main' is not `int'

/home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-gcc -g -s -I /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include -static  saVlynq.o -o saVlynq

 

 

But when I include the following header file “<linux/module.h> <asm/io.h> <asm/arch/hardware.h><asm/arch/vlynq/vlynq_os.h><asm/arch/vlynq/vlynq_dev.h>” just as the above source code, it compile wrong. Even I didn’t include <asm/io.h>, it will be wrong. Because the vlynq_dev.h file also include the hardware.h file.

 

 

The compiling information is as follow:

 

 

arm_v5t_le-gcc -Wall  -lposixtime -I /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include  -g -D__DEBUG -o saVlynq saVlynq.c

In file included from /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include/asm/arch/hardware.h:37,

                 from saVlynq.c:58:

/home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include/asm/arch/io.h:135: warning: type defaults to `int' in declaration of `u16'

/home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include/asm/arch/io.h:135: warning: no semicolon at end of struct or union

/home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082/include/asm/arch/io.h:135: error: parse error before "offset"

 

  • u16 and other such typedefs are present in include/asm/types.h file which has been included in include/asm/io.h file. But these typedefs will come into effect only if __KERNEL__ macro is defined in the Makefile using the -D option. Adding the macro definition in the CFLAGS of the Makefile should solve your problem.

    Regards, Sudhakar

  • Thanks. When I change my makefile as follow, it compile OK.

    DAVINCI_ROOT = /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.10_mvl401_LSP_01_30_00_082

    CROSS_COMPILE = /home/dm6467_140/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-

    INC = $(DAVINCI_ROOT)/include

     

    OBJECT := $(patsubst %.c,%.o,$(wildcard *.c))

    EXEC := $(patsubst %.c,%,$(wildcard *.c))

     

    CFLAGS = -g -s $(INC:%=-I %) -static $(DEFINES) -D__KERNEL__

     

    #$(CROSS_COMPILE)gcc $(CFLAGS) $(OBJECT) -o $(EXEC)

    all: $(OBJECT)

           $(CROSS_COMPILE)gcc $(CFLAGS) $(OBJECT) -o $(EXEC)

    clean:

           rm -f $(OBJECT)

     

    distclean: clean

           rm -f $(EXEC) *.~

     

    .c.o:

           $(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@