我想将配置文本作为 argv[1] 传递给 main() 函数,并且已经尝试过命令行。set semihosting args "config txt" ,but it seems like the config txt is argv[0] not argv[1],so how to pass multi arguments to main()?
set semihosting args "config txt" ,but it seems like the config txt is argv[0] not argv[1],so how to pass multi arguments to main()?
Thanks, I tried to use the way you said,and adds a .ds script in Debug Cofigurations as the target initialization scripts, and set debug from symbol main, The content of of the .ds script is:
set semihosting enabled on
set semihosting args 1 2 3
and then connected in Arm development Studio, it doesn't work successfully, print argc equals 0.
But when I add -C semihosting-cmd_line="1 2 3" in model parameters Tab, it works successfully, the only question is that 1 passed to argv[0] not argv[1], and 2 passed to argv[1]. Is there something wrong?
Hi again,The method I gave above works when used with real hardware via DSTREAM, where the Debugger handles the semihosting.If you are using an FVP model, then the method is slightly different, because the FVP model handles the semihosting automatically itself by default. By default, the FVP model traps semihosting calls very early, and the Debugger never sees them. This behaviour can be overridden (see 2) below)If you are using an FVP model, you can either:1) launch the FVP model with -C semihosting-cmd_line="1 2 3" in the Model Parameters field (no .ds script needed)This works, but as you have seen, the args are handled differently - argv[0] is no longer the name of the image, but is now the first parameter ("1" in our test case)or2) launch the FVP model with e.g. "-C cluster.cpu0.semihosting-enable=0" in the Model Parameters field, _and_ have "set semihosting args 1 2 3" in the .ds script.The "semihosting-enable=0" switch tells the model to _not_ handle semihosting. So the semihosting will be passed to the Debugger to handle. The Debugger will then handle the semihosting, in the same way as for hardware. The exact form of the "semihosting-enable" switch will vary depending on the FVP model you are using.Hope this explains thingsStephen