inconsistent JLinkExe exit status

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

  • inconsistent JLinkExe exit status

    Hi,

    I'm developing on Ubunto 12.04. I'm using the command-line JLinkExe tool for programming only in a very simple Makefile environment.

    My problem is that JLinkExe is returning a nonzero exit status in scripting mode, even when it completes the script successfully. The same is not true of commands that are entered interactively to the JLinkExe shell.

    I have attached a shell script which demonstrated the inconsistency.

    The output of the script is:

    Source Code

    1. markrages@thinqpad:/opt/JLink_Linux_V462a$ sh bugreport.sh
    2. SEGGER J-Link Commander V4.62a ('?' for help)
    3. Compiled Feb 6 2013 11:42:45
    4. DLL version V4.62a, compiled Feb 6 2013 11:42:42
    5. Firmware: J-Link V9 compiled Jan 11 2013 12:33:03
    6. Hardware: V9.00
    7. S/N: 59100372
    8. Feature(s): GDB
    9. VTarget = 0.000V
    10. J-Link>
    11. Interactive result: 0
    12. SEGGER J-Link Commander V4.62a ('?' for help)
    13. Compiled Feb 6 2013 11:42:45
    14. Script file read successfully.
    15. DLL version V4.62a, compiled Feb 6 2013 11:42:42
    16. Firmware: J-Link V9 compiled Jan 11 2013 12:33:03
    17. Hardware: V9.00
    18. S/N: 59100372
    19. Feature(s): GDB
    20. VTarget = 0.000V
    21. Processing script file...
    22. Script processing completed.
    23. Script result: 1
    Display All


    There are lots of standards about exit status: en.wikipedia.org/wiki/Exit_status has a good discussion. But the one consistent thing is that exit status is zero for no errors, and nonzero for errors.

    In my view the reasonable thing for running a script is to exit zero when all the commands completed successfully, and nonzero when one of more commands fail. Would it be possible to implement this?

    Regards,
    Mark
    Files
  • After much staring at ltrace output, I believe I solved my problem.

    Here is a Python script that programs an .elf file using the JLink dll / so. The JinkExe application is not needed.

    jlink-python.zip

    All calls into the DLL are wrapped with error checks, and a Python exception is raised if something goes wrong.

    Intel hex and .elf file reading routines are borrowed from the mspgcc project. I guess that makes this LGPL-licensed.

    I tested it on Ubuntu (with "libjlinkarm.so.4.62.1" symlinked as "libjlinkarm.so.4") and Windows (with "JLinkARM.dll").

    I hope this is helpful for someone.