Error in C code integration

Hello:

i complied Example_2803xLEDBlink in CCSV4.it is working fine on TMS320F28035 Control card. when i use extern fuction block to integrate same c code in visSim, i see error as attached in command prompt. what could be the reason. i have even set user objs too. please let me have solution for this.

Regards, MALA

Error in C Code Integration...

Hi Anders, I am a colleague of Mala and working on C Code Integration in Vissim. I went through all the discussion in this thread. Following is the c code which i want to integrate with the Vissim. There is function named as ToggleLEDs() in the it, which i am calling in the .vsm file.

/* * Example_2806xGpioToggle_1.c * * Created on: Dec 17, 2012 * Author: Administrator */

include "DSP28x_Project.h" // Device Headerfile and Examples Include File

// Prototype statements for functions found within this file. //void delay_loop(void); void ToggleLEDs(void);

/void delay_loop() { short i; for (i = 0; i < 20000; i++) {} }/

void ToggleLEDs(void) { static unsigned int delay=0;

delay++;
if(delay >= 10)
{
    GpioDataRegs.GPATOGGLE.bit.GPIO20 = 1;
    GpioDataRegs.GPATOGGLE.bit.GPIO21 = 1;
    GpioDataRegs.GPATOGGLE.bit.GPIO22 = 1;
    GpioDataRegs.GPATOGGLE.bit.GPIO27 = 1;
    delay = 0;
}

/*delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();
delay_loop();*/

}

/void main(void) { }/

The error we are getting are:

C:\VisSim80\cg>lnk2000 -c -x -q -m28.map 28.obj C:\TI\controlSUITE\device_suppor t\f2806x\v100\F2806x_examples\Test_gpio_toggle\Debug\ToggleLEDs.obj -l lib\ii_F 280X.lib -heap 0x400 -stack 0x400 -o 28.out lib\F280Xlnk.cmd error: cannot find file "28.obj" fatal error: file "lib\f28xxFLASHboot.obj" specifies ISA revision "C2800", which is not compatible with ISA revision "C28FPU32" specified in a previous file or on the command line

For integrating this kind of function, is it necessary that the file has to be compiled in CCS? This file is not compiled in CCS as it has no main() function (I have deliberately removed it and using the main() function which is generated by Vissim). It gives three errors which, I feel, are related to main() function only. Even though "Example_2806xGpioToggle.out" is not generated, I see, ToggleLEDs.obj file is generated. Is that a problem? Please clarify.

What is the difference between running the f280xcl.bat file and compiling the .vsm file through Vissim? What is preferred? Because, the errors we see when f280xcl.bat file, are not seen when we compile it in Vissim, but when we download and run after compilation is done, nothing happenes. I am also attaching the a text files in which I have copied all the messages which I get when I run f280xcl.bat and when I compile in Vissim.

Please let us know where are we missing to get this through.

Awaiting for your reply.

-- Thanks & Regards, Pranav

You misspelled $firstPass.

You misspelled $firstPass. You forgot to capitalize the 'P'. Just choose it from the drop down menu and spelling will not be a problem.

yes it is a file name rather

yes it is a file name rather than a function name and that file has both interrupt handling with timer0 as well as main function. attached .vsm for led blinking. if i want to use only visSim RTOS to be running then i would define only function for LED blinking in C code, is it? can you please send me one example file on this if possible.

Hi:i am trying the same on

Hi:

i am trying the same on TMS320F28062 controller and spectrum digital emulator with our developed hardware. command prompt text details are as follows, i have also attached visSim file. F280Xcl.bat LEDBlinkTMS320F28062CCodeIntegration 400 400 so F28062

C:\VisSim80\cg>set USER_OBJS=C:\TI\controlSUITE\device_support\f2806x\v100\F2806 x_examples\timed_led_blink\Debug\Example_2806xLEDBlink

C:\VisSim80\cg>set FILE=LEDBlinkTMS320F28062CCodeIntegration

C:\VisSim80\cg>cl2000 --float_support=fpu32 -c -g -fs=tmp -k -ml -v28 -O2 -d_DSP -DVERSION_10X=80 -d_F28XX_ -d_F280X_ -fsTMP -i"C:\VisSim70"\vsdk\include -i.\include LEDBlinkTMS320F28062CCodeIntegration.c "LEDBlinkTMS320F28062CCodeIntegration.c", line 19: warning: expression has no effect

