Linux Debugger configuration

From Miosix Wiki
Revision as of 12:26, 26 June 2016 by Andreabont (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The debugging of Miosix on Linux can be done through OpenOCD, that creates a bridge between GDB and the JTAG device.

Setting up OpenOCD

Install OpenOCD

sudo apt-get install openocd # Install OpenOCD for Ubuntu/Debian

Run OpenOCD

The OpenOCD configuration is included in the official Miosix distribution under the path 'miosix/arch'. You must choose the proper config file for the device in use. For example for the stm32f429zi_stm32f4discovery board:

openocd -f miosix/arch/cortexM4_stm32f4/stm32f429zi_stm32f4discovery/stm32f4discovery.cfg

Debugging with GDB

The GDB used is provided by the official Miosix Toolchain. If you haven't already installed it's time to do it. The debugger must be launched on the ELF binary file.

arm-miosix-eabi-gdb main.elf

Connect GDB

OpenOCD provide a network interface for connect the debugger, the follow command is necessary for establish the connection:

(gdb) target remote <ip>:<port>

The default socket is listening on port 3333 in the loopback interface of your computer. So you can use the default command:

(gdb) target remote :3333

Reset the board

After the connection (and after each change of configuration) you must reset the board in a safe state:

(gdb) monitor reset halt

Flash a new firmware

If you want to upload to the board a new firmware version you can made it through gdb and OpenOCD, you must indicate the binary file and the address of the flash memory of your board:

(gdb) monitor flash write_image erase main.bin 0x08000000

It's often necessary to perform a reset of the board before and after the firmware upload.