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.

Command Line Loader (loadti) and passing argv (printf problem)



Hello,

      I am attempting to automate our build and flash procedures using the loadti script.  I do not seem to be able to access the argv data from my program.  I have created a simple program as a test, that only uses printf to print the arguments received.  I can print the argc value, which is correct, but the program seems to hang when I try to print or access the first argv value (argv(0)).  At this point, I have to "control c" out of the script.

      In the project, I set the "Set C argc/argv memory size" to 512.  Are there any other configuration options I need to initialize? I have included my test program and the output from running loadti. 

Using Code Composer Studio 5.1.1.00031

Target is 5502 (TMS320C5502)

Debugger is Spectrum Digital XDS510 USB

Simple test code below:

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>

void main(int argc, char *argv[])
{
	   printf("\nHELLO, We will be burning these files:\n");
	   printf("\nargc value is: %i\n", argc);
	   printf("\nargv[0] is: %s \n", argv[0]);
	   printf("\nargv[1] is: %s \n", argv[1]);
	   printf("\nargv[2] is: %s \n", argv[2]);
	   printf("\nargv[3] is: %s \n", argv[3]);
	   printf("\nargv[4] is: %s \n", argv[4]);
}

Batch file to run loadti below:

CALL loadti -v,-c C:\SPD_TI_Workspace\Test_ARGV\TMS320C5502.ccxml -x ^
C:\SPD_TI_Workspace\Test_ARGV\mylog.xml ^
C:\SPD_TI_Workspace\Test_ARGV\Debug\Test_ARGV.out ^
 C:\YL_2_2_Binaries\Flash\MP_Link_DSP_SSBoot.bin ^
 C:\YL_2_2_Binaries\Flash\MP_Link_DSP_Dataload.bin ^
 C:\YL_2_2_Binaries\Flash\MP_Link_DSP_Dataload.bin ^
 C:\YL_2_2_Binaries\Flash\MP_Link_DSP_App.bin

DOS Command Session output:

C:\SPD_TI_Workspace\Test_ARGV>argv

C:\SPD_TI_Workspace\Test_ARGV>CALL loadti -c C:\SPD_TI_Workspace\Test_ARGV\TMS32
0C5502.ccxml -x C:\SPD_TI_Workspace\Test_ARGV\mylog.xml C:\SPD_TI_Workspace\Test
_ARGV\Debug\Test_ARGV.out C:\YL_2_2_Binaries\Flash\MP_Link_DSP_SSBoot.bin C:\Y
L_2_2_Binaries\Flash\MP_Link_DSP_Dataload.bin C:\YL_2_2_Binaries\Flash\MP_Link_
DSP_Dataload.bin C:\YL_2_2_Binaries\Flash\MP_Link_DSP_App.bin

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

START: 09:35:04 GMT-0400 (EDT)

Configuring Debug Server for specified target...
Done
WARNING: Unlicensed
An error occurred attempting to acquire a license for this product.
TARGET: Spectrum Digital XDS510USB Emulator
Connecting to target...
C55xx: GEL Output: C5502_Init Complete.

testEnv.outFiles: C:\SPD_TI_Workspace\Test_ARGV\Debug\Test_ARGV.out
Loading C:\SPD_TI_Workspace\Test_ARGV\Debug\Test_ARGV.out
Done
Target running...
Interrupt to abort . . .

HELLO, We will be burning these files:

argc value is: 5

Terminate batch job (Y/N)? y

C:\SPD_TI_Workspace\Test_ARGV>

I don't know why we get the "license error".  Our license server is up and running.

Additional debugging shows the arguments are getting stored in memory, so the loadti script is working okay.  The problem seems to be a "printf" weirdness.  I have allocated  a large heap size and that does not help.  I can put in additional printf statements that work just fine, however trying to "prinft argv" does not work. 

Thanks for you time!

Stephen

  • Hi Stephen,
    There seems to be some issues with the DSS API that loads the argc, argv data to memory. It seems specific to C55 as I can reproduce this with a C5509 but not on my C6x targets. I was able to reproduce this with CCSv6.1.1 so it is not specific to your older CCS version. I'm investigating further and will keep you posted on my progress.

    Note that you are indeed using an old version of CCS. I'd recommend updating your version to 6.1.1. Not only because it is a newer version, but also because any fix to address this issue will be made in the next CCSv6 update. There will not be any more CCSv5 updates.

    Thanks
    ki
  • Hi Ki,

    Thanks for your quick response. Unfortunately, our current project is "locked into" Code Composer Studio 5.1.1.00031. Since the ARGV arguments seem to be written consistently into the same area of memory, I will experiment with trying to copy the arguments to another location and then attempt to print them. The ultimate goal is to pass in the path and name of files that are to be written into flash. We are using a second stage boot loader to determine which one of the two applications in flash to load and run. The fix to this problem is not critical to our project, but would really help in automating our build procedure.

    Stephen
  • One option is to the DSS memory write APIs to write the desired strings to the proper location (argv[0]. argv[1]....). This is actually what the DSS API for program load is supposed to do under the hood. But if it is not working correctly, you can just have your script do it (or modify loadti)

    Thanks
    ki