Author Topic: IDE for offline Mbed (Mbed CLI) project  (Read 4118 times)

0 Members and 1 Guest are viewing this topic.

Offline ANTALIFETopic starter

  • Frequent Contributor
  • **
  • Posts: 521
  • Country: au
  • ( ͡° ͜ʖ ͡°)
    • Muh Blog
IDE for offline Mbed (Mbed CLI) project
« on: February 04, 2019, 03:01:34 am »
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 Code


UPDATE 1: Found a couple of tutorials on how to export Mbed CLI projects to other IDE's, Mbed 2 & Mbed 5

UPDATE 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
############################################################
« Last Edit: February 20, 2019, 06:04:34 am by ANTALIFE »
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2332
  • Country: 00
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #1 on: February 04, 2019, 03:09:13 am »
Mbed is based on Keil arm compiler

http://www.keil.com/
 

Offline ANTALIFETopic starter

  • Frequent Contributor
  • **
  • Posts: 521
  • Country: au
  • ( ͡° ͜ʖ ͡°)
    • Muh Blog
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #2 on: February 04, 2019, 03:13:24 am »
Mbed is based on Keil arm compiler

http://www.keil.com/

The more you know. It looks like Arm Development Studio is quite hefty in price, guess I should have added a free IDE
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2332
  • Country: 00
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #3 on: February 04, 2019, 04:32:21 am »
 

Offline lollandster

  • Contributor
  • Posts: 40
  • Country: no
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #4 on: February 04, 2019, 04:43:40 am »
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.
 

Offline ANTALIFETopic starter

  • Frequent Contributor
  • **
  • Posts: 521
  • Country: au
  • ( ͡° ͜ʖ ͡°)
    • Muh Blog
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #5 on: February 04, 2019, 05:35:45 am »
Can be free

http://www2.keil.com/stmicroelectronics-stm32/mdk

Looks like my MCU family does not get a free licence


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.

Thanks 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
 

Offline lucazader

  • Regular Contributor
  • *
  • Posts: 221
  • Country: au
Re: IDE for offline Mbed (Mbed CLI) project
« Reply #6 on: February 04, 2019, 09:09:58 am »
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, has great advanced 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->