FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


manage:software

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manage:software [2019/08/15 19:56]
mmurray
manage:software [2019/12/03 22:38] (current)
jfduval [CLion]
Line 1: Line 1:
-<​markdown>​ +====== Getting started with Dephy STM32 projects ======
-STM32 Repository for FlexSEA devices+
  
-## Setup+===== Overview =====
  
-### Windows+This page will get you up and running to write code for any STM32 microcontroller in a Dephy product. Over the course of the document we will cover installing the necessary tools, how to build the project for different applications and boards, and finally how to load the software onto the device. To lean more about the build system refer to [[manage:​build_system|Dephy Build System]].
  
-*Install/​download prerequisites*+===== Setup =====
  
-#### GNU Arm Embedded Toolchain: 7-2018-q2-update +==== WindowsInstall/​download ​prerequisites ====
-- Navigate to this link in a web browser: https://​developer.arm.com/​tools-and-software/​open-source-software/​developer-tools/​gnu-toolchain/​gnu-rm/​downloads +
-- Download Windows ZIP download ​of 7-2018-q2-update +
-    + Make sure you get the correct version!!! +
-- Extract the downloaded contents to a path with no spaces i.e. C:​\toolchains\gcc-arm-none-eabi-7-2018-q2-update-win32\+
  
-#### CMake +=== GNU Arm Embedded Toolchain: 7-2018-q2-update === 
-Download CMake from this link: https://cmake.org/download/ +  * Navigate to this link in a web browser: https://developer.arm.com/tools-and-software/open-source-software/​developer-tools/​gnu-toolchain/​gnu-rm/​downloads 
-- Download ​the latest binary distribution for your Windows ​platform +  * Download Windows ​ZIP download of 7-2018-q2-update 
-Run the .msi installer and proceed through the steps +    ​Make sure you get the correct version! 
-    ​Make sure to select ​the "Add CMake to the system PATH" option when prompted +  * Extract ​the downloaded contents ​to a path with no spaces i.e. C:​\toolchains\gcc-arm-none-eabi-7-2018-q2-update-win32\
-- If not done during the installation process, add the location of the CMake installation folder ​to the system path +
-- Links can disappear so known source of instructions is using a search engine like google to search "add directory to path windows"​+
  
-#### Ninja +=== CMake === 
-- Navigate to this link in a web browser: https://github.com/ninja-build/ninja/​releases +  * Download CMake from this link: https://cmake.org/download
-Download the version ​for your platform ​and extract ​the zip filePlace the file in a folder in the Program Files directory (i.e. C:\Program Files\ninja-win\) +  ​* ​Download the latest binary distribution ​for your Windows ​platform 
-Add the location of the ninja installation folder to the system path +  * Run the .msi installer and proceed through ​the steps 
-Links can disappear so the known source of instructions is searching ​"add directory to path windows"​+    * Make sure to select the "Add CMake to the system PATH" option when prompted 
 +  * If not done during the installation process, add the location of the CMake installation folder to the system path 
 +  ​* ​Links can disappear so known source of instructions is using a search engine like Google to search ​"add directory to path windows"​
  
-#### Clone this repository +=== Ninja === 
-- Download and install Git Bash https://gitforwindows.org+  * Navigate to this link in a web browser: ​https://github.com/​ninja-build/​ninja/releases 
-- During installation,​ be sure to select ​the "​Associate ​.sh files to be run with Bash" at the Select Components screen. +  * Download ​the version for your platform and extract the zip filePlace the file in folder ​in the Program Files directory (i.e. C:\Program Files\ninja-win\) 
-- Open Git Bash terminal ​in the desired ​folder ​and run the following command: +  * Add the location of the Ninja installation ​folder ​to the system path 
-``` +  * Links can disappear so the known source of instructions is searching "add directory to path windows"​
-git clone --recursive https://​github.com/​DephyInc/​FlexSEA-Embedded-STM.git +
-```+
  
-### Linux+=== Clone this repository === 
 +  * Download and install Git Bash https://​gitforwindows.org/​ 
 +  * During installation,​ be sure to select the "​Associate .sh files to be run with Bash" at the Select Components screen. 
 +  * Open a Git Bash terminal in the desired folder and run the following command: 
 +  <​code>​git clone --recursive https://​github.com/​DephyInc/​FlexSEA-Embedded-STM.git</​code>​
  
-*Install/​download prerequisites*+==== Linux: ​Install/​download prerequisites ​====
  
