[ANSWERED] How can I run a J-Link Commander through a .bat file?

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

  • [ANSWERED] How can I run a J-Link Commander through a .bat file?

    So, I have my .bin file and I can run it using J-Link Commander as follows.



    SEGGER J-Link Commander V5.12g (Compiled May 27 2016 16:58:24)
    DLL version V5.12g, compiled May 27 2016 16:57:47

    Connecting to J-Link via USB...O.K.
    Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
    Hardware version: V8.00
    S/N: 158006524
    OEM: IAR
    VTref = 3.332V


    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Please specify device / core. <Default>: ARM7
    Type '?' for selection dialog
    Device>cortex M3
    Please specify target interface:
    J) JTAG (Default)
    S) SWD
    F) FINE
    I) ICSP
    C) C2
    TIF>
    Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
    JTAGConf>
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "CORTEX-M3" selected.


    TotalIRLen = 9, IRPrint = 0x0011
    Found Cortex-M3 r1p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 001BB000 SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 001BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 000BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 001BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 001BB923 TPIU-Lite
    ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 101BB924 ETM-M3
    Found 2 JTAG devices, Total IRLen = 9:
    #0 Id: 0x3BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    #1 Id: 0x06418041, IRLen: 05, IRPrint: 0x1, STM32 Boundary Scan
    Cortex-M3 identified.
    J-Link>laodbin "C:/arm/run.bin",address

    Now, the question is as follows.

    How Can I use a batch file and make this 100% automatic? In other words, without any pressing "connect", choosing any options!

    I searched and found * | JLink.exe but "pipe" technique did not work.

    So, is there any other options left? Or I have to get the source file for J-Link in order to apply the changes?

    Not to mention that bat file should have the right format as follows.

    CLS
    JLINK.exe
    Pause


    But the question is how to make it automatic!


    Thank you!
  • How Can I use a batch file and make this 100% automatic? In other words, without any pressing "connect", choosing any options!
    You can skip the "connect" input by passing "-AutoConnect 1" via command line option.

    Example:
    JLink.exe -device Cortex-M3 -if JTAG -jtagconf -1,-1 -speed 4000 -autoconnect 1 -CommanderScript C:\Work\JLinkCommandFile.jlink

    Content of JLinkCommandFile.jlink:
    r
    loadbin C:\Work\Test.bin,0x20000000

    Further information regarding this can be found here: wiki.segger.com/J-Link_Commander#Batch_processing


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