[SOLVED] In case TMS570LC4357 target ignores my InitTarget jlinkscript function

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

  • [SOLVED] In case TMS570LC4357 target ignores my InitTarget jlinkscript function

    Hello,

    we have two TMS570LC4357 chips in JTAG chain. There is only one chance to set up it for jLink and it is jlinkscript. Problem is that latest version which works for us are V512f. Little bit old. After this version we has problem to port our jlinkscript due to changes on API (removed __int64 etc).
    Because this version is almost history we want to rewrite jlinkscript for latest version.
    But there is problem. jLink ignoring our InitTarget function and start some default function.
    When we omit "-device" parameter on command line, our function strat correctly (after "cancel" on device selection dialog), but it can't connect to unspecified device of course.

    Command to start GDB for ex:

    Source Code

    1. "c:\Program Files (x86)\SEGGER\JLink_V686a\JLinkGDBServerCL.exe" -select USB -endian big -if JTAG -device TMS570LC4357ZWT -speed 1000 -nohalt -singlerun -nosilent -log log.txt -scriptfile cr5_test_chB.JLinkScript

    Our InitTarget function works when we ommit "-device TMS570LC4357ZWT" parameter.

    Source Code

    1. before Icepick setting
    2. T4F30 006:299.295 JTAG chain detection found 2 devices:
    3. T4F30 006:299.297 #0 Id: 0x1B95A02F, IRLen: 06, TI ICEPick
    4. T4F30 006:299.298 #1 Id: 0x1B95A02F, IRLen: 06, TI ICEPick
    5. After
    6. T4F30 006:343.028 TotalIRLen = 12, IRPrint = 0x0041
    7. T4F30 006:344.298 JTAG chain detection found 2 devices:
    8. T4F30 006:344.300 #0 Id: 0x1BA00477, IRLen: 04, CoreSight JTAG-DP
    9. T4F30 006:344.301 #1 Id: 0x0B7B302F, IRLen: 06, TI ICEPick
    10. TotalIRLen is invalid, correct value is 4+6+6 = 16. We are set it properly, but jLink ingnores provided value.
    Display All
    With "-device TMS570LC4357ZWT" jLink ignore our InitTarget function with weird message "J-Link Script File: Executing InitTarget()"


    Source Code

    1. T3644 000:255.031 JLINK_Connect()
    2. T3644 000:263.965 ConfigTargetSettings() start
    3. T3644 000:263.968 J-Link Script File: Executing ConfigTargetSettings()
    4. T3644 000:264.599 Looking for J-Link GUI Server exe at: c:\Program Files (x86)\SEGGER\JLink_V686a\JLinkGUIServer.exe
    5. T3644 000:264.748 Forking J-Link GUI Server: c:\Program Files (x86)\SEGGER\JLink_V686a\JLinkGUIServer.exe
    6. T3644 000:317.869 J-Link GUI Server info: "J-Link GUI server V6.86a "
    7. T3644 001:799.886 ConfigTargetSettings
    8. T3644 001:799.889 ConfigTargetSettings() end
    9. T3644 001:799.892 InitTarget() start
    10. T3644 001:799.892 J-Link Script File: Executing InitTarget()
    11. T3644 001:799.893 Executing InitTarget()
    12. T3644 001:801.289 TotalIRLen = 12, IRPrint = 0x0041
    13. T3644 001:802.239 Can not find ICE-Pick (IRLen mismatch). Expected 0x00000006, found: 0x0000000C
    14. T3644 001:802.241 J-Link script: ICEPick found, enabling Cortex-M3 core.
    15. T3644 001:803.985 TotalIRLen = 12, IRPrint = 0x0041
    16. T3644 001:804.764 JTAG chain detection found 2 devices:
    17. T3644 001:804.766 #0 Id: 0x1B95A02F, IRLen: 06, TI ICEPick
    18. T3644 001:804.767 #1 Id: 0x1B95A02F, IRLen: 06, TI ICEPick
    19. T3644 001:810.116 Can not find DAP (IDCODE mismatch)
    20. T3644 001:810.119 InitTarget() end
    21. T3644 001:874.272 ConfigTargetSettings() start
    22. T3644 001:874.276 J-Link Script File: Executing ConfigTargetSettings()
    Display All
    PS: how to see or export "JLINK_SYS_Report" messages? We found only "log" page on embedded web server, but it is not available when jLink is terminated due to "ERROR: Could not connect to target.". We found trick to keep it alive with JLINK_SYS_MessageBox("wait"), but it is ugly hack.
  • Hi,
    Thank you for your inquiry.

    In case a script file is passed by the user containing an InitTarget() function, this should override the internal InitTarget() function.
    This seems not to be the case with your setup (our internal InitTarget() function seems to be called).

    Could you send me your script file via PM so I can have a look at it?
    Could please also send me a J-Link Log file? How to enable:
    wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File

    Regarding the JLINK_SYS_Report:
    The messages can also be found in the J-Link Log file (see above).

    Best regards,
    Fabian
    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.
  • Sorry I must reject your answer on both points.
    1) InitTarget is started (see to log bellow), but not from my script! I don't see MessageBox or JLINK_SYS_Report on log output. When I ommit "-device" on command line it works.
    2) JLINK_SYS_Report messages is not saved to file. It is just visible on embedded web server log page. But it is lost when jlink is stopped after failure. This mean that is impossible to use it for debug.
    Can you help me? I can contact support too (I have JLink under support).

    Jiri


    I try to make simplest possible setup:
    Here is test-only cr5.JLinkScript

    C Source Code

    1. int InitTarget(void) {
    2. JLINK_SYS_MessageBox("Start TMS570 (Cortex-R4 core) J-Link script");
    3. JLINK_SYS_Report("Start TMS570 (Cortex-R4 core) J-Link script");
    4. return 0;
    5. }
    6. int ConfigTargetSettings(void) {
    7. JLINK_SYS_MessageBox("ConfigTargetSettings");
    8. JLINK_SYS_Report("ConfigTargetSettings");
    9. return 0;
    10. }
    11. int SetupTarget(void) {
    12. JLINK_SYS_MessageBox("SetupTarget");
    13. JLINK_SYS_Report("SetupTarget");
    14. return 0;
    15. }
    Display All

    Start it like this:

    Source Code

    1. "c:\Program Files (x86)\SEGGER\JLink_V686a\JLinkGDBServerCL.exe" -select USB -endian big -if JTAG -device TMS570LC4357ZWT -speed 1000 -nohalt -singlerun -nosilent -log log.txt -scriptfile cr5.JLinkScript
    Result is that I can see only one dialog. Only from JLINK_SYS_Report("ConfigTargetSettings"); InitTarget is not used.

    Here is result form terminal and same in log.txt file

    Source Code

    1. SEGGER J-Link GDB Server V6.86a LogFile
    2. Logging started @ 2020-10-20 13:44
    3. 03-00000000-00-00000000-0099: Command line: -select USB -endian big -if JTAG -device TMS570LC4357ZWT -speed 1000 -nohalt -singlerun -nosilent -log log.txt -scriptfile cr5.JLinkScript
    4. 03-00000000-00-00000021-01B3: -----GDB Server start settings-----
    5. GDBInit file: none
    6. GDB Server Listening port: 2331
    7. SWO raw output listening port: 2332
    8. Terminal I/O port: 2333
    9. Accept remote connection: localhost only
    10. Generate logfile: on
    11. Verify download: off
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: on
    15. Target connection timeout: 0 ms
    16. 03-00000000-00-00000089-015B: ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: cr5.JLinkScript
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: TMS570LC4357ZWT
    22. Target interface: JTAG
    23. Target interface speed: 1000kHz
    24. Target endian: big
    25. 03-00000000-00-00000132-0001:
    26. 03-00000000-00-00000133-0018: Connecting to J-Link...
    27. 03-00000000-00-00000147-0015: J-Link is connected.
    28. 03-00000000-00-00000225-0036: Firmware: J-Link Pro V4 compiled Sep 21 2020 16:58:30
    29. 03-00000000-00-00000231-0010: Hardware: V4.00
    30. 03-00000000-00-00000233-000F: S/N: xxxxxxxxx
    31. 03-00000000-00-00000235-002F: Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    32. 03-00000000-00-00000240-001B: Checking target voltage...
    33. 03-00000000-00-00000242-0017: Target voltage: 3.32 V
    34. 03-00000000-00-00000246-001E: Listening on TCP/IP port 2331
    35. 03-00000000-00-00000250-0018: Connecting to target...
    36. 03-00000000-00-00031330-002F:
    37. J-Link found 2 JTAG devices, Total IRLen = 10
    38. 03-00000000-00-00031336-0020: JTAG ID: 0x4BA00477 (Cortex-R4)
    39. 03-00000000-00-00031345-0014: Connected to target
    40. 03-00000000-00-00031347-001D: Waiting for GDB connection...
    Display All
    And log from embedded webserver localhost:19080/log.htm
    Is here pastebin.com/7dE0y0jZ
  • Hi,
    We saw that you also contacted us via support system about this.
    I answered you there.

    To keep communication to one channel, I will close this thread now.

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