Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

segmentation fault on target

$
0
0

Hi,

i am presently working on 816x/393x ti digital spectral board . Recently i downloaded a zip file to run the test code on the board . In the zip file i got four folder GEL,INCLUDE,LIB AND TEST.  I tried to write my code to blink the led using I2C0 .

MY CODE IS

#include "evm816x.h"

#include "evm816x_i2c.h"

main()

{

  char val[2];

 val[0]=0xaa;

val[1]=0xff;

EVM816X_init();

EVM816X_write_i2c0(0x20,val,2);

}

I am using ubuntu 11.10 and i am using Makefile to compile my code and execute them on the target.

the content of my makefile is

include /usr/local/ezsdk/Rules.make

sec:
    $(CSTOOL_PREFIX)gcc -o seven secondapp.c

/usr/local/ezsdk is the location where i installed my ezsdk.

when i am trying to compile the program i got an error

/root/CodeSourcery/Sourcery_G++_Lite//bin/arm-none-linux-gnueabi-gcc -o seven secondapp.c
/tmp/ccMFHN89.o: In function `main':
secondapp.c:(.text+0x1c): undefined reference to `EVM816X_init'
collect2: ld returned 1 exit status
make: *** [sec] Error 1

In order to overcome this error what i have done is i have included the .c file in my test code file . now my file look like

#include "evm816x.h"

#include "evm816x_i2c.h"

#include "evm816x.c"

#include "evm816x_i2c.c"

main()

{

  char val[2];

 val[0]=0xaa;

val[1]=0xff;

EVM816X_init();

EVM816X_write_i2c0(0x20,val,2);

}

after doing this i am able to generate the executable file.

I have changed the base address but still i am getting segmentation fault.

IN ORDER to see where my program is geting segmentation fault i found that when i try to write any I2C register i got the segmentation fault.

Also I HAVE Done nothing with the gel file. Please tell me the purpose of having gel file and its application . And also tell me the correct way to include the library so that i don't have to include .c file in the main application.

please help me out


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>