-#### GNU Arm Embedded Toolchain: 7-2018-q2-update +=== GNU Arm Embedded Toolchain: 7-2018-q2-update ​=== 
-Navigate to this link in a web browser: https://​developer.arm.com/​tools-and-software/​open-source-software/​developer-tools/​gnu-toolchain/​gnu-rm/​downloads +  ​* ​Navigate to this link in a web browser: https://​developer.arm.com/​tools-and-software/​open-source-software/​developer-tools/​gnu-toolchain/​gnu-rm/​downloads 
-Download Linux 64-bit download of 7-2018-q2-update +  ​* ​Download Linux 64-bit download of 7-2018-q2-update 
-Install cmake and ninja:+  ​* ​Install cmake and ninja: 
 +  <​code>​sudo apt-get install cmake ninja-build</​code>​
  
-``` +  * Clone this repository: 
-sudo apt-get install cmake ninja-build +  <​code>​git clone --recursive https://​github.com/​DephyInc/​FlexSEA-Embedded-STM.git</​code>​
-```+
  
-- Clone this repository:+===== Building Target Applications ===== 
 +This project is built using CMake so technically it is possible to build directly from the command line using only CMake but below are 3 easier ways to work with the project. If you prefer to use an IDE CLion is a great choice as it is entirely built around using CMake and has a number of great features. It is normally $199 but it is possible to get a free license if you are a student or professorhttps://​www.jetbrains.com/​student/​. System Workbench from STMicroelectronics also works and has all necessary tools for working with STM32 microcontrollers bundled with the IDE (Eclipse). However Eclipse prefers to generate its own Makefiles so there can be issues using CMake but as of 8/2/2019 we did find a plugin that works fine and instructions are below. The other main option is to build and download the project using the included bash script. This is best if you prefer to use your favorite text editor like Vim, Sublime, etc.
  
-``` +==== CLion ==== 
-git clone --recursive ​https://github.com/DephyInc/​FlexSEA-Embedded-STM.git +=== Install IDE === 
-```+  * Download and install CLion from this link: 
 +  * https://www.jetbrains.com/clion/download/ 
 +  * The fastest/​easiest installation is to use all default settings 
 +=== Setup Project === 
 +  * Navigate to the FlexSEA-Embedded-STM ​directory you previously cloned 
 +  * Copy the file named workspace_template.xml in the .idea directory of this repository and rename it workspace.xml (replace the existing workspace.xml file if it exists). Make sure that you now have a file called workspace.xml in the .idea directory, this is where the CMake profiles for different build targets are stored and it is very important to have. 
 +  * Copy the file named local_settings_template.sh in the main project directory of this repository and rename it local_settings.xml (replace the existing local_settings.sh file if it exists). Open it in a text editor and update the toolchain path. 
 +  * You're now ready to open CLion and finish the setup 
 +    * Open this project in CLion 
 +      * Navigate to File -> Open 
 +      * Navigate to the location of this repo on your PC 
 +    * Once CLion is open click File -> Import Settings... 
 +      * Navigate to the FlexSEA-Embedded-STM/​.idea/​settings.zip file and click OK 
 +      * CLion will now restart 
 +    * Once CLion is open again click File -> Settings... 
 +      * Click the Appearance & Behavior tab on the left 
 +      * Click on the Path Variables menu 
 +      * Click the * symbol on the right to add a new path variable with the following info: 
 +        * Name: TOOLCHAIN_PATH 
 +        * Value: /​path/​to/​the/​toolchain/​gcc-arm-none-eabi-7-2018-q2-update 
 +          * Your path will probably look like "​C:​\toolchains\gcc-arm-none-eabi-7-2018-q2-update"​ or "/​home/​dephy/​toolchains/​gcc-arm-none-eabi-7-2018-q2-update"​ 
 +  * Run CMake update (within CLion) to confirm that it sees your toolchain 
 +  * Congratulations,​ if you've been diligent in reading these instructions and these instructions are still accurate you should be good to go. 
 +=== Building === 
 +  * In the top right corner there should be a dropdown menu with build targets 
 +    * Click the drop down then click on fx_manage 
 +    * You can the select the build target, current options include Exo-rigid2.0-left,​ ActPack-rigid2.0,​ etc
 +  * CLion will attempt to compile the project and compile output should appear in the window at the bottom
  
