Part 1 hardware configuration
1.1 Hardware preparation
oDrive V3.6-56V motherboard 1
12V 2.0A power adapter 1
micro USB cable 1
ST- Link 1
1.2 Hardware connection
The hardware connection is shown in the figure below:
One end of the micro USB cable is connected to the oDrive motherboard, and the other end is connected to the PC; the
12V power adapter is connected to the DC interface of the motherboard, and the PWR indicator is on after power on;
connect the ST-LINK to the motherboard, and connect the USB end of the ST-LINK PC, the indicator light is on.
1.3 ST-LINK and motherboard connection relationship
Part 2 Software Configuration
2.1 Prepare the development tools to be used
The oDrive development tools used are:
1. Python3: used to run the project build script
2. ST-Link/V2 Drivers: STLink/v2 programmer driver
3. Git for Windows: used for version management and the bash terminal that uses it
4. Visual Studio Code: Lightweight but powerful source code editor
5. Tup: Build system for invoking compilation commands
6. ARM GNU Compiler: For cross-compiling code
7. OpenOCD: Use and use STLink/v2 The programmer burns the
ODrive 8. GNU MCU Eclipse's Windows Build Tools: For project construction The
above tools can be downloaded from Q Group (732557609):
After downloading, unzip, the content is as follows
2.2 Install python related components
Enter
pip install PyYAML Jinja2 jsonschema in the command terminal and press Enter to
install the required python related components.
2.3 Install ST-Link/V2 Drivers
1. Click to unzip ST-Link/V2 Drivers
2. Select the unzip path to the pure English path.
Unzip ST-Link_Drivers.zip to generate the ST-Link_Drivers folder, enter the folder and double-click to run dpinst_amd64.exe and follow the prompts to keep the default installation.
3. Follow step 1, step 2 to install
2.4 Install Git for Windows
Double-click to install Git-2.25.0-64-bit.exe
1. Click next, as shown in Figure 1 below.
2. Select the installation path and click "Next", as shown in the figure below.
3. Select the installation component, it is recommended to check it by default and click next, as shown in Figure 2 below.
4. Click "Next", as shown in the figure below.
5. Click "Next", as shown in Figure 3 below.
6. The second configuration is recommended, click next, as shown in Figure 4 below.
7. Use the first item of the default option, click next, as shown in Figure 5 below.
8. Choose the first option and click next, as shown in Figure 6 below.
9. Select the default first option, click next, as shown in Figure 7 below.
10. Check the default first and second options, click install to install, as shown in Figure 8 below.
11. Wait for the installation to complete, as shown in the figure below.
12. After the installation is complete, click next, as shown in Figure 9 below.
At this point, the installation of Git for Windows is complete.
2.5 Install TUP
Unzip tup-latest.zip to C:\Program Files, and then add C:\Program Files\tup-latest to the system environment variable Path, as shown in the figure below.
2.6 Install ARM GNU Compiler
Unzip gcc-arm-none-eabi-7-2018-q2-update-win32.zip to C:\Program Files, and then add C:\Program Files\gcc-arm-none-eabi-7-2018-q2-update -win32\bin
address is added to the system environment variable Path, as shown in the figure below.
2.7 Install OpenOCD
Unzip OpenOCD.zip to C:\Program Files, and then add the address of
C:\Program Files\OpenOCD\0.10.0-13\bin
to the system environment variable Path, as shown in the figure below.
2.8 Install GNU MCU Eclipse's Windows Build Tools
Unzip gnu-mcu-eclipse-windows-build-tools-2.12-20190422-1053-win64.zip to C:\Program Files, and then copy
C:\Program Files\GNU MCU Eclipse\Build Tools\2.12-20190422-1053\ The bin
address is added to the system environment variable Path, as shown in the figure below.
2.9 Verify that the installation is correct
After everything is ready, you can open the command terminal and
run the following command to verify that the installation is correct:
-
arm-none-eabi-gcc --version
-
arm-none-eabi-gdb --version
-
openocd --version
-
tup --version
-
python --version
Part 3 Installation and Use of Visual Studio Code
3.1 Install Visual Studio Code
Click to install VSCodeUserSetup-x64-1.50.1.exe
1. Check Agree and click Next, as shown in Figure 1 below.
2. The default installation path, click Next, as shown in the figure below.
3. The default file name, click Next, as shown in the figure below
4. Check the Add to path option and click Next, as shown in Figures 2 and 3.
5. Click Install, as shown in Figure 4 below.
6. Click Finish, as shown in Figure 5 below.
3.2 Install the Visual Studio Code plug-in
The following 5 plugins need to be installed:
C/C++
Cortex-Debug
Include Autocomplete
Path Autocomplete
Auto Comment Blocks The
above 5 plugins are installed according to the following steps.
1. Open Visual Studio Code, open the plug-in library, as shown in Figure 1 below
2. Enter the plug-in name (for example, C/C++), as shown in Figure 2 below. Select the plug-in, as shown in Figure 3 below, and click install, as shown in Figure 4 below.
3. Wait for the download to complete, as shown in Figure 5 below
3.3 Configure the default terminal of Visual Studio Code
1. Configure git bash as the default terminal, click Terminal -> New Terminal, as shown in Figure 1 below.
2. Click the drop-down box and select Select Default Shell, as shown in Figures 2 and 3 below
3. A drop-down box pops up, select the option Git bash, as shown in Figure 4 below
4. After the configuration is complete, restart VS CODE, click Terminal -> New Terminal, and check if the configuration is successful
3.4 Compile the firmware source code, burn, debug
1. Unzip the firmware ODrive-fw-v0.5.1 to the pure English path
2. After decompression, find ODrive_Workspace.code-workspace in the ODrive-fw-v0.5.1 folder and
open it with VS CODE
3. Select the tup.config.default file, and then change the #CONFIG_BOARD_VERSION=v3.5-24V in the file to
CONFIG_BOARD_VERSION=v3.6-56V
and save it, as shown in Figures 1 and 2 below.
4. Right-click and select the tup.config.default file and rename it to tup.config, as shown in Figure 3 below.
5. Click Terminal -> Run Build Task… and wait for the compilation to complete, as shown in Figure 4 below
You can also enter and run the command make -j4 at the command side to compile the project
6. Compilation is complete, as shown in the figure below
7. Burn the firmware
Select Terminal -> Run Task… -> flash to burn the firmware.
You can enter the run command make flash at the command side to compile the project
8. After the burning is completed, the following picture is shown
9. Debugging After
burning is completed, the order of options is Run ->Start Debugging (or keyboard F5)
After entering the debugging state, as shown in the figure below
10. After debugging, you can press stop (Shift+F5) to stop debugging. At the same time it will automatically close openOCD
11.Clear the build file
Open the command terminal (View -> Terminal) and enter make clean in the command terminal and press Enter
This concludes the construction of the VSCODE development environment in the fourth lesson of oDrive, the maker base.
The corresponding video course can be downloaded in Q group (732557609), welcome to join.
Please continue to pay attention to follow-up courses.