Skip to content

How to make Surf 5 Project in VS Code

How to make Surf 5 Project in VS Code

TheoIm

Published February 07, 2024

How to make Surf 5 Project in VS Code

Components

Hardware components Software Apps and online services

Project description

How to make Surf 5 Project in VS Code​

1. Launching VS Code​

Step 1

In 'Developer Command Prompt for VS 2022', you must call the code command to run VS Code. Execute 'Developer Command Prompt for VS 2022' in the Windows search bar below.

1. Launching VS Code ​




 

Step 2

Call the 'Code' command to execute VS Code.

1. Launching VS Code ​




 

Step 3

Load the project folder of Surf 5 in VS Code.

1. Launching VS Code ​






 

2. Installing Extensions in VS Code​

Search for and install the three extensions shown in the image below in the extension program search bar.

2. Installing Extensions in VS Code ​






 

3. Save the CMake Extension Settings for the stored workspace.​

Step 1

In CMake Tools, go to "the gear icon (settings) -> Extension Settings

3. Save the CMake Extension Settings for the stored workspace. ​



 

Step 2

enter "NMake Makefiles" in the "CMake: Generator" field. make sure to check the case sensitivity of "NMake Makefiles".

CMake: Generator
NMake Makefiles
 

3. Save the CMake Extension Settings for the stored workspace. ​






 

4. Modifying the contents of the 'arm-none-eabi-gcc.cmake' file​

Within the 'arm-none-eabi-gcc.cmake' file in the tools directory, you need to specify the 'ARM_TOOLCHAIN_DIR' path. 'ARM_TOOLCHAIN_DIR' is located inside the path where your GNU Arm Embedded Toolchain executable is installed. Find your path and enter it.

When setting the path, be sure to delete the backslash () and enter it as a slash (/).. You may refer to the example code below.

arm-none-eabi-gcc.cmake
set(ARM_TOOLCHAIN_DIR "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin")
 

4. Modifying the contents of the 'arm-none-eabi-gcc.cmake' file ​






 

5. Build Project in VS Code​

Step 1

Press the F1 key, and then click on "CMake: Select a Kit".

5. Build Project in VS Code ​




 

Step 2

click on "[Scan for Kits]".

5. Build Project in VS Code ​




 

Step 3

Select "GCC 10.x.x arm-none-eabi" to configure the kit.

5. Build Project in VS Code ​




 

Step 4

Click the "Build" button at the bottom or press F7 to start the build process.

5. Build Project in VS Code ​




 

Step 5

Once the build is completed, you will see a message like the one above in the OUTPUT window.

You will also be able to confirm that the Build directory has been created. The project folder within the Build directory contains the generated bin files. You can save these bin files to your Surf 5 and use the project.

5. Build Project in VS Code ​




 

Step 6

Flash the .bin file of the desired project in the 'build' directory to Surf 5 Project. If you want to know how to flash .bin files to Surf 5, refer to How to use ISP tool

5. Build Project in VS Code ​






 

[How to solve Surf 5 build error in VS Code]​

If the build is still not working despite configuring Visual Studio Code settings, follow the steps below.



 

Before solving the error, Did you by any chance not install the programs required to build the Surf 5 project in VS Code?

Please check the following link to ensure that the programs needed for the build have not been installed.

How to install VS Code for Surf 5





 

Step 1

Please recheck the path for the code section marked in red in the photo below. And when writing the code, make sure to enter the path with slashes(/) instead of backslashes.

[How to solve Surf 5 build error in VS Code] ​





 

Step 2

Click on the gear icon of the CMake Tools extension pack to go to 'Extension Settings'. Check if the code in the 'CMake: Generator' section is 'NMake Makefiles' as shown in the photo below. Also, make sure to enter this code with the exact case sensitivity.

[How to solve Surf 5 build error in VS Code] ​





 

Step 3

Next, delete the "Build" directory. Deleting this directory should not pose any issues for the build process.

[How to solve Surf 5 build error in VS Code] ​





 

Step 4

Press the F1 key, and then click on "CMake: Select a Kit".

[How to solve Surf 5 build error in VS Code] ​




 

Step 5

Select "GCC 10.x.x arm-none-eabi" to configure the kit.

[How to solve Surf 5 build error in VS Code] ​





 

Step 6

Rebuild now. If you have completed the four steps above perfectly, try building the project again within VS Code.



GCC 10.x.x arm-none-eabi' compiler is not appearing

This issue may be due to the compiler's path not being added to the environment variables during installation. Follow the steps below to add the path of the compiler.



 

Search for 'View advanced system settings' in the Windows search bar and click on it.

[How to solve Surf 5 build error in VS Code] ​




 

In System Properties, click on 'Environment Variables ...' below.

[How to solve Surf 5 build error in VS Code] ​




 

Select 'Path' in the 'User variables for xxx' category and press 'Edit...'

[How to solve Surf 5 build error in VS Code] ​




 

Press 'New' to add the toolchain directory and press 'OK'.

[How to solve Surf 5 build error in VS Code] ​




 

If you have added the variable, restart your PC or laptop.

[How to solve Surf 5 build error in VS Code] ​




 

In 'Developer Command Prompt for VS 2022', you must call the code command to run VS Code.

[How to solve Surf 5 build error in VS Code] ​

 [How to solve Surf 5 build error in VS Code] ​


 

And in VS Code, load Surf 5 project and press 'F1' and click on 'CMake: Select a Kit'.

[How to solve Surf 5 build error in VS Code] ​




 

Click on [Scan for Kits].

[How to solve Surf 5 build error in VS Code] ​




 

Check the added compiler below and build it.

[How to solve Surf 5 build error in VS Code] ​









 

Comments

Comments