[SOLVED] Project.ConfigSemihosting with TargetCmdLine option usage example

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Project.ConfigSemihosting with TargetCmdLine option usage example

    Hi all,
    I have a problem with calling Project.ConfigSemihosting for TargetCmdLine setting (in Ozone v3.24b).
    I tried using it in this way: Project.ConfigSemihosting ("TargetCmdLine=-v"); , but .jdebug script execution prints the following error: "Invalid semihosting setting value: -v".
    Function allows number usage only e.g. Project.ConfigSemihosting ("TargetCmdLine=1"); works ok.
    Is possible to pass a string as an argument e.g. "-v"? Eventually I will pass "firmware -v" options, will this be possible?
    Is any alternative for passing argv to the target application?
    Best regards,
    Aleksander

    The post was edited 1 time, last by Aleksander04 ().

  • Hello Alexsander,

    Thank you for your inquriy.
    The error message is reproducible for us. But it is simply a wrong error message. Strings are of course also supported but Ozone console incorrectly prints "invalid setting value".
    In your source code you should still see the string being passed to your target application.

    Can you confirm?
    The error message will of course be fixed so it does not appear if strings are used.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,
    I cannot clearly confirm that the argc and argv are set on target - they are '0' in Local Data view, but this can be a problem with used c stdlib implementation. Most probably r0 and r1 are just set to 0 before calling main which is an expected behavior. I don't see any additional logs in Console view at startup when Project.ConfigSemihosting is added - logs are the same as without it. Perhaps the difference occurs when SysGetCmdLine is sent by target - it is not done on my side, but most probably this is not an Ozone issue.
    Thanks for response!
    BR
    Aleksander
  • Hi Aleksander,

    For reference here is what I used for testing:
    wiki.segger.com/SEGGER_Semihosting
    This is our own implementation of all necessary Semihosting functions for easy use in applications. Feel free to use it in your project as well.

    Attached you can find a sample project that grabs the command line from Ozone via semihosting. It is not exactly what you are trying to do as you want to pass the arguments to Ozone, but it shows that it is generally working as you can see in the screenshot where the passed argument was "TestString" which after the semihosting call is available in the target application.
    The example project is for a STM32F407VE, but the SEGGER_SEMIHOST files and the main.c are generic so you can use them in your own setup for testing as well.

    I hope that helps.

    Best regards,
    Nino
    Images
    • Capture.PNG

      11.96 kB, 677×218, viewed 232 times
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.