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/06/06 15:47]
kandoni Update repo name
manage:software [2020/05/28 20:44] (current)
jmooney [Windows: Install/download prerequisites]
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+
  
-#### 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 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 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 
-``` +  * 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\) 
-git clone --recursive https://github.com/​DephyInc/​FlexSEA-Embedded-STM.git +  * 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"​
  
-### 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 (access required; given on an as needed basis): 
 +  <​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.
  
-``` +**Recommended IDE:** 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 featuresYou can experiment with a demo license first, then ask your manager for a subscription.
-git clone --recursive https://github.com/​DephyInc/​fx-rigid-m7.git +
-```+
  
-## Building Target Applications+**Free IDE:** 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. This is only recommended for external clients, not for internal development.
  
-### First Time+**Command line (Bash script):** 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.
  
-- Copy the file in the root directory of the cloned repo called local_settings_template.sh to a new file named local_settings.sh +==== CLion ==== 
-Open local_settings.sh in a text editor +=== Install IDE === 
-Change the value of TOOLCHAIN_DIR to the path where the GNU Arm Toolchain was installed.  +  * Download and install CLion from this link: 
-  ​+ ​On Windows make sure the path does not have spaces! ​+  * 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. 
 +  * Download MinGW following this link if you haven'​t downloaded it before 
 +  * http://​dephy.com/​wiki/​flexsea/​doku.php?​id=installbuildtoolswindows&​s[]=mingw#​mingw-w64  
 +  * 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 
 +=== Build Types === 
 +If you are using CLion, navigate to CMake configuration menu which can be accessed via File→Settings→Build,​Execution,​Deployment→CMake 
 +  * For debug mode 
 +    * Select the profile you are working on and change build type to Debug 
 +  * For release mode 
 +    * Select the profile you are working on and change build type to RelWithDebInfo or MinSizeRel. Due to a known issue, **never pick up Release** here as build type since it causes malfunction. See [[manage:​build_system#​build_type|Build Type]] for more info. 
 +=== Exchanging Build/​Projects Settings === 
 +It is common to exchange your project settings with team members. workspace.xml contains that information in plain text form. Look for the ''<​component name="​CMakeSettings"​ AUTO_RELOAD="​true">''​ section. Add configurations as needed, and save the file. It will auto-reload and the list of projects will be accessible in the CMake settings as well as the drop-wodn Build menu. 
 +==== Bash script ==== 
 +=== 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:
  
-### General Usage+  ./​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 project can be built from the command line or with an IDE like CLion or Eclipse. +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. For more examples and instructions refer to [[manage:​build_system#​build_firmware|Build Firmware]].
- +
-IDE target configurations are being setup now so the current way to see, use on command line, or add them to an IDE are by opening a Bash terminal (on Windows use Git Bash) and entering the root directory of this repository. +
- +
-Running the command ./build.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: +
- +
-``` +
-./build.sh ActPack-rigid1.0 +
-./build.sh ActPack-rigid0.2 download +
-./build.sh Exo-rigid2.0 +
-./build.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. +
- +
-### Windows +
-- 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 +
-- 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) +
-- 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: +
- +
-``` +
-./build.sh Exo-rigid3.0-left download +
-``` +
- +
-### Windows (Optional GUI)+
  
-- Download ST-LINK Utility +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.
-- 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 directoryand flash the device +
-### Linux+
  
-stlink is a command line linux utility for flashing STM32s+==== Windows ==== 
 +  * stlink is a command line utility for flashing STM32s 
 +  * Download the stlink Windows zip from the following link: https://​github.com/​stlink-org/​stlink/​releases/​tag/​v1.3.0 
 +  * 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) 
 +  * 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:
  
-``` +  ./manage_builder.sh Exo-rigid3.0-left download
-git clone https://github.com/​texane/​stlink.git +
-```+
  
-- On ubuntu it may be necessary to download the repo and compile +=== Windows (Optional GUI) === 
-After you have a copy of the st-flash binary add it to your path +  * Download ST-LINK Utility 
-  - The easiest way is to append it to the PATH variable in the bottom ​of your ~/.bashrc file +  * https://​www.st.com/​en/​development-tools/​stsw-link004.html 
-running this command will flash manage on a rigid board+  ​* 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 ==== 
-./build.sh Exo-rigid3.0-left download +  * stlink is a command line linux utility for flashing STM32s
-```+
  
-## IDE Integration+  <​code>​git clone https://​github.com/​texane/​stlink.git</​code>​
  
-The bash script above can be used to build any of the projects, but they can also be built and run with debugger ​in an IDE.+  * On Ubuntu it may be necessary ​to download ​the repo and compile 
 +  * After you have 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
  
-### CLion+  <​code>​./​manage_builder.sh Exo-rigid3.0-left download</​code>​
  
-#### Setup+===== Setting up and using the debugger in CLion =====
  
-Download and install CLion from this link: +Clion fully supports step-by-step debugging using GDB/OpenOCD/STLink-v2 or v3.
-https://www.jetbrains.com/​clion/​download/​ +
-The fastest/​easiest is to use all default settings +
-- Open CLion and install Bash support to use our build scripts +
-    + Click File -> Settings... +
-    + Click the Plugins tab on the left +
-    + Under BashSupport click the Install button +
-    + After installation restart CLion +
-    + Once CLion is open again click File -> Settings ... +
-    + Under the Languages & Frameworks section select BashSupport +
-    + Fill out the default interpreter field (this is the location of the bash executable) +
-        * Enter the location of bash.exe for Windows +
-            - Often times C:\Program Files\Git\bin\bash.exe +
-        * For linux it will usually be /bin/bash +
-- TODO: need to test on fresh machine and finalize this section+
  
-#### Building+  - Only follow this section after you have completed the general Setup and the CLion Setup steps. 
 +  - Settings > Build, Execution, Deployment > Toolchains > set the debugger to be "​arm-none-eabi-gdb.exe"​ with the proper path (ex.: ''​C:​\toolchains\7-2018-q2-update\bin\arm-none-eabi-gdb.exe''​) 
 +  - Run/Debug Configurations > OpenOCD Download and Run 
 +    * Target and Executable need to be fx-manage 
 +    * Pick a board config file. \FlexSEA-Embedded-STM\config\debugging\fx-rigid-f4-openocd.cfg works. Using the Discovery files that came with OpenOCD is also OK. 
 +    * User preference, but Download Always and Reset Init work well
  
-- Open this project in CLion +{{ :​manage:​dbg.png?​400 |}} 
-    + Navigate to File -> Open +===== Troubleshooting! ===== 
-    + Navigate to the location of this repo on your PC +  * Make sure you made local_settings.sh file in the root of the repo with the correct path to your compiler.
-- In the top right corner there should be dropdown menu with build targets +
-    + Current options include Exo-rigid2.0, ActPack-rigid2.0,​ etc. +
-    + Select the desired build option and to build click the green run arrow to the right of the drop down menu of the targets +
-- CLion will attempt ​to compile the project and compile output should appear in the window at the bottom+
  
-##### Troubleshooting! +  ​/​bin/​bash ​manage_builder.sh ActPack-rigid2.0 
-1. Make sure you made a local_settings.sh file in the root of the repo with the correct path to your compiler. +  Please copy local_settings_template.sh to local_settings.sh! 
-``` +  Process finished with exit code 0
-/​bin/​bash ​build.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)+
  
-#### Debugging +  * CMake or Ninja not found? Make sure you installed these tools and added to your path! 
-</​markdown>​+  * Triple check you have the right compiler version (7-2018-q2-update)
  
manage/software.1559836063.txt.gz · Last modified: 2019/06/06 15:47 by kandoni