[SOLVED] J-Link EDU LPC2146 verification error at 0x0

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

  • [SOLVED] J-Link EDU LPC2146 verification error at 0x0

    Hello

    I'm quite new to the J-Link EDU and got a bit stuck...

    I have a J-Link EDU connected via JTAG to a LPC2146.
    Downloading a hex file to flash works good, but i cant't sucessfully verify it over the GDB Server.

    It seems to work well from J-Flash Lite on Windows 7:

    SEGGER J-Flash Lite 4.85a output:

    Source Code

    1. Downloading C:\dir\to\file.hex to LPC2146 via JTAG-Interface@1000kHz
    2. Programming Thread started.
    3. Device "LPC2146" selected.
    4. TotalIRLen = 4, IRPrint = 0x01
    5. Debugger initialized successfully.
    6. J-Link: Flash download: Flash programming performed for 1 range (4096 bytes)
    7. J-Link: Flash download: Total time needed: 1.513s (Prepare: 0.385s, Compare: 0.328s, Erase: 0.448s, Program: 0.094s, Verify: 0.013s, Restore: 0.242s)
    8. Programming Thread exited
    9. Programming done



    First try with automatic verification and JTAG set as interface (on Linux):

    JLinkGDBServer output:

    Source Code

    1. [user@machine JLink_Linux_V498b_x86_64]$ ./JLinkGDBServer -vd -if JTAG
    2. SEGGER J-Link GDB Server V4.98b Command Line Version
    3. JLinkARM.dll V4.98b (DLL compiled Apr 10 2015 20:27:35)
    4. -----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: yes
    10. Generate logfile: off
    11. Verify download: on
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: off
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: none
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: unspecified
    22. Target interface: JTAG
    23. Target interface speed: 1000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Link V9 compiled Apr 21 2015 18:10:40
    28. Hardware: V9.30
    29. S/N: -deleted-
    30. OEM: SEGGER-EDU
    31. Feature(s): FlashBP, GDB
    32. Checking target voltage...
    33. Target voltage: 3.31 V
    34. Listening on TCP/IP port 2331
    35. Connecting to target...
    36. J-Link found 1 JTAG device, Total IRLen = 4
    37. JTAG ID: 0x4F1F0F0F (ARM7)
    38. Connected to target
    39. Waiting for GDB connection...Connected to 127.0.0.1
    40. Reading all registers
    41. ERROR: Can not read register 0 (R0) while CPU is running
    42. .
    43. .
    44. .
    45. ERROR: Can not read register 78 (R14) while CPU is running
    46. ERROR: Can not read register 9 (R15 (PC)) while CPU is running
    47. ERROR: Can not read register 8 (CPSR) while CPU is running
    48. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    49. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    50. Reading all registers
    51. ERROR: Can not read register 0 (R0) while CPU is running
    52. .
    53. .
    54. .
    55. ERROR: Can not read register 78 (R14) while CPU is running
    56. ERROR: Can not read register 9 (R15 (PC)) while CPU is running
    57. ERROR: Can not read register 8 (CPSR) while CPU is running
    58. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    59. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    60. Downloading 4096 bytes @ address 0x00000000 - Verify failed
    61. Downloading 4096 bytes @ address 0x00001000 - Verified OK
    62. .
    63. .
    64. .
    65. Downloading 232 bytes @ address 0x00015000 - Verified OK
    66. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    67. Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
    68. GDB closed TCP/IP connection
    69. ^CRestoring target state and closing J-Link connection...
    70. Shutting down...
    71. [user@machine JLink_Linux_V498b_x86_64]$
    Display All


    GDB output:

    Source Code

    1. [user@machine]$ arm-none-eabi-gdb
    2. GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.1.20141128-cvs
    3. Copyright (C) 2014 Free Software Foundation, Inc.
    4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    5. This is free software: you are free to change and redistribute it.
    6. There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    7. and "show warranty" for details.
    8. This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
    9. Type "show configuration" for configuration details.
    10. For bug reporting instructions, please see:
    11. <http://www.gnu.org/software/gdb/bugs/>.
    12. Find the GDB manual and other documentation resources online at:
    13. <http://www.gnu.org/software/gdb/documentation/>.
    14. For help, type "help".
    15. Type "apropos word" to search for commands related to "word".
    16. (gdb) target remote localhost:2331
    17. Remote debugging using localhost:2331
    18. 0x00000000 in ?? ()
    19. (gdb) file /dir/to/file.hex
    20. A program is being debugged already.
    21. Are you sure you want to change the file? (y or n) y
    22. Reading symbols from /dir/to/file.hex..(no debugging symbols found)...done.
    23. (gdb) load
    24. Loading section .sec1, size 0x10000 lma 0x0
    25. Loading section .sec2, size 0x50e8 lma 0x10000
    26. Start address 0x0, load size 86248
    27. Transfer rate: 25 KB/sec, 3920 bytes/write.
    28. (gdb)
    29. (gdb) q
    30. A debugging session is active.
    31. Inferior 1 [Remote target] will be killed.
    32. Quit anyway? (y or n) y
    33. [user@machine]$
    Display All


    Second try, JLinkGDBServer started without any options (on Linux):


    JLinkGDBServer output:

    Source Code

    1. [user@machine JLink_Linux_V498b_x86_64]$ ./JLinkGDBServer
    2. SEGGER J-Link GDB Server V4.98b Command Line Version
    3. JLinkARM.dll V4.98b (DLL compiled Apr 10 2015 20:27:35)
    4. -----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: yes
    10. Generate logfile: off
    11. Verify download: off
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: off
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: none
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: unspecified
    22. Target interface: JTAG
    23. Target interface speed: 1000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Link V9 compiled Apr 21 2015 18:10:40
    28. Hardware: V9.30
    29. S/N: -deleted-
    30. OEM: SEGGER-EDU
    31. Feature(s): FlashBP, GDB
    32. Checking target voltage...
    33. Target voltage: 3.32 V
    34. Listening on TCP/IP port 2331
    35. Connecting to target...
    36. J-Link found 1 JTAG device, Total IRLen = 4
    37. JTAG ID: 0x4F1F0F0F (ARM7)
    38. Connected to target
    39. Waiting for GDB connection...Connected to 127.0.0.1
    40. Reading all registers
    41. Read 4 bytes @ address 0x7FFFD2D6 (Data = 0x07806808)
    42. Select JTAG as target interface
    43. Selecting device: lpc2146
    44. Reading all registers
    45. Read 4 bytes @ address 0x7FFFD2D6 (Data = 0x07806808)
    46. Downloading 4096 bytes @ address 0x00000000
    47. .
    48. .
    49. .
    50. Downloading 4096 bytes @ address 0x00014000
    51. Downloading 232 bytes @ address 0x00015000
    52. Writing register (PC = 0x00000000)
    53. Read 4 bytes @ address 0x00000000 (Data = 0xE59F4034)
    54. Reading 1024 bytes @ address 0x00000000
    55. .
    56. .
    57. .
    58. Reading 1024 bytes @ address 0x00014C00
    59. Reading 232 bytes @ address 0x00015000
    60. GDB closed TCP/IP connection
    61. ^CRestoring target state and closing J-Link connection...
    62. Shutting down...
    63. [user@machine JLink_Linux_V498b_x86_64]$
    Display All



    GDB output:

    Source Code

    1. [user@machine]$ arm-none-eabi-gdb
    2. GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.1.20141128-cvs
    3. Copyright (C) 2014 Free Software Foundation, Inc.
    4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    5. This is free software: you are free to change and redistribute it.
    6. There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    7. and "show warranty" for details.
    8. This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
    9. Type "show configuration" for configuration details.
    10. For bug reporting instructions, please see:
    11. <http://www.gnu.org/software/gdb/bugs/>.
    12. Find the GDB manual and other documentation resources online at:
    13. <http://www.gnu.org/software/gdb/documentation/>.
    14. For help, type "help".
    15. Type "apropos word" to search for commands related to "word".
    16. (gdb) target remote localhost:2331
    17. Remote debugging using localhost:2331
    18. 0x7fffd2d6 in ?? ()
    19. (gdb) monitor interface JTAG
    20. Select JTAG as target interface
    21. (gdb) monitor device lpc2146
    22. Selecting device: lpc2146
    23. (gdb) file /dir/to/file.hex
    24. A program is being debugged already.
    25. Are you sure you want to change the file? (y or n) y
    26. Reading symbols from /dir/to/file.hex...(no debugging symbols found)...done.
    27. (gdb) load
    28. Loading section .sec1, size 0x10000 lma 0x0
    29. Loading section .sec2, size 0x50e8 lma 0x10000
    30. Start address 0x0, load size 86248
    31. Transfer rate: 1380 KB/sec, 3920 bytes/write.
    32. (gdb) compare-sections
    33. Section .sec1, range 0x0 -- 0x10000: MIS-MATCHED!
    34. Section .sec2, range 0x10000 -- 0x150e8: matched.
    35. warning: One or more sections of the target image does not match
    36. the loaded file
    37. (gdb) q
    38. A debugging session is active.
    39. Inferior 1 [Remote target] will be killed.
    40. Quit anyway? (y or n) y
    41. [user@machine]$
    Display All



    Both tries fail at 0x0

    I have tried it also with an other LPC2146 which results in the exact same error on the same memory adress (0x0).

    I guess the origin of this error are wrong commands, since it seems to work with JFlash lite (and one of the LPCs can sucessfully be flashed and verified with OpenOCD/FTDI).

    What is my mistake here or what can I try else?


    Thanks, Marius :)

    (btw. I have removed S/N, directory named and some parts of the code)
  • Hi Marius,

    In general, the correct way is to specify the device either in the dialog which opens when no command line is passed to the GDB Server or to pass the device via command line arguments.

    Example:

    1. Start J-Link GDB Server: JLinkGDBServer.exe -select USB -device LPC2146 -if JTAG -speed 4000
    2. Start GDB Server: arm-none-eabi-gdb -x ./gdb.gdbinit

    gdb.gdbinit:

    PHP Source Code

    1. #
    2. # J-LINK GDB SERVER initialization
    3. #
    4. # This connects to a GDB Server listening
    5. # for commands on localhost at tcp port 2331
    6. target remote localhost:2331
    7. # Set JTAG speed to 4000 kHz
    8. monitor speed 4000
    9. # Set GDBServer to little endian
    10. monitor endian little
    11. # Reset the chip to get to a known state.
    12. monitor reset
    13. flush registers
    14. file File.elf
    15. load
    Display All



    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.
  • Thank you for the feedback. Good to hear that you are up and running now.
    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.