-## Building Target Applications +==== Bash script ==== 
-This project is built using cmake so technically it is possible to build directly from the command line using only cmake but below are 3 easier ways to work with the projectIf you prefer ​to use an IDE CLion is great choice as it is entirely built around using cmake and has number ​of great featuresIt is normally $199 but it is possible to get free license if you are a student or professor: https://www.jetbrains.com/student/. System Workbench from STMicroelectronics also works and has all necessary tools for working with STM32 microcontrollers bundled ​with the IDEHowever Eclipse prefers to generate its own Makefiles so there can be issues using cmake but as of 8/2/2019 we did find a plugin that works fine and instructions are below. The other main option is to build and download the project using the included bash script. This is best if you prefer to use your favorite text editor like Vim, Sublime, etc.+=== First Time === 
 +  * Copy the file in the root directory of the cloned repo called local_settings_template.sh to a new file named local_settings.sh 
 +  * Open local_settings.sh in text editor 
 +  * Change the value of TOOLCHAIN_DIR to the path where the GNU Arm Toolchain was installed 
 +    * On Windows make sure the path does not have spaces!  
 +=== General Usage === 
 +  * Open Bash terminal (on Windows use Git Bash) and enter the root directory of this repository. 
 +  * Running the command ​./manage_builder.sh with no arguments will print some of the possible build targets. 
 +  * In the root directory these are some of the commands that can be run:
  
-### CLion +  ./​manage_builder.sh ActPack-rigid1.0 
-##### Setup +  ./manage_builder.sh ActPack-rigid0.download 
-Download and install CLion from this link: +  ./manage_builder.sh Exo-rigid2.0 
-- https://www.jetbrains.com/clion/download/ +  ./manage_builder.sh Exo-rigid3.0-left
-- The fastest/easiest installation is to use all default settings +
-Copy the file named workspace_template.xml in the .idea directory of this repository and rename it workspace.xml (replace the existing workspace.xml file if it exists). Make sure that you now have a file called workspace.xml in the .idea directory, this is where the cmake profiles for different build targets are stored and it is very important to have+
-- You're now ready to open CLion and finish the setup +
-    + Open this project in CLion +
-        + Navigate to File -> Open +
-        + Navigate to the location of this repo on your PC +
-    + Once CLion is open click File -> Settings... +
-    + Click the Apperarance & Behavior tab on the left +
-    + Click on the Path Variables menu +
-    + Click the + symbol on the right to add a new path variable with the following info: +
-        + Name: TOOLCHAIN_PATH +
-        + Value: ​/path/​to/​the/​toolchain/​gcc-arm-none-eabi-7-2018-q2-update +
-            + your path will probably look like "​C:​\toolchains\gcc-arm-none-eabi-7-2018-q2-update"​ or "/​home/​dephy/​toolchains/​gcc-arm-none-eabi-7-2018-q2-update"​ +
-- Congratulations,​ if you've been diligent in reading these instructions and these instructions are still accurate you should be good to go. +
-##### Building +
-- In the top right corner there should be a dropdown menu with build targets +
-    + Click the drop down then click on fx_manage +
-    + You can the select the build target, current options include ​Exo-rigid2.0-left, ActPack-rigid2.0,​ etc. +
-- CLion will attempt to compile the project and compile output should appear in the window at the bottom+
  
-### Bash script +The basic format of the arguments is APP-HARDWARE_PLATFORM but subproject can be added with an additional ​symbol as seen in the last example and download can be added to the end of the arguments to also flash a device.
-##### First Time +
-- Copy the file in the root directory of the cloned repo called local_settings_template.sh to a new file named local_settings.sh +
-- Open local_settings.sh in a text editor +
-- Change the value of TOOLCHAIN_DIR to the path where the GNU Arm Toolchain was installed.  +
-  + On Windows make sure the path does not have spaces!  +
-##### General Usage +
-- Open a Bash terminal (on Windows use Git Bash) and enter the root directory of this repository. +
-- Running the command ./​manage_builder.sh with no arguments will print some of the possible build targets. +
-- In the root directory these are some of the commands that can be run: +
-``` +
-./​manage_builder.sh ActPack-rigid1.0 +
-./​manage_builder.sh ActPack-rigid0.2 download +
-./​manage_builder.sh Exo-rigid2.0 +
-./​manage_builder.sh Exo-rigid3.0-left +
-``` +
-The basic format of the arguments is APP-HARDWARE_PLATFORM but subproject can be added with an additional ​symbol as seen in the last example and download can be added to the end of the arguments to also flash a device.+
  
 These options can be added as build configurations for CLion or Eclipse. These options can be added as build configurations for CLion or Eclipse.
  
