DSPRelated.com
Forums

plz.....tell about GPIO_support and usedefs........plz help me

Started by rich...@tcs.com March 18, 2008
My problem is that my GPIO code is compiling but when i link the following code ...i get errors,,,with gpio_open as undefined
Actually i wanted to ask whether GPIO_SUPPORT and USEDEFS have to be defined 1 before including csl-gpio.h......
becoz when i dont put #define gpio_support as 1,,, i get error as gpio_handle as undefined....
so what kind of such initializations have to be done before including csl_gpiohal.h......

#include
#define CHIP_DA610
#include "C6x.h"
#include "csl_chiphal.h"

#define GPIO_SUPPORT 1 //plz chk GPIO_SUPPORT and USEDEFS....................
#define _INLINE 1
//#define _GPIO_MOD_
//#define USEDEFS 1

#include "csl_gpiohal.h"

#include "csl_gpio.h"
#if defined(_TMS320C6201)
#define ALIGNED_ARRAY(ptr) _nassert((int) ptr % 8 == 0)

#elif defined( _chip_6201) || defined(_TMS320C6700)
#define ALIGNED_ARRAY(ptr) _nassert((int) ptr % 4 == 0)
#else
#define ALIGNED_ARRAY(ptr) /* empty */
#endif

main()
{
unsigned b=0;
GPIO_Handle hGpio;
hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
GPIO_pinEnable(hGpio,GPIO_PIN0);
GPIO_pinDirection(hGpio, GPIO_PIN0,GPIO_OUTPUT);
GPIO_pinWrite(hGpio,GPIO_PIN0,b);
}

--------------------------- test_richa.pjt - Debug ---------------------------
[toggle.cpp] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -fr"C:/CCStudio_v3.3/examples/sim64xx/code_coverage/test_richa/Debug" -d"CHIP_DA610" -mv6201 -@"Debug.lkf" "toggle.cpp"
"toggle.cpp", line 5: warning: incompatible redefinition of macro "CHIP_DA610"
"toggle.cpp", line 12: warning: incompatible redefinition of macro "GPIO_SUPPORT" (declared at line 313 of "C:/CCStudio_v3.3/C6000/csl/include/csl_chiphal.h")
"toggle.cpp", line 33: warning: return type "int" omitted in declaration of function "main"
"toggle.cpp", line 83: warning: last line of file ends without a newline

Warning: The project has no cmd file while the Text Linker is selected
[Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"

>> warning: entry point symbol _c_int00 undefined

undefined first referenced
symbol in file
--------- ----------------
_GPIO_open C:\\CCStudio_v3.3\\examples\\sim64xx\\code_coverage\\test_richa\\Debug\\toggle.obj
>> error: symbol referencing errors - './Debug/test_richa.out' not built

>> Compilation failure

Build Complete,
2 Errors, 6 Warnings, 0 Remarks.
I don't think you need to set GPIO_SUPPORT!

GPIO_SUPPORT ist by csl_chip_hal.h when you select the correct CHIP. The
same may be valid for USEDEFS.

r...@tcs.com schrieb:
> My problem is that my GPIO code is compiling but when i link the
> following code ...i get errors,,,with gpio_open as undefined
> Actually i wanted to ask whether GPIO_SUPPORT and USEDEFS have to be
> defined 1 before including csl-gpio.h......
> becoz when i dont put #define gpio_support as 1,,, i get error as
> gpio_handle as undefined....
> so what kind of such initializations have to be done before including
> csl_gpiohal.h......
>
> #include
> #define CHIP_DA610
> #include "C6x.h"
> #include "csl_chiphal.h"
>
> #define GPIO_SUPPORT 1 //plz chk GPIO_SUPPORT and
> USEDEFS....................
> #define _INLINE 1
> //#define _GPIO_MOD_
> //#define USEDEFS 1
>
> #include "csl_gpiohal.h"
>
> #include "csl_gpio.h"
>
> #if defined(_TMS320C6201)
> #define ALIGNED_ARRAY(ptr) _nassert((int) ptr % 8 == 0)
>
> #elif defined( _chip_6201) || defined(_TMS320C6700)
> #define ALIGNED_ARRAY(ptr) _nassert((int) ptr % 4 == 0)
> #else
> #define ALIGNED_ARRAY(ptr) /* empty */
> #endif
>
> main()
> {
> unsigned b=0;
> GPIO_Handle hGpio;
> hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
> GPIO_pinEnable(hGpio,GPIO_PIN0);
> GPIO_pinDirection(hGpio, GPIO_PIN0,GPIO_OUTPUT);
> GPIO_pinWrite(hGpio,GPIO_PIN0,b);
> }
>
> --------------------------- test_richa.pjt - Debug
> ---------------------------
> [toggle.cpp] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g
> -fr"C:/CCStudio_v3.3/examples/sim64xx/code_coverage/test_richa/Debug"
> -d"CHIP_DA610" -mv6201 -@"Debug.lkf" "toggle.cpp"
> "toggle.cpp", line 5: warning: incompatible redefinition of macro
> "CHIP_DA610"
> "toggle.cpp", line 12: warning: incompatible redefinition of macro
> "GPIO_SUPPORT" (declared at line 313 of
> "C:/CCStudio_v3.3/C6000/csl/include/csl_chiphal.h")
> "toggle.cpp", line 33: warning: return type "int" omitted in declaration
> of function "main"
> "toggle.cpp", line 83: warning: last line of file ends without a newline
>
> Warning: The project has no cmd file while the Text Linker is selected
> [Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"
>
> >> warning: entry point symbol _c_int00 undefined
>
> undefined first referenced
> symbol in file
> --------- ----------------
> _GPIO_open
> C:\\CCStudio_v3.3\\examples\\sim64xx\\code_coverage\\test_richa\\Debug\\toggle.obj
> >> error: symbol referencing errors - './Debug/test_richa.out' not built
>
> >> Compilation failure
>
> Build Complete,
> 2 Errors, 6 Warnings, 0 Remarks.