Skip to content

Triton-Robotics/TR-mbed

Repository files navigation

  __________                  __             __   ___   ____ ___   ______
 /_  __/ __ \      ____ ___  / /_  ___  ____/ /  |__ \ / __ \__ \ / ____/
  / / / /_/ /_____/ __ `__ \/ __ \/ _ \/ __  /   __/ // / / /_/ //___ \  
 / / / _, _/_____/ / / / / / /_/ /  __/ /_/ /   / __// /_/ / __/____/ /  
/_/ /_/ |_|     /_/ /_/ /_/_.___/\___/\__,_/   /____/\____/____/_____/   
                                                                                               

Table of Contents
Prerequisites
Setup
Flashing
Troubleshooting
Documentation

Prerequisites

We have setup guides for the major operating systems.

Please choose the appropriate setup guide for your operating system:


Setup

  1. Clone this repo:
git clone https://github.com/Triton-Robotics/TR-mbed.git

At this point, you may choose to diverge from the CLI setup guide and set up an IDE instead. Check out the setup instructions for CLion or VSCode. We higly recommend CLion.

  1. Configure CMake project. This should only be done once per project, or after editing any CMakeLists.txt:
cmake -S . -B cmake-build-debug -GNinja
  1. Build the desired target using your IDE or via CLI:
cmake --build cmake-build-debug --target TR-TestBench -j $(nproc)

Viable targets for build are: TR-Engineer, TR-Infantry, TR-Sentry, TR-Hero, and TR-TestBench


Flashing and building code

Finding the Makefile

  1. Go into the Makefiles folder, and copy the appropriate makefile for your operating system outside the folder (aka move it one level up in the directory). Also, rename it from Makefile-OS to Makefile for it to work with the terminal.

  2. Now, you can build your code with the following command:

make testbench-build

Note: If the makefile does not work with your system, contact an embed member or team lead for assistance since it might be an issue with the drive (your computer will not work with E drive, to which you have to change it to D in the makefile).

After completing all of this you can make and flash your code to the nucleo using make testbench-jlink, make hero-jlink, make infantry-jlink, and make sentry-jlink, or build with make infantry-build, make sentry-build, make hero-build, or make testbench-build. You should see a block with many numbers when the code is flashed. If you see a red text regarding "missing embed-tools" it is likely becuase you don't have the serial monitor downloaded which is not required to make and flash code.

Flashing to JLink

  1. Download the JLink software on your device (J-Link Software and Documentation pack and Ozone - The J-Link Debugger).

  2. Flash using the makefile, similar to the cmake setup:

make testbench-jlink

Flashing STM32 (Old Method)

  1. Locate the generated executable:

    eg. The built executable for TestBench will be present in cmake-build-debug/robots/TestBench/TR-TestBench.elf

  2. Flash the executable to the target device:

openocd -f board/st_nucleo_f4.cfg -c "program cmake-build-debug/robots/TestBench/TR-TestBench.elf verify reset exit"

For flashing device in WSL, see the WSL guide.

  1. View serial output:
mbed-tools sterm -b 115200

Intellisense and Formatting

Intellisense

we HIGHLY recommend using clangd instead of the microsoft C++ vscode extension

  1. Install the clangd (LLVM) vscode extension (you may be prompted to install clangd if you don't have it installed on your system)
  2. Copy .vscode/settings.json.example to .vscode/settings.json and adjust the relevant paths
  3. Disable the C/C++ (Microsoft) vscode extension !!!
  4. Enjoy a significantly better developer experience!

if you randomly have unexpected issues with intellisense you can try running cmake -S . -B cmake-build-debug -GNinja to reconfigure the project, generating compile_commands.json again which clangd relies on.

Formatting

Add the following to your user settings.json (ctrl + shift + p and select Preferences: Open User Settings (JSON))

    "[cpp]": {
        "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
    },

optionally also add the following to save on format

    "editor.formatOnSave": true,

Troubleshooting

See the Troubleshooting guide for common issues and solutions.


Debugging

See the Debugging guide on how to run the debugger using STM32CubeIDE

See the Ozone Debugger guide on how to run the debugger using the Ozone Debugger.


Documentation

See our generated doxygen.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 27