Should pyOCD work with mDot on UDK2

Home Forums mDot/xDot Should pyOCD work with mDot on UDK2

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11710
    Shaun Nelson
    Participant

    I’ve just installed pyOCD but cannot get it to work with mDot on a UDK 2.0
    Specifically, pyOCD does not see it as a connected board.

    I have an LPC1768 lying around and pyOCD works like a champ with it. When I plug in this device an MBED CMSIS DAP USB Device is added. When I attach the mDot on UDK2 an STM32 STLink USB Device is registered.

    I know pyOCD uses the CMSIS-DAP interface, so is there a way to gain access to the mDot’s when on an UDK board?

    Thanks,
    -Shaun

    #11711
    Andrew Lindsay
    Participant

    Perhaps this is a question for the pyOCD community rather than the mDot community.

    Andrew

    #11712
    Mike Fiore
    Blocked

    Shaun,

    It doesn’t look like pyOCD has support for very many ST targets yet.

    https://github.com/mbedmicro/pyOCD/blob/master/pyOCD/board/mbed_board.py

    The mDot has a STM32F411 processor, which isn’t in that list. You could try adding it if you wanted.

    However, OpenOCD does have support for ST targets. I was able to start a gdb session to debug my mDot by following these steps:

    * download OpenOCD from https://sourceforge.net/projects/openocd/files/openocd/0.9.0/
    * extract tarball
    * run configure; make; sudo make install
    * add self to plugdev group (linux)
    * copy /usr/local/share/openocd/contrib/99-openocd.rules to /etc/udev/rules.d/ (linux)
    * connect USB from UDK2
    * run openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/board/st_nucleo_f4.cfg
    * in another terminal, run arm-none-eabi-gdb
    * in the gdb prompt, type target remote localhost:3333

    Documentation for OpenOCD 0.9.0 is here:

    http://openocd.org/doc-release/pdf/openocd.pdf

    Make sure your application (and the mbed libraries) were built with debug symbols!

    Hope this helps!

    -Mike

    #11713
    Shaun Nelson
    Participant

    Hi Mike,

    Thanks for the info. I’ll give OpenOCD a shot.

    Regards,
    -Shaun

    #11756
    Mike Fiore
    Blocked

    Shaun,
    I realized the info I gave you was incomplete. Here’s an updated series of steps to debug your mDot:

    * download OpenOCD from https://sourceforge.net/projects/openocd/files/openocd/0.9.0/
    * extract tarball
    tar -xzvf openocd-0.9.0.tar.gz
    * make and install OpenOCD
    configure; make; sudo make install
    * add self to plugdev group (linux)
    sudo usermod -a -G plugdev
    * copy udev rules for debug interfaces (linux)
    cp /usr/local/share/openocd/contrib/99-openocd.rules to /etc/udev/rules.d/
    * connect UDK2/MDK/etc
    * start openocd
    openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/board/st_nucleo_f4.cfg
    * start gdb in another terminal
    arm-none-eabi-gdb
    * connect your gdb instance to the gdbserver OpenOCD is running
    (gdb) target remote localhost:3333
    * load the symbol file into gdb – this is the .elf file in the same directory your binary was in
    (gdb) symbol-file * halt and reset the target
    (gdb) monitor reset init
    * now you’re ready to debug!

    Make sure your application (and the mbed libraries) were built with debug symbols! The simplest way is to use the “-o debug-info” with the build and make scripts.

    Also, here’s a good tutorial I found:

    http://mcuoneclipse.com/2015/03/22/openocdcmsis-dap-debugging-with-eclipse-and-without-an-ide/

    Cheers,

    Mike

    #11798
    Shaun Nelson
    Participant

    Hi Mike,

    OpenOCD works great!

    I did hit a speed bump on the configure/make step. It seemed to build fine but OpenOCD could not find the debug interface; the exact error was “specified debug interface was not found (hla).

    Looking in the configure log there was an error that libusb-1.0.x was missing, which apparently is not enough to abort the make (don’t you love silent failures!). I fixed this with ‘apt-get install libusb-1.0.1-dev.

    When I ran configure the 2nd time I also passed in –enable-stlink because I read on a forum that perhaps the interface support was not compiled in.

    As a final step to confirm OpenOCD was properly configured, I ran ‘openocd -c interface_list’ and voila hla was in the list.

    Thanks again,
    -Shaun

    #11800
    Mike Fiore
    Blocked

    Shaun, excellent! I’m glad that worked out for you.

    Happy debugging!

    -Mike

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