C:\VisSim80\cg>lnk2000 -c -x -q -mLEDBlinkTMS320F28062CCodeIntegration.map LEDBlinkTMS320F28062CCodeIntegration.obj C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\timed_led_blink\Debug\Example_2806xLEDBlink -l lib\ii_F280x_f pu.lib -heap 400 -stack 400 -o LEDBlinkTMS320F28062CCodeIntegration.out lib\F28062""lnk.cmd error: symbol "_main" redefined: first defined in "LEDBlinkTMS320F28062CCodeIntegration.obj"; redefined in "C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\timed_led_blink\Debug\Example_2806xLEDBlink.obj"

undefined first referenced

symbol in file

--------- ----------------

_ConfigCpuTimer C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\t imed_led_blink\Debug\Example_2806xLEDBlink.obj _CpuTimer0 C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\t imed_led_blink\Debug\Example_2806xLEDBlink.obj _InitCpuTimers C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\t imed_led_blink\Debug\Example_2806xLEDBlink.obj _InitPieCtrl C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\t imed_led_blink\Debug\Example_2806xLEDBlink.obj _InitSysCtrl C:\TI\controlSUITE\device_support\f2806x\v100\F2806x_examples\t imed_led_blink\Debug\Example_2806xLEDBlink.obj

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

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

OK,there are several

OK,there are several problems:

  1. The TI example you use contains two functions: main() and interrupt void cpu_timer0_isr(void)
    There can only be 1 main function in a program. VisSim assumes that it will generate the "main()" function unless you choose "Call from Foreign RTOS". If you choose "Call from Foreign RTOS", then you will need to setup all interrupts and timers in your RTOS. If you want to continue to use the VisSim RTOS, then you must not define main() in your hand code.
  2. The function you are calling with the VisSim extern Function block is "Example_2806xLEDBlink". But there is no such function defined. You also left off the parenthesis suffix. Lets say you have a function foo that takes two arguments. And you want them to be supplied by two input pins to the block. You would use the following text in the block: "foo($1,$2)", where $1 refers to pin1 and $2 to pin 2.
  3. If you want to define your own interrupt handler: "myISR", you should use the VisSim interrupt handler registrar like so:
    installInterruptVec(3,5,myISR);
    Where arg 1 is the CPU interrupt, arg2 is the PIE offset, and arg 3 is the name of your ISR.

attached command prompt

attached command prompt complete text in word document. please suggest on this. and how can we differentiate floating and fixed point MCU in VisSim.

F280Xcl.bat

F280Xcl.bat LEDBlinkTMS320F28035 400 400 so F28035 sr

C:\VisSim80\cg>set USER_OBJS=C:\TI\controlSUITE\device_support\f2803x\v121\DSP28 03x_examples_ccsv4\timed_led_blink\Debug\Example_2803xLEDBlink

C:\VisSim80\cg>set LCF=so

C:\VisSim80\cg>set MTGT=F28035

C:\VisSim80\cg>set FPU=

C:\VisSim80\cg>if "so" == "sfo" set LCF=f

C:\VisSim80\cg>if "so" == "fo" set LCF=f

C:\VisSim80\cg>if "so" == "o" set LCF=""

C:\VisSim80\cg>if "so" == "so" set LCF=""

C:\VisSim80\cg>if "280" == "283" set FPU=u

C:\VisSim80\cg>if "2803" == "28M3" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28069" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28068" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28067" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28066" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28065" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28064" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28065" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28062" set FPU=u

C:\VisSim80\cg>if "F28035" == "F28015" set MTGT=F2801

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

C:\VisSim80\cg>dsp28xcl F280X LEDBlinkTMS320F28035 400 400 28 "" sr

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

C:\VisSim80\cg>rem F280X=full target name,LEDBlinkTMS320F28035=file path,400=hea p,400=stack,28=CPU class,""=app type(standalone v debug,flash v RAM)

C:\VisSim80\cg>call setdsp2x

C:\VisSim80\cg>Rem set path to TI C Compiler

C:\VisSim80\cg>if "C:\VisSim70" == "" set VS_DIR=\vissim80

C:\VisSim80\cg>rem set compiler path

C:\VisSim80\cg>if not "" == "" set C_DIR=

C:\VisSim80\cg>if exist .\dosrun24.bat call dosrun24.bat

C:\VisSim80\cg>set CG5DIR=C:\CCStudio_v3.3\C2400\cgtools

