Eclipse + st-link + openocd + gdb development STM32F4

Source: Internet
Author: User
Tags doxygen

St-link in the Win8 on the support is not very good, it is said that because St-link the hardware does not have a digital signature, Win8 mandatory hardware must have a digital signature. Although the usual still use of pirated Jlink a little more, but the hands of this piece of Discovery Board only onboard St-link .

Download Zadig

Download First Zadig , this is an open-source win Drive that allows Win8 Identify the St-link hardware.

Download Openocd

then download Openocd , which is equivalent to debugging the agent. The advantage is that more emulators are supported. Program burning can be done via 4444 Port telnet access, or by gdb access 3333 Port for debugging.

the download is complete and will bin Add the directory to the environment variable and enter the following command.

$ openocd-x64-0.7.0.exe-v

Open on-chip Debugger 0.7.0 (2013-05-05-10:44)

Licensed under GNU GPL v2

For bug reports, read

Http://openocd.sourceforge.net/doc/doxygen/bugs.html

and then connect our hardware, and then use the - F Specify the configuration file for the board, the downloaded folder already has some well-written configuration files, which have Discovery the board.

$ openocd-x64-0.7.0.exe-f Stm32f4discovery.cfg

Open on-chip Debugger 0.7.0 (2013-05-05-10:44)

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 v14 API v2 SWIM v0 VID 0x0483 PID 0x3748

Info:target voltage:2.887346

Info:stm32f4x.cpu:hardware has 6 breakpoints, 4 watchpoints

If it appears as shown above, then congratulations, you are ready to start debugging.

telnet flash burn

Use telnet Open the local 4444 Port. Enter the following command to implement program burning. Here we burn is MDK compiled out of the axf format file, the reason why also support AXF, is because AXF Essence is an elf file.

Reset Halt

Sleep 100

Flash Write_image Erase DEMO.AXF

Sleep 100

Verify_image DEMO.AXF

Sleep 100

Reset Run

Use Arm-none-eabi-gdb Debug

Eclipse the principle of debugging is the same, but more than a GUI .

$ arm-none-eabi-gdb DEMO.AXF

load the symbol table. Then connect to the 3333 Port.

(GDB) Target remote localhost:3333

Remote Debugging using localhost:3333

Warning:loadable segment "Rw_iram1" Outside of ELF segments

<Reset_Handler> ()

At.. \.. \.. \libraries\cmsis\st\stm32f4xx\source\templates\arm\/startup_stm32

f4xx.s:175

175 LDR R0, =systeminit

(GDB) Monitor Reset halt

Target state:halted

Target halted due to debug-request, current Mode:thread

xpsr:0x01000000 pc:0x0800019c msp:0x20000c78

(GDB)

then you can use various gdb the command was debugged.

(GDB) B main

Breakpoint 1 at 0x8004546:file. \/MAIN.C, line 75.

(GDB) C

Continuing.

note:automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, Main () at: \/main.c:75

Stm_eval_pbinit (Button_user, Button_mode_exti);

(GDB) s

Stm_eval_pbinit (Button=button_user, Button_mode=button_mode_exti)

At.. \/.. \.. \utilities\stm32f4-discovery\stm32f4_discovery.c:195

195 Rcc_ahb1periphclockcmd (Button_clk[button], ENABLE);

(GDB)

The disadvantage is undoubtedly so too not intuitive.

Eclipse Debug

first of all, you have to have CDT plug-in and then install the time remember to put GDB Hardware Debugging selected, the default is not installed.

And then just fill it out as shown in the diagram, actually. gdb The principle is exactly the same.

not at last . Load Image , as has been through telnet The program was burned, debugged Eclipse just the symbol table. Here is the Debug interface:

Postscript

of course, if you could use Arm-none-eabi-ld , you can completely abandon commercial software.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.