8 years, 11 months ago.

pyOCD support missing?

Resolved the issue of pyocd not working, despite having a merge saying 'adds python 3 support' it isn't actually supported, redownloaded it for python 2 and it runs but it still doesn't work. Using the sample blinky program:

arm-none-eabi-gdb seeed_blinky.elf 
GNU gdb (GDB) 7.10
__snip__
Reading symbols from seeed_blinky.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x0800a22a in ?? ()
(gdb) load
Loading section .text, size 0x73a8 lma 0x8000000
Loading section .ARM.exidx, size 0x8 lma 0x80073a8
Loading section .data, size 0xb8 lma 0x80073b0
Start address 0x8000690, load size 29800
Transfer rate: 5 KB/sec, 1752 bytes/write.
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x08008ab0 in ?? ()
(gdb) step
Cannot find bounds of current function
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x08008ab0 in ?? ()

The program doesn't run (the LED never lights up), there shouldn't be anywhere near 0x8000 instructions in a simple blinky program, can't step because it 'cannot find bounds of current function' and no instructions are decoded. Blinky has been compiled with debug enabled so it's not an issue with that.

I've installed pyOCD and exported my program for debugging to my local drive (and compiled it) but it seems contrary to the message on the wiki and device page here: 'SWD debug with GDB+ pyOCD/OpenOCD, Keil or IAR', there is no support for this board in pyOCD.

INFO:root:Unsupported board found: b'9011' INFO:root:Target could not be determined. Specify target manually to use board

Override target to debug. Supported targets are: k64f, lpc1768, k22f, kinetis, kl26z, nrf52, kl05z, stm32f051, kl46z, k20d50m, w7500, max32600mbed, nrf51, cortex_m, lpc4330, maxwsnenv, kl28z, lpc11xx_32, lpc11u24, stm32f103rc, kl02z, kl25z, lpc800

None of these appear to be compatible with the arch max, so how is GDB debugging possible with this board?

Question relating to:

The Arch Max is an mbed enabled development board for rapid prototyping. It's based on a STM32F407VET6 microcontrolle with an ARM Cortex-M4F core running at 168MHz. It includes an open …

edited question instead

posted by Bob Seque 08 Dec 2015

1 Answer

8 years, 11 months ago.

Updated:

Sorry to make you confused. The PyOCD's flash download function for the Arch Max is not implemented yet. But we can use PyOCD to debug with arm-none-eabi-gdb (assume we use gcc arm embedded toolchain).

1. create elf file with debug info

make DEBUG=1

2. download bin file using drag-n-drop programming

3. setup a gdb server using pyocd (the latest pyOCD from - https://github.com/mbedmicro/pyOCD), the mcu - stm32f407 is not added to pyocd yet, so we use stm32f103rc

pyocd -t stm32f103rc

4. use arm-none-eabi-gdb to connect the gdb server

arm-none-eabi-gdb example.elf -ex 'target remote localhost:3333'

The program I used is:

blinky snippet

#include "mbed.h"

DigitalOut led(LED1);

int main()
{
    while (1) {
        led = !led;
        wait(1);
    }
}

Then we can debug the program in gdb console:

mon reset

b main.cpp: 8

c

c

OK thanks for the help, I've now got basic debugging working... Is there a timeframe for proper debugging support though?

Debugging in this way doesn't support a lot of things such as backtraces, variable outputting, and is a bit unstable.

posted by Bob Seque 12 Dec 2015

Before we get it fully supported by pyOCD, we can try using OpenOCD as gdb server. With the latest openocd and a openocd config file (https://github.com/Seeed-Studio/Arch_Max/blob/master/arch_max.cfg), we can easily setup a gdb server.

posted by Yihui Xiong 13 Dec 2015

If you use windows, we can use the powerful EmBitz IDE with Arch Max (https://github.com/Seeed-Studio/Arch_Max/wiki/Get-Started-with-EmBitz-and-Seeed-Arch-Max)

posted by Yihui Xiong 13 Dec 2015