Contributed by jkernet, curated by Ai-Thinker
Preface
First of all, thanks to the garden master, thanks for the garden master's dev boards and modules. Since the board hadn't arrived yet, I couldn't wait and decided to set up the development environment first. I'm not very familiar with Linux, so I decided to develop on Windows. Although Win12 is almost out, I'm still using Win7. But it probably won't last much longer — many software packages no longer support Win7. The setup process below is all based on Win7; other system versions are for reference only.
If you haven't set up the compilation environment for the development library yet, if you're using Windows, and if you don't want tedious configuration and mutually interfering compilation environments, you can use this small tool I wrote to set things up quickly.
(Please run it as administrator)
Checklist
Xiao An Pai development library https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git (when cloning after 2024.5.1, add -b master to select the main branch)
Bouffalo compilation tools https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git
Git version control tool https://git-scm.com/downloads
TortoiseGit Git GUI tool https://tortoisegit.org/
RapidEEx environment variable editor https://www.rapidee.com/en/about
Visual Studio Code 1.70.2 code editor https://update.code.visualstudio.com/1.70.2/win32-x64/stable (the last version supporting Win7)
Installing Tools
1. Git Version Control Tool https://git-scm.com/downloads
The Xiao An Pai development library is hosted on GitHub and Gitee, both of which use Git for version control, so you need to download and install a Git client to fetch the development library.
Open the website, click to download the latest version, and you'll be taken to the download page.

It is recommended to choose the installer version (it has a configuration wizard). Select the download link according to the bitness of your operating system. I have a 64-bit system; some friends use 32-bit Win7. A 64-bit system can run 32-bit software, but a 32-bit system cannot run 64-bit software.

The download server is overseas, so direct downloads can be slow. You can use Thunder (Xunlei) to download; if someone has downloaded it before, Thunder caches the data on its servers, making the download faster.

After downloading, double-click to run the installer. Since there are many installation steps, to save server resources, only screenshots of the places that need to be changed are shown here.

Most software defaults to installing on the C drive, the common system drive. Since software installation usually releases some files (such as library files) to the system drive, it can easily fill up. So try not to install software itself on the system drive; I'm used to installing on the D drive, following the crowd.

Speed through to the end and uncheck "View release notes" — I can't understand them anyway.

2. TortoiseGit Git GUI Tool https://tortoisegit.org/
For someone like me who isn't fluent in Linux, I prefer clicking buttons over typing commands endlessly, so a GUI Git tool is essential.
The download steps are the same as before, so I won't repeat them, lest you find me annoying.


The interface is English by default; you need to download and install the Chinese language pack separately.

Install the main program first.





Then install the Chinese language pack.


3. RapidEEx Environment Variable Editor https://www.rapidee.com/en/about
Compiling the Xiao An Pai development library requires modifying environment variables. Anyone who has edited the PATH environment variable in Win7 knows how unfriendly the editor is, so install a third-party editor. If you can tolerate it, you can skip this.

This kind of small tool doesn't have configuration libraries or anything; the portable (green) version is fine.

Switch to the Chinese interface.

4. Visual Studio Code 1.70.2 Code Editor https://update.code.visualstudio.com/1.70.2/win32-x64/stable (the last version supporting Win7)
A powerful code editor, no explanation needed. Microsoft stopped supporting Win7 after version 1.70.2, so I can only use this version. Win10 and above can install the latest version.



The option in the red box must be checked — afterwards, the right-click menu in project directories can directly open with VSCode, which is super convenient. If you don't check it, you'll have to modify the registry later to add this menu.


The interface is also English by default; you need to install the Chinese extension.

Search "ch", find "Chinese (Simplified)", and click "install".

If this error message appears, your system is missing some critical patches. Install all the patches first, then try again.

After a successful installation, a restart is required.

It becomes the familiar look.

Also install the "C/C++" extension to make writing code easier.

Installing the Development Library
1. Xiao An Pai Development Library https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git
The main repository of the Xiao An Pai development library should be on GitHub, with Gitee as a mirror. But GitHub is often unstable and slow overseas (in China), so let's just use the domestic Gitee.
Find a disk with plenty of space, create a folder named "AiPi" (any name is fine, but the path must not contain spaces, otherwise compilation will fail later). First copy the repository link, then right-click and select "Clone".

If you copied the repository link beforehand, the repository to clone will be recognized automatically; just click "OK".


Wait for the download to finish.

Download complete.

You also need to update the submodules. Here you must modify the submodule configuration file, changing GitHub to Gitee, otherwise the update may fail.


After the modification, you can update the submodules.

Be sure to check "Recursive" here, because submodules contain submodules — nesting dolls. No need to change addresses again; just update them all at once.



2. Bouffalo Compilation Tools https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git
This time we'll download with Git Bash. Enter the AiPi-Open-Kits\aithinker_Ai-M6X_SDK directory, right-click on empty space, and select "Open Git Bash here".

Enter: git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git and press Enter.


Download complete.

3. Setting the "PATH" Environment Variable
To let the development environment find the compilation tools, we need to set some environment variables.
E:\github\AiPi\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\tools\make
E:\github\AiPi\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\tools\ninja
E:\github\AiPi\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
Right-click "PATH" under system variables and select "Add value".


Add the other two paths in the same way. Press "CTRL+S" to save, and only then do they take effect.

Compiling
Everything is ready. Let's compile an official demo to test. Enter the AiPi-Open-Kits\AiPi-Eyes_weather directory, right-click on empty space, and select "Open with Code".


Enter the compilation command make and press Enter.

Compiling...


About the latest SDK build error: open the /aithinker_Ai-M6X_SDK/project.build file and comment out the CP command with # as shown in the image.

Compilation succeeded. Mission accomplished, all done... (I had only written a little that evening and was about to shut down the computer and sleep, but I accidentally hit publish, and ended up writing through the night...)
Have questions?
For other questions, please visit the unified discussion area: Ai-Thinker Discussions


