Quantcast
Channel: Engineering(DIY)
Viewing all articles
Browse latest Browse all 20

STM32F3 Discovery on Windows with Eclipse and OpenOCD

$
0
0
Hi!

Because of a lot of requests, I have decided to make the Windows version of the tutorial for setting up STM32F3-Discovery board, with free tools.

First, download ST-LINK V2 driver from here. Open the archive and install what is in it.
Then plug the device and let the driver install.
Now, get the latest OpenOCD installer from here and extract it somewhere. Copy <openocd_path>\scripts\board\stm32f3discovery.cfg to <openocd_path>\bin folder
Now you should be able to connect to the board in Command Prompt like this:
D:\embedded\openocd-0.7.0-dev-121112115725\bin>openocd-0.7.0-dev-121112115725.ex
e -f stm32f3discovery.cfg
Open On-Chip Debugger 0.7.0-dev-00079-g08ddb19 (2012-11-12-17:14)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain
Info : clock speed 1000 kHz
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
Now close the Command Prompt.

Download latest Eclipse.
Go to Eclipse download page and download Eclipse IDE for C/C++ developers. Extract it and start eclipse.exe. Go to Workbench.

Set up Eclipse.
Go to Help->Install New Software, select All Available Sites in Work With dropdown list. Enter "GDB Hardware Debugging" in the search box and install the package. Download Arm Eclipse Plugin from here and then go to Help->Install New Software in Eclipse. Click Add and then click archive and select the previous downloaded file. Then select the packet and install it.

Install GCC Arm Embedded toolchain from here.

Now we need some Linux tools like make and rm for Windows. Download Cygwin from here. Select whichever mirror you want. Search for "make" and select the binary from Devel dropdown. Click next and wait for it to install.
Now, download this project and import it in Eclipse Workspace. Right click project and select  Properties->C/C++ Build->Environment. Here, check if PATH variable has link to toolchain and to Cygwin binaries folders. Here, you can add <gcc-arm-none-eabi-4_6-2012q4/arm-none-eabi/include> path for the Eclipse IDE to find some headers like stdint.h.
If everything  was installed correctly you should be able to clean the project and to build it.

With the project selected, click Run->External Tools->External Tools Configurations and select from the left the configuration named OpenOCD(win). Check if the path for OpenOCD at top is correct.
Now, click Run.

After this, click Run->Debug Configurations and select from the left Navigation-debug. In the Debugger tab check if the arm-none-eabi-gdb.exe path is correct. Now click Debug and you should see the Debug Window from Eclipse and the Program counter pointing at the first instruction from main().


Viewing all articles
Browse latest Browse all 20

Trending Articles