Develop STM32F4 Discovery(Cortex m4) with Eclipse on Mac OS _ PART 2
This is the 2nd part of the Develop STM32F4 Discovery with Eclipse on Mac OS. The part #1 can be found at https://medium.com/@zlt1213/develop-stm32f4-discovery-board-on-mac-os-part-1-dca644816e5.
Download and Install OpenOCD
GNU MCU Eclipse is a distribution of OpenOCD. It’s a easy-to-use debug environment that works on both MacOS and Windows. The CNU MCU Eclipse can be downloaded from https://github.com/gnu-mcu-eclipse/openocd.
On the github page, click on the ‘releases’ as shown in Fig. 1.
In the release page, click on the *****-win64.zip(or win32, depend on your operating system) link to download. After downloading, unzip the file and save it to some location you can find easily. In my case, I saved the file in D:\OpenOCD. After this, open the Eclipse and create a new c project.
The function of OpenOCD is to download the source code to your Discovery board and debug, so before setting up the OpenOCD it is better to have a project successfully built in order to test the setup of OpenOCD.
The next step is to config the OpenOCD as as external tool. Click on RUN -> External Tools -> External Tools Configurations… as shown in Fig. 4 above.
In the left up corner of the External Tools Configurations window, click the New Launch Configuration button. Name the new configuration as OpenOCD. In the Location field, please enter the location of your openocd.exe that you have already downloaded as mentioned above. In my case, it is D:\OpenOCD\0.10.0–7–20180123–1217\bin\openocd.exe. In the Working Directory file, please enter the location of the scripts folder. In my case, it is D:\OpenOCD\0.10.0–7–20180123–1217\scripts. In the Arguments field, just enter -f board/stm32f4discovery.cfg for the reasone that we as going to use the Stm32f4 Discovry board(be careful, it “/” here, not the “\”).
Then open the Commom tab and check the External Tools check box. Please keep all the other settings and configs as default. After this, you can just click on the Apply button and close the configuration window.
At this time, you can connect your Stm32f4 Discovery Board to your computer. In Eclipse, at the top of the windows, extend the run external tool button to start OpenOCD. If your OpenOCD connected successfully, the big led on your discovery board will flash red and green and in the Console window you can see the information as shown in the figure below.
At this time, your Stm32f4 Discovery Board is connected by OpenOCD. If you have any question, you can ask me by leaving a comment.
The other posts of this series can be found at: