Search code examples
signal-processingqualcommhexagonal-architecturehexagon-dsp

Qualcomm DSP: hexagon-sim with command line arguments


I am profiling c code on a hexagon simulator with the following tool:

Qualcomm/Hexagon_SDK/3.5.3/tools/HEXAGON_Tools/8.3.07/Tools/bin/hexagon-sim --timing --profile binary.hexagon

The binary is built with the hexagon-clang:

Qualcomm/Hexagon_SDK/3.5.3/tools/HEXAGON_Tools/8.3.07/Tools/bin/hexagon-clang

I am, however, unable to pass command line arguments to my binary when running hexagon-sim

Does anybody know how to do that?

I tried:

Qualcomm/Hexagon_SDK/3.5.3/tools/HEXAGON_Tools/8.3.07/Tools/bin/hexagon-sim --timing --profile binary.hexagon argument1 argument2
Qualcomm/Hexagon_SDK/3.5.3/tools/HEXAGON_Tools/8.3.07/Tools/bin/hexagon-sim --timing --profile binary.hexagon 'argument1 argument2'
Qualcomm/Hexagon_SDK/3.5.3/tools/HEXAGON_Tools/8.3.07/Tools/bin/hexagon-sim --timing --profile 'binary.hexagon argument1 argument2'

But that all just gives the error:

More than one non-option on command line!
(binary.hexagon)
(argument1)
Cannot determine executable - aborting.

Solution

  • You should use -- for that.

    Like so:

    hexagon-sim --timing --profile binary.hexagon -- argument1 argument2
    

    From "Hexagon Simulator User Guide", Qualcomm doc 80-N2040-17 P:

    Running the simulator ... Command switches are used to control various simulator options. A switch consists of one or two dash characters followed by a switch name and optional parameter. Note that switch names are case-sensitive. Switches must be separated by at least one space. The command switch (--) when delimited by spaces on either side is used to separate the command arguments of the target application from those of the simulator. For example:

    hexagon-sim --rtos q.cfg a.out -- 10 // 10 is target app arg
    hexagon-sim --rtos q.cfg -- a.out 10 // alternate form