C:\VisSim80\cg>if EXIST "C:\CCStudio_v3.3\C2400\cgtools" set PATH="C:\CCStudio_v 3.3\C2400\cgtools\bin\";C:\Program Files (x86)\STMicroelectronics\st_toolset\asm ;C:\Program Files (x86)\PC Connectivity Solution\;C:/Program Files (x86)/Texas I nstruments/xdctools_3_20_08_88;C:\Program Files\Common Files\Microsoft Shared\Wi ndows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\ windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\Windows PowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;\cc\bin;C:\Program F iles (x86)\WinMerge;C:\OrCAD\OrCAD_10.3\tools\fet\bin;C:\OrCAD\OrCAD_10.3\tools\ pcb\bin;C:\OrCAD\OrCAD_10.3\tools\specctra\bin;C:\OrCAD\OrCAD_10.3\tools\bin;C:\ OrCAD\OrCAD_10.3\tools\PSpice\Library;C:\OrCAD\OrCAD_10.3\tools\Capture;C:\OrCAD \OrCAD_10.3\tools\bin;C:\OrCAD\OrCAD_10.3\tools\libutil\bin;C:\OrCAD\OrCAD_10.3\ tools\fet\bin;C:\OrCAD\OrCAD_10.3\tools\pcb\bin;C:\OrCAD\OrCAD_10.3\tools\specct ra\bin;C:\OrCAD\OrCAD_10.3\tools\PSpice;C:\OrCAD\OrCAD_10.3\tools\PSpice\Library ;C:\OrCAD\OrCAD_10.3\tools\Capture;C:\OrCAD\OrCAD_10.3\OpenAccess\bin\win32\opt; c:\RIDE\Bin;C:\Program Files (x86)\Raisonance\Ride\Bin;C:\Program Files (x86)\Ra isonance\Ride\arm-gcc\bin;C:/Program Files (x86)/Texas Instruments/xdctools_3_20 _08_88;C:\ti\ccsv5\utils\bin;C:\Program Files (x86)\COSMIC\CXSTM8_32K

C:\VisSim80\cg>if EXIST "C:\CCStudio_v3.3\C2400\cgtools" SET C2400_C_DIR=C:\CCSt udio_v3.3\C2400\cgtools\lib;C:\CCStudio_v3.3\C2400\cgtools\include

C:\VisSim80\cg>if EXIST "C:\CCStudio_v3.3\C2400\cgtools" SET DSP_C_DIR=C:\CCStud io_v3.3\C2400\cgtools\lib;C:\CCStudio_v3.3\C2400\cgtools\include

C:\VisSim80\cg>if exist .\dosrun28.bat call dosrun28.bat

C:\VisSim80\cg>set CG5DIR=C:\TI\ccsv5\tools\compiler\c2000

C:\VisSim80\cg>if EXIST "C:\TI\ccsv5\tools\compiler\c2000" set PATH="C:\TI\ccsv5 \tools\compiler\c2000\bin\";C:\Program Files (x86)\STMicroelectronics\st_toolset \asm;C:\Program Files (x86)\PC Connectivity Solution\;C:/Program Files (x86)/Tex as Instruments/xdctools_3_20_08_88;C:\Program Files\Common Files\Microsoft Share d\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live ;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\Win dowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;\cc\bin;C:\Progr am Files (x86)\WinMerge;C:\OrCAD\OrCAD_10.3\tools\fet\bin;C:\OrCAD\OrCAD_10.3\to ols\pcb\bin;C:\OrCAD\OrCAD_10.3\tools\specctra\bin;C:\OrCAD\OrCAD_10.3\tools\bin ;C:\OrCAD\OrCAD_10.3\tools\PSpice\Library;C:\OrCAD\OrCAD_10.3\tools\Capture;C:\O rCAD\OrCAD_10.3\tools\bin;C:\OrCAD\OrCAD_10.3\tools\libutil\bin;C:\OrCAD\OrCAD_1 0.3\tools\fet\bin;C:\OrCAD\OrCAD_10.3\tools\pcb\bin;C:\OrCAD\OrCAD_10.3\tools\sp ecctra\bin;C:\OrCAD\OrCAD_10.3\tools\PSpice;C:\OrCAD\OrCAD_10.3\tools\PSpice\Lib rary;C:\OrCAD\OrCAD_10.3\tools\Capture;C:\OrCAD\OrCAD_10.3\OpenAccess\bin\win32\ opt;c:\RIDE\Bin;C:\Program Files (x86)\Raisonance\Ride\Bin;C:\Program Files (x86 )\Raisonance\Ride\arm-gcc\bin;C:/Program Files (x86)/Texas Instruments/xdctools_ 3_20_08_88;C:\ti\ccsv5\utils\bin;C:\Program Files (x86)\COSMIC\CXSTM8_32K

C:\VisSim80\cg>if EXIST "C:\TI\ccsv5\tools\compiler\c2000" SET C2000_C_DIR=C:\TI \ccsv5\tools\compiler\c2000\lib;C:\TI\ccsv5\tools\compiler\c2000\include

