diff --git a/USAGE.md b/USAGE.md new file mode 100644 index 0000000..1a6ee9f --- /dev/null +++ b/USAGE.md @@ -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. \ No newline at end of file diff --git a/src/xyz/elmot/clion/cubemx/ConvertProject.java b/src/xyz/elmot/clion/cubemx/ConvertProject.java index 74e21b9..7ce71c0 100644 --- a/src/xyz/elmot/clion/cubemx/ConvertProject.java +++ b/src/xyz/elmot/clion/cubemx/ConvertProject.java @@ -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']";