[SOLVED] [ARM] JLink ARM returns exitcode 0 on error - always

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

  • [SOLVED] [ARM] JLink ARM returns exitcode 0 on error - always

    Hi,
    I run JLink arm commandline tool using command file and it always returns exit code 0, even if application ended because of error. What's interesting is that on Ubuntu there is correct exit code.

    My command file:
    exitonerror 1
    speed 4000
    if SWD
    r
    erase
    loadfile /tmp/unexistingFile.hex
    r
    exit
    JLink output:
    $ JLink_Linux_V612_arm/JLinkExe -device nrf52 -CommandFile /tmp/commandFile.jlink
    SEGGER J-Link Commander V6.12 (Compiled Nov 25 2016 18:05:29)
    DLL version V6.12, compiled Nov 25 2016 18:05:16


    Script file read successfully.
    Processing script file...

    J-Link Commander will now exit on Error

    J-Link connection not established yet but required for command.
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Nov 14 2016 16:58:29
    Hardware version: V1.00
    S/N: 682915018
    VTref = 3.300V
    Selecting 4000 kHz as target interface speed

    Selecting SWD as current target interface.

    Target connection not established yet but required for command.
    Device "NRF52" selected.


    Found SWD-DP with ID 0x2BA01477
    Found SWD-DP with ID 0x2BA01477
    AP-IDR: 0x24770011, Type: AHB-AP
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.

    Erasing device ((null))...
    Comparing flash [100%] Done.
    Erasing flash [100%] Done.
    Verifying flash [100%] Done.
    J-Link: Flash download: Total time needed: 0.316s (Prepare: 0.045s, Compare: 0.000s, Erase: 0.263s, Program: 0.000s, Verify: 0.000s, Restore: 0.007s)
    Erasing done.

    Downloading file [/tmp/unexistingFile.hex]...
    Failed to open file.

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.


    Script processing completed.

    HypriotOS: root@black-pearl in /tmp
    $ echo $?
    0

    It's the simpliest reproduction scenario but this bug occurs on any other occasion for example when I unplug programmer during flashing - still exitCode 0.

    It is crucial for production line to know if there has been some errors during flashing.

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

  • Hi,


    please note the following:
    1) Using J-Link OBs for production purposes violates the Licensing agreement:
    Licensing
    J-Link OB is provided as part of an evaluation board. It is not sold separately. It may only be used to debug the device on the evaluation board it came with.
    Support is given via the eval board manufacturer and via SEGGER forum. J-Link OB may not be used for production purposes.
    Link

    2) J-Link Commander should not be used for production purposes.
    The following methods of programming via J-Link Commander or J-Flash Lite are not recommended or supported for production purposes.
    For production programming, production grade programming tools should be used. These typically features a more sophisticated multi-step verification process. Many applications also require customization / patching of variable data such as serial number(s), MAC addresses and similar.

    We recommend J-Flash or Flasher for production grade programming needs.

    Link

    Best regards,
    Niklas
    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.
  • 1) Using J-Link OBs for production purposes violates the Licensing agreement:
    Well I'm affraid we misunderstood a little bit. Yes, I am aware of licensing agreement. but we have just started working with nrf52 and as for now it's just a conceptual phase to make a research what tools to choose and try to develop some firmware. So we have two issues here:
    1. Flashing internally in our office by our developers - I need to make an application for our
    developers that automates a couple of processes before flashing (such as downloading
    firmware from building machine, combining it with some external
    customization data etc.) and in the end perform flashing. JLink Commander + nrf52 DK seems to be
    sufficient for that purpose.

    2. Production line in the future far away from now - On production line I am planning to use some more sophisticated
    programmer obviously, Using dev kit for that purpose would be - to say
    least - reckless and furthermore it violates licensing agreement. I assumed that if JLink Commander works ok with dev kit, then it will work with any other production programmer too, so I decided to give it a try. If you are suggesting more sophisticated software for that (such as Flasher ARM), then thank you for pointing that out. I will surely look closer into that issue when the time comes.

    Anyway, the problem in question is a matter of our r&d phase and internal use only, so I would be grateful to know if the bug I reported may be fixed in not too distant future.
  • Hi,

    thanks for the detailed information.
    1. Flashing internally in our office by our developers - I need to make an application for our
    developers that automates a couple of processes before flashing (such as downloading
    firmware from building machine, combining it with some external
    customization data etc.) and in the end perform flashing. JLink Commander + nrf52 DK seems to be
    sufficient for that purpose.

    I agree that this is a good and valid use case for J-Link Commander.
    J-Link Commander returns the result of the last command. In your case the last command is "reset" which was executed successful, there J-Link Commander returned O.K.
    Since "exit on error" was enabled, J-Link commander should have terminated and returned "ERROR" after the open file failed.
    I just gave it a try and could not reproduce the issue. I also looked at the src and i saw no way how the file open can fail but not return error.
    I will give it another try next week.
    SEGGER J-Link Commander V6.11e (Compiled Nov 24 2016 14:47:37)
    DLL version V6.13a, compiled Dec 2 2016 18:14:57 -- Debug --


    Script file read successfully.
    Processing script file...

    J-Link Commander will now exit on Error

    J-Link connection not established yet but required for command.
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link Lite-XMC4000 Rev.1 compiled Apr 2 2015 18:25:20
    Hardware version: V1.00
    S/N: 551009100
    VTref = 3.300V
    Selecting 4000 kHz as target interface speed

    Selecting SWD as current target interface.

    Target connection not established yet but required for command.
    Device "XMC4500-1024" selected.


    Performing XMC4500 connection sequence.
    AP-IDR: 0x24770011, Type: AHB-AP
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    Performing XMC4500 reset

    Downloading file [C:\Temp\unexistingFile.hex]...
    Failed to open file.

    Script processing completed.




    I assumed that if JLink Commander works ok with dev kit, then it will work with any other production programmer too, so I decided to give it a try.

    We recommend J-Flash or the J-Link SDK (Part No 8.08.06 on the price list). for production purposes. Both can be used with J-Link and Flasher products.

    Best regards,
    Niklas
    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,

    I am sorry, but as mentioned on the website the arm version comes without support and therefore I cannot take the the time to reproduce the issue (especially because I do not have a running Linux ARM setup).
    I have two Questions which may help us to fix the issue without reproducing it.

    1) What is returned if you remove all commands after the flash download?
    2) Is the issue reproduce able with version 6.00 and 5.12j of the J-Link software?
    segger.com/downloads/jlink/JLink_Linux_V600_arm.tgz
    segger.com/downloads/jlink/JLink_Linux_V512j_arm.tgz

    Best regards,
    Niklas
    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.
  • I'm sad to hear that. If it will be of any help, I could help you with debugging, for example by delivering an output from version with extended logs (if you would send me such a version).

    As for your questions:
    1) I need to put "exit" command at the end of command file, otherwise JLink will stay running. Anyway, I tried only with exit command after loadFile and it's still exit code 0.
    2) I checked 6.00 and 5.12j versions and it's the same issue.
  • Hi,

    this will be fixed in the next version of the
    J-Link software & documentation pack
    J-Link software & documentation pack (beta)

    Best regards,
    Niklas
    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.