[SOLVED] J-Link Script

  • [SOLVED] J-Link Script

    Hi,

    Is it possible to create a script wich can read memory value on the target (like mem32 cmd) and perform logic?
    Example:

    w4 0x10007fe8 0x0
    w4 0x10007fec 0x7800
    while( mem32 0x10007fec != 0)
    print( mem32 0x10007fec )

    Because commander script cannot use loop statement and print.

    Thx

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

  • Hi,

    Among J-Link command files, there exist J-Link script files. (Also described in UM8001).
    In J-Link script files, you have access to a C-like Syntax, but they are mostly limited to substitute J-Link functions for a specific device (for example in order to provide and use a special Reset or Connect function for a specific device.)

    A "full" solution is the J-Link SDK: J-Link SDK (Part No 8.08.06 on the price list).

    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.
  • Thx,
    But the J-Link script files seems to not work for me... I use a sample from your package and i see no text in the terminal (even with Report("Hello") in the script in the InitTarget function ).
    How is it possible? The script is recognised because i dont have the ""missing file" error.

    J-Link version 5.12

    My cmd: jlink -device LPC1857 -if SWD -speed 1000 -JLinkScriptFile Default.JLinkScript

    Script:
    /*********************************************************************
    *
    * InitTarget
    */
    void InitTarget(void) {
    CPU = LPC1857;
    MAIN_ActiveTIF = JLINK_TIF_SWD;


    Report("Test");
    SYS_Sleep(100000);
    MessageBox("Here is a message");

    JTAG_ResetPin = 0;
    SYS_Sleep(500); // Give pin some time to get low
    JTAG_ResetPin = 1;

    JTAG_TRSTPin = 0;
    SYS_Sleep(500); // Give pin some time to get low
    JTAG_TRSTPin = 1;
    }
  • Hi,


    sorry, but I will not have the time to look into this until Monday.
    In the mean time:
    Could you post the commander output?
    Do other functions work (SetupTarget(), InitEMU())?

    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.
  • Here is what I get when I launch J-Link:
    [img]http://img15.hostingpics.net/pics/654250jlinkproblem.png[/img]

    With the two function you mentionned it is the same output.
    /*********************************************************************
    *
    * SetupTarget
    */
    void SetupTarget(void) {
    Report("SetupTarget code");
    }

    /*********************************************************************
    *
    * InitEMU
    */
    void InitEMU(void) {
    Report("InitEMU code");
    }
    Regards,
    ginux

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

  • Hi,

    I just gave it a try and this simple TestFile works perfectly fine:

    C Source Code

    1. /*********************************************************************
    2. *
    3. * InitTarget
    4. */
    5. void InitTarget(void) {
    6. Report("Test");
    7. MessageBox("Here is a message");
    8. }

    Named Test.JLinkScript
    Called by
    "INSTPATH\JLink.exe" -device ATSAMD20J18 -if SWD -speed 4000 -autoconnect 1 -jlinkscriptfile SCRIPTPATH\Test.JLinkScript

    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 just gave it a try and found out that for LPC1857 requires a lot of special handling and there altering using J-Link script files is not possible.
    (They are omitted by the DLL if LPC1857 is the selected device.)

    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.