Linux Debugger configuration

From Miosix Wiki
Revision as of 10:16, 26 June 2016 by Andreabont (talk | contribs) (Created page with "The debugging of Miosix on Linux can be done through [http://openocd.net/ OpenOCD], that creates a bridge between GDB and the JTAG device. == Setting up OpenOCD == === Insta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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