Unable to program flash using GDB and GDBServer on TWR-K60N512

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

  • Unable to program flash using GDB and GDBServer on TWR-K60N512

    Using arm-eabi-gdb 4.3.2
    gdbserver 4.32

    I am unable to load a program to flash using GDB, GDBServer, and a Jlink Pro. I have tried many configurations (speed, reset, etc.) without success. I can however program the K60N512 using CodeSourcery Codebench and their debug sprite. I also can program an LPC2468 and an AT91SAM7X using GDB and GDBServer.

    I believe there is something wrong with my .gdb configuration file. I couldn't find an example .gdb file either in the Segger samples or on the web.

    Please see the files and the logs below.

    Thank you for your help.



    ########## .GDB File:

    target remote 10.211.55.3:2331
    monitor flash device PK60N512VMD100

    monitor flash download 1
    monitor flash breakpoints 1
    monitor endian little
    monitor speed adaptive

    load




    ################### GDB Session:

    GNU gdb (eCosCentric GNU tools 4.3.2-sw) 6.8.50.20080706
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-eabi".
    For bug reporting instructions, please see:
    ...
    (gdb) target remote 10.211.55.3:2331
    Remote debugging using 10.211.55.3:2331
    0x00000000 in hal_vsr_table_init ()
    (gdb) monitor flash device PK60N512VMD100
    Select flash device: PK60N512VMD100
    (gdb) monitor flash download 1
    Flash download enabled
    (gdb) monitor flash breakpoints 1
    Flash breakpoints enabled
    (gdb) monitor endian little
    Target endianess set to "little endian"
    (gdb) monitor speed adaptive
    Select adaptive clocking instead of fixed JTAG speed
    (gdb) load
    Loading section .rom_vectors, size 0x8 lma 0x0
    Loading section .kinetis_misc, size 0x2c0 lma 0x8
    Loading section .flash_security, size 0x10 lma 0x400
    Loading section .ARM.exidx, size 0x10 lma 0x410
    Loading section .text, size 0x3f98 lma 0x420
    Loading section .rodata, size 0x37c lma 0x43b8
    Loading section .data, size 0x19c lma 0x4740
    Start address 0x421, load size 18328
    Transfer rate: 6 KB/sec, 2291 bytes/write.




    ############## GDBServer Log:

    SEGGER J-Link GDB Server V4.32

    JLinkARM.dll V4.32 (DLL compiled Jul 29 2011 18:37:55)

    Listening on TCP/IP port 2331

    J-Link connected
    Firmware: J-Link ARM-Pro V1.x compiled Jul 26 2011 17:23:23
    Hardware: V1.10
    S/N: 171100119
    Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB

    J-Link found 1 JTAG device, Total IRLen = 4
    JTAG ID: 0x4BA00477 (Cortex-M4)

    Connected to 10.211.55.4
    Reading all registers
    Read 4 bytes @ address 0x00000000 (Data = 0x20010000)
    Select flash device: PK60N512VMD100
    Flash download enabled
    Flash breakpoints enabled
    Target endianess set to "little endian"
    Select adaptive clocking instead of fixed JTAG speed
    Downloading 8 bytes @ address 0x00000000 - Verify failed
    Downloading 704 bytes @ address 0x00000008 - Verify failed
    Downloading 16 bytes @ address 0x00000400 - Verify failed
    Downloading 16 bytes @ address 0x00000410 - Verify failed
    Downloading 16096 bytes @ address 0x00000420 - Verify failed
    Downloading 184 bytes @ address 0x00004300 - Verify failed
    Downloading 892 bytes @ address 0x000043B8 - Verify failed
    Downloading 412 bytes @ address 0x00004740 - Verify failed
    Writing register (PC = 0x00000421)
  • Hi,

    The device names listed here: segger.com/cms/supported-devices.html are also the ones which are accepted by the DLL / GDBServer.
    So in your case, the following line needs to be changed from:

    C Source Code

    1. monitor flash device PK60N512VMD100

    to

    C Source Code

    1. monitor flash device MK60N512VMD100

    or

    C Source Code

    1. monitor flash device K60DN512Z



    Best regards
    Alex
    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 Alex. All is working.

    I set the:

    monitor flash device MK60N512VMD100

    And changed from:

    monitor speed adaptive

    To:

    monitor speed auto

    And the download and execution work perfectly.

    This is the final set of GDB commands I use:


    First I start GDB using: arm-eabi-gdb <file to debug>


    ######### BEGIN GDB COMMANDS ########

    target remote 10.211.55.3:2331

    monitor reset
    monitor sleep 1000

    monitor flash device MK60N512VMD100
    monitor flash download 1
    monitor flash breakpoints 1
    monitor endian little
    monitor speed auto

    load

    # Start execution
    cont

    ######## END GDB COMMANDS ########

    Alternatively I put the above GDB commands into a file: jlink_rom_k60.gdb and start the debugger as follows:

    arm-eabi-gdb --command=jlink_rom_k60.gdb <file to debug>


    On another note, there seems to be an issue when I select monitor speed adaptive. I will start a new thread to discuss what I see.

    Thank you again for your help.
  • Hi,

    We will have a look into the "hanging" problem you describe, since this should not happen.
    Nevertheless, adaptive clocking is not supported for Cortex targets, so this speed setting should not be used.

    Best regards
    Alex
    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.