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.

CCS/TMS320C6678: Debug Server Script: load program with argument doesn't work

Part Number: TMS320C6678


Tool/software: Code Composer Studio

Hi

In my DSS javascript, I load a dsp executable with input argument. The javascript crashes when it run the following line of code. In boot.c, _args_main() is called in c_int00(). Does _args_main supports main(int argc, void *argv[])? In the debugger, I find argv is 0x00000000. Any kind of help is appreciated.

Thanks!

Wai Kwok

debugSession.memory.loadProgram("../../../DevProjects/Output/dsp_app.out", arguments);
  • Hi Wai,
    Did you build your application with the --arg_size linker option? This is needed if you with to pass arguments to main.

    Thanks
    ki
  • Hi Ki

    Thanks for your answer. I just add the lnker option --arg_size=1024, but it still doesn't work. I cannot find the section, .args, in the output map file. The argv in the main() function is still 0x00000000. Do you miss any step in setting the .args section?

    Thanks!

    Wai Kwok

  • What is the exception that gets thrown when it tries to execute the loadProgram API?
  • The logException is " __c_args__ not defined. Use "--args=n" when linking target executable to allocate n bytes for arguments".

    I have already added args in CCS linker option. The symbol, _c_args__, in the map file is "ffffffff   __c_args__".


  • Does your application use BIOS?
  • In my special build, my application doesn't use BIOS.
  • I just try building my app with the use of BIOS. It still doesn't work and the address of the symbol, __c_args__" is still 0xffffffff. Main() is the entry point before BIOS is started.
  • Wai Law1 said:
    I have already added args in CCS linker option. The symbol, _c_args__, in the map file is "ffffffff   __c_args__".

    Which version of CCS and the C6000 compiler are you using?

    I tried with CCS 7.2 and the C6000 compiler v8.1.4, and when --args_size was set in the project properties an .args section was shown in the linker map, and the _c_args__ symbol had a value which was the start address of the .args section.

    [I didn't try and load the program]

  •     CCS  Version: 6.2.0.00050

    Compiler Version: TI v7.4.21

    Link Flag:

    -mv6600 --abi=eabi -O3 -g --define=_DEBUG --define=SOC_C6678 --define=VERSION_FOR_DSP --define=_OS_SUPPORT --define=UNIT_TEST --define=AUTO_GAIN_UNIT_TEST --display_error_number --diag_wrap=off --diag_warning=225 --mem_model:data=far --strip_coff_underscore -z -m"C:/git/PHX-1278-sip-autogain-enhancement/DevProjects/Output/dsp_app.map" -i"C:/ti/c6000_7.4.21/lib" -i"C:/ti/ipc_3_44_01_01/packages" -i"C:/ti/c6000_7.4.21/include" -i"C:/ti/pdk_c667x_2_0_5/packages/ti/csl/lib/c6678/c66/release" -i"C:/ti/dsplib_c66x_3_4_0_0/packages/ti/dsplib/lib" --reread_libs --warn_sections --diag_wrap=off --display_error_number --xml_link_info="Phoenix_linkInfo.xml" --rom_model --arg_size=256 --zero_init=off

  • Wai Law1 said:
    Compiler Version: TI v7.4.21

    I tried repeating the problem with compiler v7.4.21 and CCS 7.2. I can't repeat the problem in that after setting --arg_size to 256 in the project properties:

    1) The option is passed to the linker:

    Invoking: C6000 Linker
    "/home/mr_halfword/ti/ccs720/ccsv7/tools/compiler/c6000_7.4.21/bin/cl6x" -mv6600 --abi=eabi -O3 -g --diag_wrap=off --diag_warning=225 --display_error_number -z --stack_size=1024 -m"TMS320C6678_main_with_arguments.map" --heap_size=1024 -i"/home/mr_halfword/ti/ccs720/ccsv7/tools/compiler/c6000_7.4.21/lib" -i"/home/mr_halfword/ti/ccs720/ccsv7/tools/compiler/c6000_7.4.21/include" --reread_libs --define=CORE0 --warn_sections --display_error_number --diag_wrap=off --xml_link_info="TMS320C6678_main_with_arguments_linkInfo.xml" --rom_model --arg_size=256 --zero_init=off -o "TMS320C6678_main_with_arguments.out" "./hello.obj" "../C6678.cmd"  -llibc.a 
    <Linking>

    2) The linker map shows an .args section:

    .args      0    108070a0    00000100     
                      108070a0    00000100     --HOLE-- [fill = 0]

    And the __c_args__ symbol is set to the start address of the .args section:

    108070a0   __c_args__

    For reference my test project is attached TMS320C6678_main_with_arguments.zip

    Therefore, don't understand why --arg_size is failing to create the .args section in your case.

  • Hi Chester

    After  studying your attached project, I add a section, .args, to L2SRAM in my linker command file. But the length of .args is zero in the map file. Attached are my linker command file and map output file. Any kind of help is appreciated.

    Thanks!

    Wai Kwok

    Custom_M2_6674_p66_x.zipdsp_app.zip

  • Hi Wai,
    Can you provide a reproducible test case (project + source)? I don't need you actual project, just a simple example that has the same issue - the simpler the better.

    Thanks
    ki
  • Hi Ki

    Attached is a simple hello project you can reproduce the problem.

    Thanks!

    Wai Kwokphoenix_hello.zip

  • Thanks. I see that your project is BIOS based, given the dependent RTSC project. This is likely the reason for the discrepancy you are seeing. For more details on this, see my post below:
    e2e.ti.com/.../11447

    The other issue is that the DSS loadProgram API has a limitation where it only supports passing arguments to main for non-BIOS based applications. For BIOS based application, the manual approach described in the link above will need to be used (you can use DSS memory write APIs to manually do this).

    Thanks
    ki
  • Hi Ki-Soo

    Thanks for your answer! What BIOS bool should I use to configure args section? The following link to the presentation in the other post you give to me is not reachable. Can you send me another link to that presentation.

    e2e.ti.com/.../11447

    Thanks!

    Wai Kwok

  • Hi Ki-Soo

    The presentation link in my previous post is not right. It should be

    tiexpressdsp.com/index.php

    Thanks!

    Wai Kwok
  • Hi Ki-Soo

    I find the configuration of argument size in BIOS configuration tool.

    (1) Open the BIOS configuration file (.cfg) with XGCONF editor (right click on the config file in CCS and choose "Open With->XGCONF").
    (2) In the XGCONF editor, Click "System Overview" at the top of the BIOS config file
    (3) In system overview, click "Memory" under memory management
    (4) In memory-module settings, click program module link
    (5) In runtime sizes, set a value for Argument size

    I also find DSS loadProgram API works in passing arguments for BIOS based application. Anyway, thanks a lot for your help.

    Wai Kwok
  • I'm pleasantly surprised that the loadProgram API works for BIOS projects. I didn't think it did.