Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

Commit

Permalink
Documentation added.
Browse files Browse the repository at this point in the history
  • Loading branch information
elmot committed Oct 23, 2017
1 parent ad59ec7 commit 00ca509
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Purpose
===

The plugin supports two different, almost unrelated features:
* Conversion STM32CubeMX projects to CLion-capable _cmake_ project
* Downloading and debugging binaries onto MCU chips using [OpenOCD](http://openocd.org/)

You can use only one the second parts, if you develop something unrelated to ST products.

Disclaimer
===
You are doing everything at your own risk. Nor me, nor JetBrains, nor anybody else takes any
responsibility in case of any direct or indirect damages or losses.

Prerequisites
===
You will need following tolls being installed and configured:

* Compatible hardware, virtually any of [STM32 development boards](http://www.st.com/en/evaluation-tools/stm32-mcu-eval-tools.html)
* [CLion](https://www.jetbrains.com/clion/). The project tested against CLion 2017.3 EAP.
* [GNU Arm Embedded Toolchain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm)
* [OpenOCD](http://openocd.org/)
* [STM32CubeMX](http://www.st.com/en/development-tools/stm32cubemx.html). After installation, do not forget
to download MCU support library for your MCU. See _Help -> Install new libraries_ there.
* **(Windows only)** [MinGW](http://www.mingw.org/)

Project creation and conversion HowTo
===
1. Run _STM32CubeMX_ and:
1. Choose your hardware
1. Configure it
1. In project settings, select name and location for the project.
1. In project settings, select **SW4STM32** as a toolchain.
1. Click **Generate Code**. This will generate Eclipse-style project stub with libraries and sources.
1. Run _Clion_ and:
1. Open the result folder of the previous step as a project. Ignore all the errors shown.
1. Select **Tools -\> Import STM32CubeMX project**. This will regenerate project files and reload _cmake_ configs.
1. Go to **File -\> Settings... -\> Build, Execution, Deployment -\> OpenOCD support** and configure all the
required tools locations and setting, including your board config file. If there is no suitable config among existing,
_OpenOCD_ predefined ones, write your own one and use that.
1. Select **Run -\> Edit Configurations...** and create your run config of type **OpenOcd Download & Run**

Now you can connect your board and start the run config. The code should be compiled and downloaded to the chip.
Also you are able to debug your project using the same run config.



While code writing
===
* Put all your source/include files under _Src_ and _Inc_ folders, respectively.
* In files, generated by **STM32CubeMX** all your code lines should be placed between of
`/* USER CODE BEGIN ??? */` and `/* USER CODE END ??? */` pseudo comments. **STM32CubeMX** keeps those pieces of
code untouched during code regeneration.
* Run **Import STM32CubeMX project** everytime after running **STM32CubeMX** code regeneration.
1 change: 1 addition & 0 deletions src/xyz/elmot/clion/cubemx/ConvertProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
public class ConvertProject extends AnAction {
//TODO CubeMX run
//Todo generate run configuration automatically

private static final String DEFINES_KEY = "gnu.c.compiler.option.preprocessor.def.symbols";
private static final String CONFIG_DEBUG_XPATH = ".//configuration[@artifactExtension='elf' and @name='Debug']";
Expand Down

0 comments on commit 00ca509

Please sign in to comment.