[SOLVED] JLinkGDBServer failed to download code to flash with JLink EDU mini.

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

  • [SOLVED] JLinkGDBServer failed to download code to flash with JLink EDU mini.

    Hi,

    I bought and use JLink EDU mini to debug my code on STM32. I run JLinkGDBServerExe and use arm-none-eabi-gdb to debug my code. When i load the binary code to the target chip, the JLinkGDBServer showed me:

    ....
    Downloading 4168 bytes @ address 0x081D4410
    Downloading 304 bytes @ address 0x081D5458
    Downloading 8 bytes @ address 0x081D5588
    Downloading 4777 bytes @ address 0x081D5590
    ERROR: Failed to prepare for programming.
    Could not preserve target memory.
    Writing register (PC = 0x 8008000)

    And the message in JLinkGDBServer.log file is as follows:

    .....

    02-00000000-00-01289988-003B: T7EF0B700 1289:992.990 JLINK_WriteReg(R15 (PC), 0x08008000)
    02-00000000-00-01289988-003A: T7EF0B700 1289:993.153 CPU_ReadMem(4 bytes @ 0xE000ED90)
    02-00000000-00-01289989-0043: T7EF0B700 1289:993.449 -- --------------------------------------
    02-00000000-00-01289989-0072: T7EF0B700 1289:993.462 Flash bank @ 0x08000000: Default: L2 verify disabled because algorithm performs L1 verify
    02-00000000-00-01289989-004C: T7EF0B700 1289:993.469 -- Start of determining dirty areas in flash cache
    02-00000000-00-01289989-003B: T7EF0B700 1289:993.501 -- End of determining dirty areas
    02-00000000-00-01289989-0041: T7EF0B700 1289:993.507 -- Start of preparing flash programming
    02-00000000-00-01289989-0032: T7EF0B700 1289:993.514 -- Calculating RAM usage
    02-00000000-00-01289989-0034: T7EF0B700 1289:993.526 -- RAM usage = 10260 Bytes
    02-00000000-00-01289989-0035: T7EF0B700 1289:993.533 -- Preserving CPU registers
    02-00000000-00-01289989-002D: T7EF0B700 1289:993.547 -- Preparing memory
    02-00000000-00-01289989-002D: T7EF0B700 1289:993.553 -- Preparing target
    02-00000000-00-01289989-0053: T7EF0B700 1289:994.059 -- Preserving target RAM temporarily used for programming
    02-00000000-00-01289998-0019: T7EF0B700 1290:002.865
    02-00000000-00-01289998-000F: ***** Error:
    02-00000000-00-01289998-003B: T7EF0B700 1290:002.905 Failed to prepare for programming.
    02-00000000-00-01289998-0021: Could not preserve target memory.
    02-00000000-00-01289998-003F: T7EF0B700 1290:002.917 -- End of preparing flash programming
    02-00000000-00-01290000-002B: T7EF0B700 1290:004.791 - 11.804ms returns 1

    03-00000000-00-01290000-004C: ERROR: Failed to prepare for programming.
    Could not preserve target memory.

    Could you please tell me, do i need to have any other license to download code to flash ? or anything wrong ?

    Thank you in advane.

    Feng WJ
  • Hi Feng WJ,
    Thank you for your inquiry.

    fengwj2003 wrote:

    Could you please tell me, do i need to have any other license to download code to flash ? or anything wrong ?
    The J-Link EDU and J-Link EDU mini do have a GDB license, so this is not the issue.


    1) Do you use custom hardware
    or an evaluation board? In the latter case which one?
    If custom hardware, do you experience the same problem on an evaluation board?
    2) Could you please send us a J-Link log file? How to enable:
    wiki.segger.com/J-Link_DLL#Enable_J-Link_Log_File
    3) Could you please check if you selected the correct ST device?

    BR
    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.
  • Dear Fabian, thank you for your reply.
    1. I use custom board from Holybro's pixhawk 4 and I do not have an evaluation board.
    2. The chip is STM32F765II
    3. The attached file is JLinkGDBServer.log.

    By the way, I use the following commands to use gdb

    1. JLinkGDBServerExe
    2. arm-none-eabi-gdb code.elf
    3. gdb> target remote localhost:2331
    4. gdb> monitor reset
    5. gdb> load

    Here, the gdbserver showed me the message "Failed to prepare for programming".

    Thank you in advance.
    Files

    The post was edited 2 times, last by fengwj2003 ().

  • Hi,
    Thank you for the log.

    According to the log file, you are not connecting to a STM32F7 but to a STM32F1 device.

    As you can see, the InitTarget() function warns:
    WARNING: Unknown DEV_ID found: 0x00000410

    The DEV_ID 0x410 is a DEV_ID of an STM32F1 (see below)
    The STM32F76x devices have the DEV_ID: 0x451.



    So either you are connected to the wrong device, or the device is not an STM32F7.

    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.
  • Hi,
    All good, I am glad that I could help.

    We will close this thread now.

    BR
    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.