IDE for offline Mbed (Mbed CLI) project - Page 1
Forum section: electronics / general

author: ANTALIFE
author_rank: Frequent Contributor
timestamp: February 04, 2019, 03:01:34 am
content: Hi AllSo a while back I setup anoffline Mbed (Mbed CLI)project for an STM32F301K8U6, and after being exposed to Segger Embedded Studio for mynRF52832 projectI 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 STM32F301K8U6With 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 onVisual 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 inVisual Studio Codefirst 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 2So far the only issues I have had is when you step into fundermental modulesfor 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\binopenocd -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/138http://gnuwin32.sourceforge.net/packages/make.htmPATH 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 outputs4. 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 variablesin the left hand side############################################################

author: ebclr
author_rank: Super Contributor
timestamp: February 04, 2019, 03:09:13 am
content: Mbed is based on Keil arm compilerhttp://www.keil.com/

author: ANTALIFE
author_rank: Frequent Contributor
timestamp: February 04, 2019, 03:13:24 am
content: Quote from: ebclr on February 04, 2019, 03:09:13 amThe more you know. It looks likeArm Development Studiois quite hefty in price, guess I should have added a free IDE

author: ebclr
author_rank: Super Contributor
timestamp: February 04, 2019, 04:32:21 am
content: Can be freehttp://www2.keil.com/stmicroelectronics-stm32/mdk

author: lollandster
author_rank: Contributor
timestamp: February 04, 2019, 04:43:40 am
content: You can export Mbed projects to OpenSTM32 AC6, but it requires you to to remove some compiler flags for it to compile. I don't think it exports undeclared libraries so it won't replace the Mbed CLI completely. I can tell you exactly how to make it compile from AC6, but I have to get to my office first and read it off my notes.Platformio.org supports debugging Mbed, but the debugger is subscription based. May be a good solution for rapid prototyping though.

author: ANTALIFE
author_rank: Frequent Contributor
timestamp: February 04, 2019, 05:35:45 am
content: Quote from: ebclr on February 04, 2019, 04:32:21 amLooks like my MCU family does not get a free licenceQuote from: lollandster on February 04, 2019, 04:43:40 amThanks for that would be much appreciated if you share your notes, also looks like OpenSTM32 AC6 is the same thing as SW4STM32 (both based on Eclipse). I'll try Visual Studio Code first, if that proves too difficult then i'll try the Eclipse based IDE's

author: lucazader
author_rank: Regular Contributor
timestamp: February 04, 2019, 09:09:58 am
content: I personally use VScode for my stm32 development. I find printf's are great for pretty much all debugging and when i need to go into the debugger, i would rather attach to an already running session that has crashed or is experiencing problems, than sit there debugging from program init. I have sounds that the coretex-debug extension is great for this as you can either launch (download the code and start from main()) or attach (just attach the debugger to an already running session).However the TrueStudio IDE, which is free for stm32 processors, hasgreatadvanced debugging capabilities. I will quite often switch to this especially around hardfaults etc as truestudio will automatically break on hardfaults and tell you the hardfault reason and the stack pointers and program counters and all that without having to look at or decode any registers. Its super useful.Its based on eclipse, and similar to the system workbench discussed above, just a little bit more integrated and polished.