本帖最后由 Truth 于 2023-11-17 12:12 编辑
本帖最后由 Truth 于 2023-11-16 13:07 编辑
本帖最后由 Truth 于 2023-11-16 13:05 编辑
1 搭建Ai-M61-32S开发环境-VSCode
- 安装 VSCode
- 配置中文界面
- 在扩展中搜索“Chinese”,安装后重启即可
- 安装插件:**C/C++ 、Doxygen Documentation Generator 、vscode-icons**
2 Git 安装
3 小安派 源码工程 克隆
3.1 克隆源码
3.2 拉取 M61 的 SDK 子模块
-
进入 AiPi-Open-Kits 中,用文本打开 .gitmodules 文件 url 参数中的 github.com 改成 gitee.com :
[submodule "aithinker_Ai-M6X_SDK"]
path = aithinker_Ai-M6X_SDK
url = https://gitee.com/Ai-Thinker-Open/aithinker_Ai-M6X_SDK.git
branch = release/AiPi_Eyes_SDK
-
在 git 工具中分别执行:
cd AiPi-Open-Kits/
git submodule init
git submodule update
-
执行完成
3.3 拉取 M61 SDK 中的子模块
- 进入到 SDK 中拉取子模块
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update
- 克隆适用 Windows 的编译工具链:在
aithinker_Ai-M6X_SDK/ 文件夹中拉取工具链git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git
- 执行完成
4 编译工具路径设置
-
所有都拉取完成之后,需要把三个路径加入到电脑的环境变量当中,分别是:
aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin
aithinker_Ai-M6X_SDK\tools\make
aithinker_Ai-M6X_SDK\tools\ninja
而且需要把 aithinker_Ai-M6X_SDK\tools\make 路径上移到最高层
-
设置完成后重启电脑
-
验证是否成功设置
- 在桌面按住
shift 键点击 鼠标右键 打开 PowerShell 。在 PowerShell 输入:make -v
- 成功输出信息:
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
- 输入:
riscv64-unknown-elf-gcc -v
- 成功输出信息:
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
PS C:\Users\18766\Desktop> riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=D:\Files\MCU\Ai-M61-32S开发环境搭建\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin\riscv64-unknown-elf-gcc.exe
COLLECT_LTO_WRAPPER=d:/files/mcu/ai-m61-32s开发环境搭建/aipi-open-kits/aithinker_ai-m6x_sdk/toolchain_gcc_t-head_windows/bin/../libexec/gcc/riscv64-unknown-elf/10.2.0/lto-wrapper.exe
Target: riscv64-unknown-elf
Configured with: /mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/./source/riscv/riscv-gcc/configure --target=riscv64-unknown-elf --host=i686-w64-mingw32 --with-gmp=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/lib-for-gcc-mingw --with-mpfr=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/lib-for-gcc-mingw --with-mpc=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/lib-for-gcc-mingw --with-libexpat-prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/lib-for-gcc-mingw --with-libmpfr-prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/build-Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/lib-for-gcc-mingw --with-pkgversion='Xuantie-900 elf newlib gcc Toolchain V2.6.1 B-20220906' CXXFLAGS='-g -O2 -DTHEAD_VERSION_NUMBER=2.6.1 ' --enable-libgcctf --prefix=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/Xuantie-900-gcc-elf-newlib-mingw-V2.6.1 --disable-shared --enable-threads=posix --enable-languages=c,c++ --without-system-zlib --enable-tls --with-newlib --with-sysroot=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/build-gcc-riscv64-unknown-elf/Xuantie-900-gcc-elf-newlib-mingw-V2.6.1/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=/mnt/ssd/jenkins_iotsw/slave/workspace/Toolchain/build-gnu-riscv/./source/riscv/riscv-gcc --enable-multilib --with-abi=lp64d --with-arch=rv64gcxthead 'CFLAGS_FOR_TARGET=-Os -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medany'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (Xuantie-900 elf newlib gcc Toolchain V2.6.1 B-20220906)
5 编译天气站程序
5.1 在 VScode 打开小安派仓库源码
- 打开 VScode。在 VScode 打开
AiPi-Open-Kits 文件夹,即可看到源码
5.2 编译 AiPi-Eyes_weather
|