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.

[参考译文] AUDIO-AM275-EVM:无法通过 AM275x 上 C7x 应用的 loadti 传递有效的 argv[]内容

Guru**** 2406310 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1535410/audio-am275-evm-unable-to-pass-valid-argv-content-via-loadti-for-c7x-application-on-am275x

部件号:AUDIO-AM275-EVM

工具/软件:

尊敬的 TI 团队:

我在 AM275x 平台上工作,并尝试main()使用传递命令行参数loadti。 我在以下位置引用了脚本:
`C:\ti\ccs2011\ccs\ccs_base\scripting\examples\loadti\loadti.bat` 支持传递多达 40 个参数。

为了进行测试、我hello_world使用以下代码修改了示例:

int main(int argc, char *argv[]) {
    printf("Argument count: %d\n", argc);
    for (int i = 0; i < argc; ++i) {
        printf("argv[%d]: %s\n", i, argv[i]);
    } ...
}

然后、我运行以下命令来加载并执行程序:

C:\ti\ccs2011\ccs\ccs_base\scripting\examples\loadti\loadti.bat -q -c "C:/ti_config/AM275X_XDS110.ccxml" "C:\ti\AM275-AWE-SDK_11.00.00.17\mcu_plus_sdk\am275x\examples\hello_world\am275x-evm\c75ss0-0_freertos\build\hello_world_c7X.out" "-h" "-S" "-M"

观察到的输出:

testEnv.outFiles: C:\ti\AM275-AWE-SDK_11.00.00.17\mcu_plus_sdk\am275x\examples\hello_world\am275x-evm\c75ss0-0_freertos\build\hello_world_c7X.out
Argument count: 4
argv[0]:
argv[1]:
argv[2]:
argv[3]:

因此、虽然argc反映了正确的参数数量 (4)、但中的所有条目argv[]都是空字符串。

请确认:

  • 这是预期行为吗?

  • 如果没有、是否有特定的方法来确保argv[]在使用时正确地将参数值传递到loadti

  • 或者、是否有另一种受支持的方法来模拟通过 JTAG 将运行时参数传递到 C7x 应用?

请提供任何指导或实例。

谢谢、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    [报价 userid=“653023" url="“ url="~“~/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1535410/audio-am275-evm-unable-to-pass-valid-argv-content-via-loadti-for-c7x-application-on-am275x

    为了进行测试、我hello_world使用以下代码修改了示例:

    int main(int argc, char *argv[]) {
        printf("Argument count: %d\n", argc);
        for (int i = 0; i < argc; ++i) {
            printf("argv[%d]: %s\n", i, argv[i]);
        } ...
    }

    然后、我运行以下命令来加载并执行程序:

    [/报价]

    您是否也启用链接器选项来分配.args 段以在应用程序中支持此功能?

    第 3.6 节、共: https://www.ti.com/lit/ug/spruig8k/spruig8k.pdf

    谢谢

    Ki

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Ki:

    我发现问题、传递到 main 的 argv[]错误、而 __c_args__ MEMORY 完好无损。

    示例代码:
    ```μ s

    #include
    #include

    int main_wrap (int argc、char *argv[])

      printf(“in main_wrap ()\n“);
      printf(“Address of argc:%p、value:%d\n“、(void *)&argc、argc);
      printf(“Address of argv:%p、value:%p\n“、(void *)&argv、(void *) argv);
       

      for (int i = 0;i < argc;++I){
        printf(“argv[%d]@%p =\“%s\"\n",“,i“i,、,(、(void *) argv[i]、argv[i]);
      }

      返回 0;
    }

    extern void *__c_args__;

    void main (int _argc、char *_argv[]){

      printf(“in main ()\n“);
      printf(“Address of argc:%p、value:%d\n“、(void *)&_argc、_argc);
      printf(“Address of argv:%p、value:%p\n“、(void *)&_argv、(void *)_argv);
      Printf(“-------------------------------------------- “);

      uint8_t * base =(uint8_t *)&__c_args__;
      uint32_t argc =*(uint32_t *) base;
      char **argv =(char **)(base + 4);
      MAIN_WRAP (argc、argv);
    }

    ```μ s
    与之前相同测试的结果:
    ```μ s
    在 main() 中
    argc 地址:7e007fe8、值:4
    argv 地址: 7e007fe0、值:7e00b664
    -------------------------------------------- 在 main_wrap() 中
    argc 的地址:7e007fb0、值:4
    argv 地址: 7e007fa8、值:7e00b660

    argv[0]@ 7e00b688 =“hello_world_c7X.out"</s>“
    argv[1]@ 7e00b69c =“-h"</s>“
    argv[2]@ 7e00b69f =“-S"</s>“
    argv[3]@ 7e00b6a2 =“-M"</s>“
    ```μ s