Maker base oDrive fourth lesson VSCODE development environment construction

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.
Insert picture description here

1.3 ST-LINK and motherboard connection relationship

Insert picture description here

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):
Insert picture description here

After downloading, unzip, the content is as follows
Insert picture description here

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.
Insert picture description here

2.3 Install ST-Link/V2 Drivers

1. Click to unzip ST-Link/V2 Drivers
Insert picture description here
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.
Insert picture description here
3. Follow step 1, step 2 to install
Insert picture description here
Insert picture description here

2.4 Install Git for Windows

Double-click to install Git-2.25.0-64-bit.exe
Insert picture description here
1. Click next, as shown in Figure 1 below.
Insert picture description here
2. Select the installation path and click "Next", as shown in the figure below.
Insert picture description here
3. Select the installation component, it is recommended to check it by default and click next, as shown in Figure 2 below.
Insert picture description here
4. Click "Next", as shown in the figure below. Insert picture description here
5. Click "Next", as shown in Figure 3 below. Insert picture description here
6. The second configuration is recommended, click next, as shown in Figure 4 below.
Insert picture description here
7. Use the first item of the default option, click next, as shown in Figure 5 below.
Insert picture description here
8. Choose the first option and click next, as shown in Figure 6 below.
Insert picture description here
9. Select the default first option, click next, as shown in Figure 7 below.
Insert picture description here
10. Check the default first and second options, click install to install, as shown in Figure 8 below.
Insert picture description here
11. Wait for the installation to complete, as shown in the figure below.
Insert picture description here
12. After the installation is complete, click next, as shown in Figure 9 below.
Insert picture description here

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.
Insert picture description here

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.
Insert picture description here

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.
Insert picture description here

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.
Insert picture description here

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:

  1. arm-none-eabi-gcc --version
    Insert picture description here

  2. arm-none-eabi-gdb --version
    Insert picture description here

  3. openocd --version
    Insert picture description here

  4. tup --version
    Insert picture description here

  5. python --version
    Insert picture description here

Part 3 Installation and Use of Visual Studio Code

3.1 Install Visual Studio Code

Click to install VSCodeUserSetup-x64-1.50.1.exe
Insert picture description here

1. Check Agree and click Next, as shown in Figure 1 below.
Insert picture description here

2. The default installation path, click Next, as shown in the figure below.

Insert picture description here

3. The default file name, click Next, as shown in the figure below
Insert picture description here

4. Check the Add to path option and click Next, as shown in Figures 2 and 3.
Insert picture description here

5. Click Install, as shown in Figure 4 below.
Insert picture description here

6. Click Finish, as shown in Figure 5 below.
Insert picture description here

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
Insert picture description here

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.
Insert picture description here

3. Wait for the download to complete, as shown in Figure 5 below
Insert picture description here

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.
Insert picture description here

2. Click the drop-down box and select Select Default Shell, as shown in Figures 2 and 3 below

Insert picture description here

3. A drop-down box pops up, select the option Git bash, as shown in Figure 4 below
Insert picture description here

4. After the configuration is complete, restart VS CODE, click Terminal -> New Terminal, and check if the configuration is successful
Insert picture description here

3.4 Compile the firmware source code, burn, debug

1. Unzip the firmware ODrive-fw-v0.5.1 to the pure English path
Insert picture description here

2. After decompression, find ODrive_Workspace.code-workspace in the ODrive-fw-v0.5.1 folder and
open it with VS CODE
Insert picture description here

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.
Insert picture description here

4. Right-click and select the tup.config.default file and rename it to tup.config, as shown in Figure 3 below.
Insert picture description here

5. Click Terminal -> Run Build Task… and wait for the compilation to complete, as shown in Figure 4 below
Insert picture description here

You can also enter and run the command make -j4 at the command side to compile the project
Insert picture description here

6. Compilation is complete, as shown in the figure below
Insert picture description here

7. Burn the firmware
Select Terminal -> Run Task… -> flash to burn the firmware.
Insert picture description here

You can enter the run command make flash at the command side to compile the project
Insert picture description here

8. After the burning is completed, the following picture is shown

Insert picture description here

9. Debugging After
burning is completed, the order of options is Run ->Start Debugging (or keyboard F5)
Insert picture description here

After entering the debugging state, as shown in the figure below
Insert picture description here

10. After debugging, you can press stop (Shift+F5) to stop debugging. At the same time it will automatically close openOCD
Insert picture description here

11.Clear the build file
Open the command terminal (View -> Terminal) and enter make clean in the command terminal and press Enter

Insert picture description here

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.
Insert picture description here

Guess you like

Origin blog.csdn.net/gjy_skyblue/article/details/114131333