[SOLVED] GDB with custom target initialisation

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

  • [SOLVED] GDB with custom target initialisation

    Dear all,

    I am currently working with an old ARM7TDMI board with external Flash and SRAM. I want to use my j-link probe to debug it with eclipse and GDB.
    I have been able to use JLink commander with a custom init script file to program flash succesfully

    I now want to configure eclipse and Jlink GDB server to do the same directly from Eclipse. I don't understand how I can configure Jlink GDB to run the same init script.
    I tried to pass the script in parameters with -jlinkscriptfile my_script.jlink but get error so it seems wrong script format. Is there any way to specify a Jlink commander script to jlink GDB server ?

    Also I don't understand how I configure debug profile to program the external flash and debug from it ?

    Many thank in advance
  • Hello,

    Thank you for your inquiry.
    J-Link Commander script and JLinkScript are different formats.
    Eclipse will not accept a J-Link Commander script.
    How to use a JLinkScript in Eclipse is explained here: wiki.segger.com/Using_J-Link_Script_Files
    JLinkScript format is explained in J-Link user manual UM08001 and can be found in your J-Link software installation folder under Doc/Manuals.

    pge wrote:

    Also I don't understand how I configure debug profile to program the external flash and debug from it ?
    This is a Eclipse specific question which is not maintained by us.
    For Eclipse setup specific questions we recommend contacting the Eclipse developers.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hello Nino,

    Many thanks for your help. I have written a script for j-link as recommended and I am now able to start jlink GDB server and debug my application from eclipse. Thanks !

    About my second question let me reformulate it. I am able to write flash from JLink commander using CFI flash detect and loadfile. I now want to do the same throught gdb and jlink GDB server. When I compile my test firmware to run from RAM gdb is able to load it in RAM. If I compile it for Flash gdb is not able load it in Flash. Any idea how to do this ?

    Many thanks in advance

    PGE
  • Hello,

    Great to hear that you are up and running again with the debug setup.

    pge wrote:

    I cannot launch the firmware but that's probaly another story...
    Most likely some target device specific boot settings are missing.
    For this information we suggest contacting the silicon vendor.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/
  • Hello Nino,

    It perfectly work when loading and debugging from RAM but not from Flash.

    The flash start at 0x01000000 while the RAM start at 0x02000000

    Load seems to be ok as I see multiple Verified OK but then I see ERROR: Failed to prepare for programming.

    Source Code

    1. Waiting for GDB connection...Connected to 127.0.0.1
    2. Reading all registers
    3. Read 4 bytes @ address 0x00000000 (Data = 0xE7FEE700)
    4. Read 4 bytes @ address 0x00000000 (Data = 0xE7FEE700)
    5. Downloading 68 bytes @ address 0x01000000 - Verified OK
    6. Downloading 4824 bytes @ address 0x01000048 - Verified OK
    7. Downloading 28 bytes @ address 0x01001320 - Verified OK
    8. Downloading 2128 bytes @ address 0x0100133C - Verified OK
    9. ERROR: Failed to prepare for programming.
    10. RAM check failed @ addr 0x00002000.
    11. RAM check failed while testing 0xFFFFFC20 bytes @ addr 0x000003E0.
    12. Writing register (PC = 0x 1001108)
    Display All

    Any idea why ?
  • I can't figure out why:
    • jlink try to do a "prepare for programming" after having downloaded image into flash ?
    • there is a RAM check at addr 0x00002000 which is not in RAM area (internal RAM is from 0x00000000 to 0x00001FFF
    Any hint is happily welcome

    Many thanks in advance

    PGE
  • Ok I think I catch it.

    I had a small typing error in my script on the command JLINK_ExecCommand("setworkram 0x00000000 - 0x00001FFF");

    What made it really difficult to find it is there is absolutely no error on it even in log file.... Any way to enable a verbose mode to help to catch this kind of error more quickly ?
  • New

    Hello,

    Thank you for sharing your findings.
    As the reported behaviour seems to be solved now this thread will be closed now.

    pge wrote:

    What made it really difficult to find it is there is absolutely no error on it even in log file.... Any way to enable a verbose mode to help to catch this kind of error more quickly ?
    Error handling of external devices is rather difficult especially as the CFI interface does not offer any error handling whatsoever so J-Link has no chance to know what might have been wrong.
    The Exec command will try to execute any memory area as a sanity check of the address at this point is not possible due to the sheer amount of different target devices we support.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support ticketing system can be used as well: segger.com/ticket/