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.

Calling external function in C and VisSim

I have written a code in CCSv5.40, to write and read data over SPI to EEPROM. I have tried this using CCS v4 as well. I have built and generated .obj files. As advised in user guide and help files, I have addressed these user object files in f280xcl.bat. Now the question is:

I have built a test diagram to call my function written in c. To keep things simple, in order to clearly understand the process, I wanted to call two void functions. I tried to generate code, it does. When compiling, it gives errors for those two extern functions. Errors can be seen below, attached output.

My questions are:

1. I could not find detailed information, on how to use user codes under VisSim diagrams. I have searched forum pages as well. Any advise for related documents, tutorials?

2. C-Code written for F28069 under CCS v4 or v5, built and generated .obj files. Which output files are required to be used in VisSim diagrams? Only .obj? Which version of CCS should be used?

3. Under VisSim, the block that we can use to call our functions in separate C-Code seems to be externFunction block. Do we need to set and use anything else?

4. Is there a specific folder to put .obj files into? I used C:\VisSim80\cg\ folder.

5. Do we need to use any other file? Such as header files, .out files, .map files?

6. I have seen good, useful examples in the examples VisSim have supplied. These helped me to understand how to use externFunction blocks for users' C-Code snippets. Also gave information on how to access hardware registers, peripherals. A similar and very simple example would helped a lot to understand "how to use external C-Code with VisSim?".

I would appreciate any advise alot.
Regards,
Adnan Kurt

Here is the related content of the DOS window during compilation:

**************************************************************************
F280Xcl.bat e2prom_Test_10Feb2014 64 128 so F28069

C:\VisSim80\cg>set USER_OBJS= e2prom_test_AdKu_09Feb2014_v2.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_DefaultIsr.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_GlobalVariableDefs.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_PieCtrl.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_PieVect.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_Spi.obj

C:\VisSim80\cg>set USER_OBJS= F2806x_SysCtrl.obj
.....................

C:\VisSim80\cg>if "F28069" == "F28016" set MTGT=F2801

C:\VisSim80\cg>dsp28xcl F280X e2prom_Test_10Feb2014 64 128 28 ""

C:\VisSim80\cg>rem Copyright (c) 1989-2013 Visual Solutions Inc
.....................

C:\VisSim80\cg>if "280" == "283" (set CFLAG=--float_support=fpu32 -D_DELFINO_ )

C:\VisSim80\cg>cl2000 --float_support=fpu32 -pds=179 -c -g -fs=tmp -k -ml -v28 -O2 -d_DSP -DVERSION_10X=80 -d_
F28XX_ -d_F280X_ -fsTMP -i"\vissim80"\vsdk\include -i.\include e2prom_Test_10Feb2014.c
"e2prom_Test_10Feb2014.c", line 16: warning: expression has no effect
"e2prom_Test_10Feb2014.c", line 17: error: identifier "init_Write_e2prom" is undefined
1 error detected in the compilation of "e2prom_Test_10Feb2014.c".

>> Compilation failure
.................

C:\VisSim80\cg>if "F280x_fpu" == "f28xx" set TGTREGDEF=lib\DSP28_GlobalVariableDefs.obj

C:\VisSim80\cg>lnk2000 --diag_suppress=16002 -c -x -q -me2prom_Test_10Feb2014.map e2prom_Test_10Feb2014.obj F
2806x_usDelay.obj -l lib\ii_F280x_fpu.lib -heap 64 -stack 128 -o e2prom_Test_10Feb2014.out lib\F28069""lnk.
cmd

undefined first referenced
symbol in file
--------- ----------------
_Test_Run e2prom_Test_10Feb2014.obj
_init_Write_e2prom e2prom_Test_10Feb2014.obj

error: unresolved symbols remain
error: errors encountered during linking; "e2prom_Test_10Feb2014.out" not
built

C:\VisSim80\cg>pause
Press any key to continue . . .
*********************************************************************