STM32 Discovery/STLinkV2/OpenOCD problems

Sysprogs forums Forums VisualGDB STM32 Discovery/STLinkV2/OpenOCD problems

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #805
    G40
    Participant

    Hello SysProgs

    The VGDB toolchain works perfectly with my Segger JTAG probe and any suitable targets (BoneBlack/NXP43XX series)

    However I am getting a very frustrating series of errors trying to debug STM32F discovery boards (One is a 429I the other a 407VGT). The core problem seems to be somewhere between OpenOCD and the GDB Server. This toolchain is rather difficult to debug outside of Visual Studio as I am not 100% sure where all of the configurations settings are picked up.

    A load of images and logs follow. This is really holding me up. Please advise ASAP.

    Many thanks

    The initial setup seems to pass:

    Then when testing we see this:

    Then when running the connection to GDB fails:

    Now I have tried this with the Windows firewall both on and off, to no effect.

    OpenOCD debug.log

    
    bi-gdb.exe --interpreter mi R:srcstm32F4429Basic/Debug/Basic.elf
    -list-features
    =thread-group-added,id="i1"
    ~"GNU gdb (GDB) 7.6.1n"
    ~"Copyright (C) 2013 Free Software Foundation, Inc.n"
    ~"License GPLv3+: GNU GPL version 3 or later nThis is free software: you are free to change and redistribute it.nThere is NO WARRANTY, to the extent permitted by law.  Type "show copying"nand "show warranty" for details.n"
    ~"This GDB was configured as "--host=i686-pc-mingw32 --target=arm-eabi".nFor bug reporting instructions, please see:n"
    ~"...n"
    ~"Reading symbols from R:\src\stm32F4\429\Basic\Debug\Basic.elf..."
    ~"done.n"
    ^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info"]
    -gdb-set stop-on-solib-events 1
    ^done
    ^done
    -gdb-set disassembly-flavor intel
    ^error,msg="No symbol "disassembly" in current context."
    ^error,msg="No symbol "disassembly" in current context."
    -gdb-set print demangle off
    ^done
    -gdb-version
    ~"GNU gdb (GDB) 7.6.1n"
    ~"Copyright (C) 2013 Free Software Foundation, Inc.n"
    ~"License GPLv3+: GNU GPL version 3 or later nThis is free software: you are free to change and redistribute it.nThere is NO WARRANTY, to the extent permitted by law. Type "show copying"nand "show warranty" for details.n"
    ~"This GDB was configured as "--host=i686-pc-mingw32 --target=arm-eabi".nFor bug reporting instructions, please see:n"
    ~".n"
    ^done
    -break-insert -f main
    ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x20000c6a",func="main()",file="LEDBlink.cpp",fullname="R:\src\stm32F4\429\Basic\LEDBlink.cpp",line="14",thread-groups=["i1"],times="0",original-location="main"}
    target remote :3333
    &"target remote :3333n"
    000-data-evaluate-expression 0
    &":3333: No connection could be made because the target machine actively refused it.n"
    ^error,msg=":3333: No connection could be made because the target machine actively refused it."
    000^done,value="0"

    Texane STLinkV2 log

    
    VisualGDB is licensed to J M Evans
    U:pkgSysGCCarm-eabibinarm-eabi-gdb.exe --interpreter mi R:srcstm32F4429Basic/Debug/Basic.elf
    -list-features
    =thread-group-added,id="i1"
    GNU gdb (GDB) 7.6.1
    Copyright (C) 2013 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-mingw32 --target=arm-eabi".
    For bug reporting instructions, please see:
    ...
    Reading symbols from R:srcstm32F4429BasicDebugBasic.elf...
    done.
    ^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info"]
    -gdb-set stop-on-solib-events 1
    OK
    -gdb-set disassembly-flavor intel
    No symbol "disassembly" in current context.
    -gdb-set print demangle off
    OK
    -gdb-version
    GNU gdb (GDB) 7.6.1
    Copyright (C) 2013 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-mingw32 --target=arm-eabi".
    For bug reporting instructions, please see:
    .
    OK
    -break-insert -f main
    ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x20000c6a",func="main()",file="LEDBlink.cpp",fullname="R:\src\stm32F4\429\Basic\LEDBlink.cpp",line="14",thread-groups=["i1"],times="0",original-location="main"}
    target remote :4242
    &"target remote :4242n"
    &":4242: No connection could be made because the target machine actively refused it.n"
    :4242: No connection could be made because the target machine actively refused it.

    version numbers

    
    Win7x64USP1
    VS2012 SP4
    VGDB 4.2
    STLink 3.3.0
    STLink USB Driver DLL 4.3.1.0
    Embedded STLink SWD firmware is V2.J19.S0
    #3110
    G40
    Participant

    Some more background on this problem.

    I have installed OpenOCD 0.8 for Windows (using the Chopin package).
    I have uninstalled the STLink drivers.
    Zadig to install up a WinUSB driver for the 429 Discovery board.

    In a nutshell, then connection between the various tools when running from shells on Windows appears to connect and respond correctly.

    Question for Sysprogs: Are you using the same version of OpenOCD or have you got some custom build?

    N.B. openocd-x64.0.8.0.exe renamed openocd.exe for simplicity!

    R:appsopenocd>openocd -f ./scripts/board/stm32f429discovery.cfg ./scripts/interface/stlink-v2.cfg

    Open On-Chip Debugger 0.8.0 (2014-04-28-08:42)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    Info : This adapter doesn't support configurable speed
    Info : STLINK v2 JTAG v19 API v2 SWIM v0 VID 0x0483 PID 0x3748
    Info : using stlink api v2
    Info : Target voltage: 2.862077
    Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

    Then from a shell run telnet localhost 3333

    Info : accepting 'gdb' connection from 3333
    Error: attempted 'gdb' connection rejected

    Then run arm-eabi-gdb from the sysprogs installation folder:

    GNU gdb (GDB) 7.6.1
    Copyright (C) 2013 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-mingw32 --target=arm-eabi".

    Connect via GDB

    gdb) target remote localhost:3333
    Remote debugging using localhost:3333
    0x00000000 in ?? ()
    (gdb)

    OpenCOD shell shows:

    Info : accepting 'gdb' connection from 3333
    Info : device id = 0x10036419
    Warn : STM32 flash size failed, probe inaccurate - assuming 2048k flash
    Info : flash size = 2048kbytes
    undefined debug reason 7 - target needs reset

    GDB:

    gdb) monitor reset init
    target state: halted
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x080eccd0 msp: 0x2002e8a0
    (gdb)

    OpenOCD:

    target state: halted
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x080eccd0 msp: 0x2002e8a0
    
    #3111
    G40
    Participant

    Possible solution: Ensure all STLink software is removed and Zadig used to install a WinUSB driver. I am now able to debug from VS2012 as expected.

    1 question arising:

    What does this mean ? KARL – should read back as 0x03, not 60 02 00 00

    VisualGDB program output console shows:

    2014-08-03T15:25:22 INFO src/stlink-common.c: Loading device parameters....
    2014-08-03T15:25:22 INFO src/stlink-common.c: Device connected is: F42x and F43x device, id 0x10036419
    2014-08-03T15:25:22 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 16384 bytes
    Chip ID is 00000419, Core ID is  2ba01477.
    Target voltage is 2859 mV.
    Listening at *:4242...
    KARL - should read back as 0x03, not 60 02 00 00
    GDB connected.
    cannot recv: -2

    Zadig: http://zadig.akeo.ie/

    #3112
    support
    Keymaster

    Hi,

    We use a special build of OpenOCD that contains a workaround to the LibUSB problem on Windows 8.1 (the source code modifications are included in the libusb_workaround.patch file together with the package). You mentioned that running the x64 OpenOCD manually works. Does running our build manually from %LOCALAPPDATA%VisualGDBEmbeddedDebugPackagescom.sysprogs.arm.openocd work as well?

    The KARL – should read back as 0x03, not 60 02 00 00 message comes from the texane/stlink tool and it looks like it gets printed unconditionally:

    static void init_code_breakpoints(stlink_t *sl) {
    memset(sl->q_buf, 0, 4);
    stlink_write_debug32(sl, CM3_REG_FP_CTRL, 0x03 /*KEY | ENABLE4*/);
    printf("KARL - should read back as 0x03, not 60 02 00 00n");
    stlink_read_debug32(sl, CM3_REG_FP_CTRL);

    for(int i = 0; i < CODE_BREAK_NUM; i++) {
    code_breaks.type = 0;
    stlink_write_debug32(sl, CM3_REG_FP_COMP0 + i * 4, 0);
    }
    }

    Most likely, it is safe to ignore this message.

    #3113
    G40
    Participant

    Hello Bazis

    Thanks. I will check this out when I get a moment.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.