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.

CCsV4 DSS loadti.bat script using C64x+ simulator, printf and fprintf fail!



Hi,

I'm trying to do a simple printf using the ccsv4\scripting\examples\loadti\loadti.bat file. I also tried a fprintf, but both fail without an error message...

Here is my command line to build the .out file (basically recopied from the build generated by the IDE, but combined into a single command):

"C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\bin\cl6x.exe" -mv64+ -g --fp_mode=strict --sat_reassoc=off --fp_reassoc=on --mem_model:const=data --mem_model:data=far_aggregates -I"C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\include" test.c -z --reread_libs --rom_model -i="C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" -l"rts64plus.lib" -o=test.out

"C:\Program Files\Texas Instruments\ccsv4\scripting\examples\loadti\loadti.bat" -c "C:\Program Files\Texas Instruments\ccsv4\scripting\examples\C64\tisim_c64xple.ccxml" -l test.out

Here is the content of my test.c file (just a printf):

#include <stdio.h>

 void main(void)
 {
    printf("Hello World\n");
   
    return;
}

Here is the content of my test.c file (with a fprintf):

void main(void)
{
   
    FILE *fileptr = NULL;
   
    fileptr = fopen ("test.txt" ,"w");
   
    fprintf (fileptr, "Hello world!");
   
    fclose (fileptr);

    return;
}

Both fail.

If I run the same code inside the IDE, it works.

Has anyone got the the DSS command line based simulator to work with standard C I/O?

Thanks

Eric

  • How specifically does it 'fail?' I don't ever work with loadti utility so I am not sure where the std output is displayed (presumably in the prompt, but I am not certain).

    One thing you may want to double check is whether or not your project has sufficient heap and stack space when built outside of the IDE - check the Project->Build Options and/or the linker command file.

  • It fails because the stdout is not displayed in the console or in the redirected output (also tried using the options -x log.xml --stdout-file=c:\stdout.txt). It is also not outputted to the textfile used by the fopen/fprint functions.

    Here is the new improved command line using your suggestions (I looked in the IDE settings for stack and heap values without luck, so I ended using some empirical values):

    "C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\bin\cl6x.exe" -mv64+ -g --fp_mode=strict --sat_reassoc=off --fp_reassoc=on --mem_model:const=data --mem_model:data=far_aggregates -I"C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\include" test.c -z--heap=10000 --stack=10000  --reread_libs --rom_model -i="C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\lib" -i"C\/Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\include" -l"rts64plus.lib" -o=test.out

    The command line to start the simulator/debugger (with redirected output):

    "C:\Program Files\Texas Instruments\ccsv4\scripting\examples\loadti\loadti.bat" -c "C:\Program Files\Texas Instruments\ccsv4\scripting\examples\C64\tisim_c64xple.ccxml" -x log.xml --stdout-file=c:\stdout.txt -l test.out

    Here is what is shown in the command line console (no errors, but no C I/O):

    ***** DSS Generic Loader *****

    START: 16:30:04 GMT-0400 (EDT)

    Configuring Debug Server for specified target...
    Done
    TARGET: C64x+ Megamodule Cycle Accurate Simulator, Little Endian
    Connecting to target...
    testEnv.outFiles: test.out
    Loading test.out
    Done

    END: 16:30:08 GMT-0400 (EDT)

    I stumbled upon a settings in the IDE that said for for C I/O to work, you need to set a breakpoint. Can anyone confirm this?

    Thanks

    Eric

  • I'm posting to help others that might run into the same problem:

    I got it working, but it required modifying the javascript that was called by the loadti.bat file.

    It seems that for some reason, by default the script is called in a mode that only loads the program into memory without running. I hard coded the script into running my program, then everything started working.

    Good luck

    Eric