System Workbench STM32 + CubeMX: cookbook

God have came from heaven and finally partially finished our BIG problem! What? What is a problem???
Yes, problem is called "IAR, KEIL - so ugly IDE's, and where is good open source IDE?":)
I always wants free, open source IDE for STM32, multi platform with blackjack and yohoho!
Why I said that solution is partial? Because now we have free open source IDE, and proposed IDE is Eclipse,frankly speaking it is not best from IDE's, but, as said "there's no choice among stinking fish" :)

Anyway, now we have new toolchain, which must work "from the box". It's name is "System Workbench for STM32", you can download it from http://www.openstm32.org site, you just need to register and spend a little time to find download link on the site.
Now, another good news is that CubeMX can generate project for this toolchain. But, currently(and I hope situation will change to the best), there are bugs in procedure of importing generated project to eclipse environment.
Up to today(May 21 2015), procedure is like this(from openstm32.org forum, I've just added some comments and images)

You should

  • Create a new workspace (empty folder named, for example, myWS)
  • Generate CubeMX code in a subdirectory of this folder (that is in myWS\myPROJECT)

  • Open System Workbench for STM32, using myWSas workspace. The project explorer will be empty
  • Import the CubeMX-generated project:
  • File >> Import...
  • General >> Existing Projects into Workspace >> Next
  • Browse (should automatically select myWS). It should show just one project, named "myPROJECT Configuration", automatically selected
  • Click "Finish"

Now you have a working project; however there is a small potential problem: Your project is called "myPROJECT Configuration", and a name with a space in it is, at least, a burden (especially on Linux but also on Windows). So you should probably:

    Rename the generated files
  • Right click on project >> Properties
  • C/C++ Build >> Settings >>; Build Artifact
  • Suppress " Configuration" from the artifact name

OK
    Do not rename your project 
Eclipse seems to break all linked resources pointing to project-relative paths when the project is renamed...

Then you should have a working project that can be compiled correctly. However, the CubeMX-generated project do not include a board description with debug connection information: kind of MCU, debug probe, debug link. You thus can't debug as simply as usually.

One solution may be to create a debug configuration then select your debug script manually by:
  • Debug As >> Debug Configurations...
  • Create a Ac6 STM32 Debugging configuration
  • Choose your project and executable (if needed)
  • Select the Debugger tab
  • If there is a NO SCRIPT FOUND red error message (most surely currently) select the "Use local script" redio button
  • Provide a debug script by one of three means:
    • Browse to your System Workbench install directory, then plugins\fr.ac6.mcu.debug_1.1.0.201503121050\resources\openocd\scripts\board and look for the script for your board (you may find also some st-specific scripts in st_board)This is usually the way to use for a standard ST board (eval, disco or nucleo)
    • Manually search for a close board in the directory above then manually copy it to your project main directory, then browse to it and select it. This is usually a good way to go for a custom board that is very close to an ST board (often an EVAL board), including the same debug interface.
    • Get a custom board debug script created when creating a project using your custom board (may be a no-firmware project with an empty main program). You just have to copy the System Workbench-generated debug script in your project and browse to it.    This is usually convenient if you define your own board, create a custom board in a System Workbench-generated test project and want to reuse it in your CubeMX-generated project

Once your configuration is working, you can launch it by using the small "bug" button in the top toolbar (either click it directly or use the small arrow on its right to see the last valid debug configurations used). 
Why everything is so complex? Actually, I do not know, but anyway, this is very buggy solution, and I hope, that ST's developers fix all this issues ASAP!

Comments

Popular posts from this blog

u8g2 library usage with STM32 MCU

Use PCM5102 with STM32

RFFT in CMSIS DSP. Part 1.