FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


manage:build_system

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:build_system [2019/10/07 12:48]
jfduval
manage:build_system [2020/05/25 15:28] (current)
Line 1: Line 1:
-====== Dephy Build System ======+====== Dephy Embedded ​Build System ======
  
 ===== Overview ===== ===== Overview =====
-This page provides information on how to work with Dephy'​s codebase to build existing projects as well as create new ones that will play nicely within the ecosystem.+This page provides information on how to work with Dephy'​s codebase to build existing projects as well as create new ones that will play nicely within the ecosystem. ​We are focusing on the embedded/​STM32 development.  
 +  * **Ready to build?** [[#Build firmware]] 
 +  * Looking for fx_plan_stack instructions?​ Please refer to [[:​build_fx_plan|Building fx_plan_stack from sources]] 
 +  * Looking for setup instructions (compiler, IDE, CMake, etc.)? [[manage:​software|Getting started with Dephy STM32 projects]]
  
 ===== Tools ===== ===== Tools =====
Line 14: Line 17:
 For these reasons we have migrated all Dephy STM32 firmware as well as Plan Stack to a CMake build system. For these reasons we have migrated all Dephy STM32 firmware as well as Plan Stack to a CMake build system.
  
-The full CMake documentation can be found here: https://​cmake.org/​cmake/​help/​v3.15/​manual/​cmake.1.html+The full CMake documentation can be found [[https://​cmake.org/​cmake/​help/​v3.15/​manual/​cmake.1.html|here]].
  
 Every CMake project has a CMakeLists.txt file in the root directory of the project. This file then may include other CMake files, but is typically the starting point for how the project gets compiled. To learn more about how CMake is being used in a specific project the best starting point can be to open the CMakeLists.txt and see what types of actions it performs. Every CMake project has a CMakeLists.txt file in the root directory of the project. This file then may include other CMake files, but is typically the starting point for how the project gets compiled. To learn more about how CMake is being used in a specific project the best starting point can be to open the CMakeLists.txt and see what types of actions it performs.
Line 24: Line 27:
 We have set up bash scripts that can be used to compile various parts of the system including Manage, Habsolute, BMS, Plan Stack, and the GUI. They allow for the automation of these types of tasks where all those applications mentioned can be compiled for all their target hardware platforms with a single command. Bash scripts are also useful for automated testing and other tasks as we get more into production. ​ We have set up bash scripts that can be used to compile various parts of the system including Manage, Habsolute, BMS, Plan Stack, and the GUI. They allow for the automation of these types of tasks where all those applications mentioned can be compiled for all their target hardware platforms with a single command. Bash scripts are also useful for automated testing and other tasks as we get more into production. ​
  
-Our bash scripts for the STM32 devices take an APP and HW_PLATFORM as the only two necessary parameters. Based on these pieces of information it can then automatically call CMake and Ninja.+By default, our bash scripts for the STM32 devices take an APP and HW_PLATFORM as the only two necessary parameters. Based on these pieces of information it can then automatically call CMake and Ninja. For some specific applications up to 4 parameters can be used.
  
 In addition to just compiling a single codebase for different targets it can also perform device configuration (like flashing an ID into flash) and running other scripts. Here are some examples of how our STM32 bash script can be used: In addition to just compiling a single codebase for different targets it can also perform device configuration (like flashing an ID into flash) and running other scripts. Here are some examples of how our STM32 bash script can be used:
Line 112: Line 115:
 If you are using CLion a CMake profile will need to be added. This menu can be accessed via File->​Settings->​Build,​Execution,​Deployment->​CMake If you are using CLion a CMake profile will need to be added. This menu can be accessed via File->​Settings->​Build,​Execution,​Deployment->​CMake
  
-You should see a list of profiles, or a blank list with +, -, ^, v, and copy options. If there is an existing profile for ActPack-rigid0.2 the easiest solution would be to use the duplicate button. Otherwise use the + button to add a new profile. You should then populate fields of the profile with something similar to what is in the picture below:+You should see a list of profiles, or a blank list with +, -, ^, v, and copy options. If there is an existing profile for ActPack-rigid0.2 the easiest solution would be to use the duplicate button. Otherwise use the + button to add a new profile. Please use build-clion/​ as your Generation Path (picture below using "​build"​ is outdated). You should then populate fields of the profile with something similar to what is in the picture below:
  
 {{manage:​actpack-rigid2.0.png}} {{manage:​actpack-rigid2.0.png}}
 +
 +Make sure to review the [[#​build_type|Build Type]] section! Known bug with Release mode.
  
 The key part are the CMake variables that are passed into CMake and are not found anywhere in the CMakeLists.txt or other CMake files. Here is a screenshot of what those parameters are for an ActPack-rigid2.0 app/board combo: The key part are the CMake variables that are passed into CMake and are not found anywhere in the CMakeLists.txt or other CMake files. Here is a screenshot of what those parameters are for an ActPack-rigid2.0 app/board combo:
Line 138: Line 143:
  
 If these instructions made any sense, are still valid, and you followed them correctly you should have (or are close to having) a great new CrazyExperiment app! If these instructions made any sense, are still valid, and you followed them correctly you should have (or are close to having) a great new CrazyExperiment app!
 +
 +===== Build firmware =====
 +==== Introduction ====
 +The lists below will give you the supported options as of 03/31/2020. To get the latest version please open up manage_builder.sh.
 +If you are used to the older version of the build system where all the action happened in build/ I recommend that you delete the folder first.
 +
 +**APP_TYPE:​**
 +  * ActPack
 +  * Exo
 +  * RobotTrouser
 +  * NewBoo
 +  * Habsolute
 +  * BMS
 +  * NetMaster
 +  * NetNode
 +
 +The actual list is longer, but the other projects are not currently documented.
 +
 +**HW_PLATFORM:​**
 +  * rigid0.1
 +  * rigid0.2
 +  * rigid1.0
 +  * rigid2.0
 +  * rigid3.0
 +  * habs0.2
 +  * habs0.3
 +  * bms_8S_0.3
 +  * bms_9S_0.1
 +  * bms_9S_0.2
 +  * bms_9S_0.3
 +  * netnode0.1
 +  * netmaster0.1
 +
 +**ACTIVE_SUBPROJECT:​**
 +  * left
 +  * right
 +
 +This is an optional variable. It is only useful for Exo, NewBoo and RobotTrouser projects. When not used, do not include.
 +
 +**AUGMENTED_JOINT:​**
 +  * ankle
 +  * knee
 +
 +This is an optional variable. It is only useful for NewBoo and RobotTrouser projects. When not used, do not include.
 +
 +==== Solo build - Bash ====
 +
 +The format for solo build is: <​code>​./​manage_builder.sh APP_TYPE-HW_PLATFORM-ACTIVE_SUBPROJECT-AUGMENTED_JOINT</​code>​
 +Examples:
 +  * <​code>​./​manage_builder.sh ActPack-rigid3.0</​code>​
 +  * <​code>​./​manage_builder.sh Exo-rigid3.0-right</​code>​
 +  * <​code>​./​manage_builder.sh NewBoo-rigid3.0-right-ankle</​code>​
 +
 +A folder with the full project name and configuration (ex.: NewBoo-rigid3.0-right-ankle) will be created under build-solo/​. The hex file will have the build date as a prefix, then the full name (ex.: 20200330-NewBoo-rigid3.0-right-ankle.hex).
 +Each solo build will create a new folder. It will not remove previous folders.
 +==== Solo build - CLion ====
 +
 +Running CMake in CLion will create one folder for each project under build-clion/​. The hex will not have the datecode nor the name, it will simply be named fx-manage.hex.
 +
 +==== Batch build - Bash ====
 +
 +The build system can support groups of projects. The current list is: 
 +  * build_all_actpack
 +  * build_all_bms
 +  * build_all_network
 +  * build_all_habsolute
 +  * build_all_exo
 +  * build_all_newboo
 +  * build_all_robottrouser
 +
 +The format for batch build is: <​code>​./​manage_builder.sh build_all_MyProject</​code>​
 +Example:<​code>​./​manage_builder.sh build_all_actpack</​code>​
 +
 +The projects will use the build-all/ folder as a temporary build folder. After each successful build, the hex file will be renamed and moved to hex/​BuildAllTemp. The build-all/ folder will be wiped, then the next project will be built.
 +If you start with an empty hex/​BuildAllTemp/​ folder and you call ''​build_all_actpack''​ you'll end up with:
 +{{ :​manage:​build_all_actpack.png?​400 |}}
 +
 +Another useful script is <​code>​./​manage_builder.sh build_all</​code>​ This one calls all the ''​build_all_MyProject''​ scripts sequentially. After running it you'll have:
 +{{ :​manage:​build_all.png?​400 |}}
 +
 +It is a very useful tool to make sure that your code changes did not break other projects. Please note that this will take minutes to run.
 +
 +==== Batch build - CLion ====
 +
 +Not tested yet, but technically you can configure CLion to run your own bash script. If this is useful to you reach out to me and I'll test.
 +
 +==== Build Type ====
 +
 +To compile you need to specify the Build Type. When using the command line, open the script with a text editor and search for DCMAKE_BUILD_TYPE inside and pick up any build type from the list below.
 +  * Debug 
 +  * Release
 +  * RelWithDebInfo
 +  * MinSizeRel
 +Due to a known issue, Release as build type is **not recommended**. It is known to cause major boot issues. Instead of Release, select either RelWithDebInfo or MinSizeRel for DCMAKE_BUILD_TYPE.
 +The same issue exists in CLion: use Debug if you are debugging, or RelWithDebInfo when you want to maximize performance.
manage/build_system.1570452522.txt.gz · Last modified: 2019/10/07 12:48 by jfduval