C:\VisSim80\cg>set TGT=F280X

C:\VisSim80\cg>set FILE=LEDBlinkTMS320F28035

C:\VisSim80\cg>set CPU=28

C:\VisSim80\cg>if not "28" == "" set CPU=28

C:\VisSim80\cg>set LCF=""

C:\VisSim80\cg>set SMALL_RAM=sr

C:\VisSim80\cg>if """" == "sfo" set LCF=fo

C:\VisSim80\cg>if """" == "sf" set LCF=f

C:\VisSim80\cg>if """" == "so" set LCF=o

C:\VisSim80\cg>if """" == "s" set LCF=

C:\VisSim80\cg>if "F28035" == "" set MTGT=F280X

C:\VisSim80\cg>if "F28035" == "F28023" set MTGT=F28027

C:\VisSim80\cg>if "F28035" == "F28025" set MTGT=F28027

C:\VisSim80\cg>if "F28035" == "F28022" set MTGT=F28026

C:\VisSim80\cg>if "F28035" == "F28024" set MTGT=F28026

C:\VisSim80\cg>if "F28035" == "F28032" set MTGT=F28027

C:\VisSim80\cg>if "F28035" == "F28033" set MTGT=F28027

C:\VisSim80\cg>if "F28035" == "F28034" set MTGT=F28035

C:\VisSim80\cg>if "F28035" == "F28068" set MTGT=F28069

C:\VisSim80\cg>if "F28035" == "F28067" set MTGT=F28069

C:\VisSim80\cg>if "F28035" == "F28064" set MTGT=F28065

C:\VisSim80\cg>set CFLAG=-pds=112 -pds=377 -pds=179 -pden

C:\VisSim80\cg>if not "" == "" set CFLAG=--float_support=fpu32

C:\VisSim80\cg>if not "sr" == "" set CFLAG=-pds=112 -pds=377 -pds=179 -pden -D_S MALL_RAM

C:\VisSim80\cg>if "2803" == "28M3" ( set CFLAG=-pds=112 -pds=377 -pds=179 -pden -D_SMALL_RAM -D_CONCERTO_ set MTGT=F28M35H )

C:\VisSim80\cg>cl2000 -pds=112 -pds=377 -pds=179 -pden -D_SMALL_RAM -c -g -fs=t mp -k -ml -v28 -O2 -d_DSP -DVERSION_10X=80 -d_F28XX_ -d_F280X_ -fsTMP -i"C:\VisS im70"\vsdk\include -i.\include LEDBlinkTMS320F28035.c "LEDBlinkTMS320F28035.c", line 17: error #20: identifier "Example_2803xLEDBlink" is undefined 1 error detected in the compilation of "LEDBlinkTMS320F28035.c".

Compilation failure

C:\VisSim80\cg>set HEAP=0x400

C:\VisSim80\cg>if not "400" == "" set HEAP=400

C:\VisSim80\cg>set STAK=0x400

C:\VisSim80\cg>if not "400" == "" set STAK=400

C:\VisSim80\cg>if not "" == "" set TGT=F280x_fpu

C:\VisSim80\cg>set TGTREGDEF=

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

C:\VisSim80\cg>lnk2000 -c -x -q -mLEDBlinkTMS320F28035.map LEDBlinkTMS320F28035. obj C:\TI\controlSUITE\device_support\f2803x\v121\DSP2803x_examples_ccsv4\timed_ led_blink\Debug\Example_2803xLEDBlink -l lib\ii_F280Xsr.lib -heap 400 -stack 4 00 -o LEDBlinkTMS320F28035.out lib\F28035""lnk.cmd fatal error: file "C:\TI\controlSUITE\device_support\f2803x\v121\DSP2803x_examples_ccsv4\timed _led_blink\Debug\Example_2803xLEDBlink.obj" specifies ISA revision "C2800", which is not compatible with ISA revision "C28FPU32" specified in a previous file or on the command line

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

The key error above is from

The key error above is from the compile:

"LEDBlinkTMS320F28035.c", line 17: error #20: identifier "Example_2803xLEDBlink" is undefined 1 error detected in the compilation of "LEDBlinkTMS320F28035.c".

We would need to see your .vsm to understand why the generated code is referencing the variable/function "Example_2803xLEDBlink". That seems more like a file name than a function name.

Please copy all the text in

Please copy all the text in the DOS window using this method and add to your post. The error is complaining that you are are mixing fixed point and floating point compiled objects. It is hard to know why without the complete text of the compile process.