Hi All
So a while back I setup an
offline Mbed (Mbed CLI) project for an STM32F301K8U6, and after being exposed to Segger Embedded Studio for my
nRF52832 project I am starting to see why/how an IDE can be extremely useful for debugging. Before with Mbed I would just use notepad++ to write my code, compile it through CMD, and do my debugging through serial and printf statements. So now I am really keen to setup a proper debug environment for the STM32F301K8U6
With all that said would any of you guys know of a good & free Mbed compatible IDE that I could perhaps export/import my project into? So far I have found a good tutorial on
Visual Studio CodeUPDATE 1: Found a couple of tutorials on how to export Mbed CLI projects to other IDE's,
Mbed 2 &
Mbed 5UPDATE 2: Am going to try debugging Mbed 2 in
Visual Studio Code first and if that does not work then try an Eclipse based IDE (
Mbed 2 &
Mbed 5)
UPDATE 3: Here is my rough tutorial so far:
############################################################
NOTE: Following steps are designed for mbed 5 but seem to mostly work with mbed 2
So far the only issues I have had is when you step into fundermental modules
for example i2c.cpp (does not exist in mbed 2, might be called something else...)
- Using this as the "tutorial":
https://os.mbed.com/questions/79289/How-to-get-vscode-debugging-working-with/- Install OpenOCD (version 0.10.0-11-20190118-1134) from here:
https://gnu-mcu-eclipse.github.io/openocd/install/- To setup the OpenOCD portal type following into CMD:
cd C:\Users\eng\AppData\Roaming\GNU MCU Eclipse\OpenOCD\0.10.0-11-20190118-1134\bin
openocd -f "C:\Users\eng\AppData\Roaming\GNU MCU Eclipse\OpenOCD\0.10.0-11-20190118-1134\scripts\board\st_nucleo_f3.cfg"
- To connect to the portal in another CMD window type:
telnet localhost 4444
- To verify all is OK in your 2nd CMD window type:
version
- This should return:
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:42)
- To gracefully close your session type the following into CMD window 2:
exit
- Exporting your mbed-cli project:
mbed export -i vscode_gcc_arm -m NUCLEO_F302R8
- Follow this tutorial to install Visual Studio Code:
https://os.mbed.com/docs/mbed-os/v5.6/tutorials/visual-studio-code.html- Next up open the main dir (contains ".vscode" and other files) in Visual Studio Code
- For the "NUCLEO_F302R8.bat" (OpenOCD start-up) use the following:
cd "C:\Users\eng\AppData\Roaming\GNU MCU Eclipse\OpenOCD\0.10.0-11-20190118-1134\bin" && openocd -f "C:\Users\eng\AppData\Roaming\GNU MCU Eclipse\OpenOCD\0.10.0-11-20190118-1134\scripts\board\st_nucleo_f3.cfg"
- "'make.exe' is not recognized as an internal or external command,"
https://github.com/TylerBrock/mongo-hacker/issues/138 http://gnuwin32.sourceforge.net/packages/make.htm PATH add C:\Program Files (x86)\GnuWin32\bin
- To actually run the debug:
1. Run "NUCLEO_F302R8.bat"
2. Run (in Visual Studio Code), Debug -> Start Debugging (F5)
3. Change over to the DEBUG CONSOLE to see the outputs
4. As you step through "main.cpp" hover over the variables to see their current value,
otherwise as you step through each function you will also see current variables
in the left hand side
############################################################