-## Downloading firmware to target+===== Downloading firmware to target ​=====
  
-Both a .hex and a .bin file are generated in the build directory after compiling an application. This is the firmware image and the only difference between the hex and bin files are the format.+Both a .hex and a .bin file are generated in the build directory after compiling an application. This is the firmware image and the only difference between the hex and bin files are the format. They can be used interchangeably.
  
-#### Windows +==== Windows ​==== 
-stlink is a command line utility for flashing STM32s +  ​* ​stlink is a command line utility for flashing STM32s 
-Download the stlink Windows zip from the following link: https://​github.com/​texane/​stlink/​releases/​tag/​1.3.0 +  ​* ​Download the stlink Windows zip from the following link: https://​github.com/​texane/​stlink/​releases/​tag/​1.3.0 
-Extract the contents of the zip file to C:\ +  ​* ​Extract the contents of the zip file to C:\ 
-Add the location of the stlink bin folder to the PATH (i.e. C:​\stlink-1.3.0-win64\bin) +  ​* ​Add the location of the stlink bin folder to the PATH (i.e. C:​\stlink-1.3.0-win64\bin) 
-Connect the ST-Link programmer to the programming header of the target device +  ​* ​Connect the ST-Link programmer to the programming header of the target device 
-For example, running the following command will flash manage on a rigid board: +  ​* ​For example, running the following command will flash manage on a rigid board:
-``` +
-./​manage_builder.sh Exo-rigid3.0-left download +
-``` +
-#### Windows (Optional GUI) +
-- Download ST-LINK Utility +
-- https://​www.st.com/​en/​development-tools/​stsw-link004.html +
-- Connect the ST-Link programmer to the programming header of the target device +
-- Open ST-LINK Utility, open the .bin file in the build directory, and flash the device+
  
-#### Linux +  ​./​manage_builder.sh Exo-rigid3.0-left download
-- stlink is a command line linux utility for flashing STM32s +
-``` +
-git clone https://​github.com/​texane/​stlink.git +
-``` +
-- On ubuntu it may be necessary to download the repo and compile +
-- After you have a copy of the st-flash binary add it to your path +
-  - The easiest way is to append it to the PATH variable in the bottom of your ~/.bashrc file +
-- running this command will flash manage on a rigid board +
-``` +
-./​manage_builder.sh Exo-rigid3.0-left download +
-``` +
-## Troubleshooting! +
-1. Make sure you made a local_settings.sh file in the root of the repo with the correct path to your compiler. +
-``` +
-/bin/bash manage_builder.sh ActPack-rigid2.0 +
-Please copy local_settings_template.sh to local_settings.sh! +
-Process finished with exit code 0 +
-``` +
-2. CMake or Ninja not found - make sure you installed these tools and added to your path! +
-3. Triple check you have the right compiler version (7-2018-q2-update)+
  
-</markdown>+=== Windows (Optional GUI) === 
 +  * Download ST-LINK Utility 
 +  * https://​www.st.com/​en/​development-tools/​stsw-link004.html 
 +  * Connect the ST-Link programmer to the programming header of the target device 
 +  * Open ST-LINK Utility, open the .bin file in the build directory, and flash the device 
 +  * More information can be found here: [[:​actpackfirmware|Actuator Package Firmware Update]] 
 + 
 +==== Linux ==== 
 +  * stlink is a command line linux utility for flashing STM32s 
 + 
 +  ​<code>git clone https://​github.com/​texane/​stlink.git</​code> 
 + 
 +  * On Ubuntu it may be necessary to download the repo and compile 
 +  * After you have a copy of the st-flash binary add it to your path 
 +    * The easiest way is to append it to the PATH variable in the bottom of your ~/.bashrc file 
 +  * Running this command will flash manage on a rigid board 
 + 
 +  <​code>​./​manage_builder.sh Exo-rigid3.0-left download</​code>​ 
 + 
 +===== Troubleshooting! ===== 
 +  * Make sure you made a local_settings.sh file in the root of the repo with the correct path to your compiler. 
 + 
 +  /bin/bash manage_builder.sh ActPack-rigid2.0 
 +  Please copy local_settings_template.sh to local_settings.sh! 
 +  Process finished with exit code 0 
 + 
 +  * CMake or Ninja not found? Make sure you installed these tools and added to your path! 
 +  * Triple check you have the right compiler version (7-2018-q2-update)
  
manage/software.1565899012.txt.gz · Last modified: 2019/08/15 19:56 by mmurray