【板子申请】Ai-M61-32S开发环境搭建

[复制链接]
查看423 | 回复4 | 2023-11-10 18:08:25 | 显示全部楼层 |阅读模式

本帖最后由 hbshys 于 2023-11-13 17:19 编辑

本帖最后由 hbshys 于 2023-11-13 17:17 编辑

本帖最后由 hbshys 于 2023-11-13 14:56 编辑

创建一个工作目录

mkdir project
cd ~/project/

克隆源码

git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git
克隆源码执行过程
Cloning into 'AiPi-Open-Kits'...
remote: Enumerating objects: 3580, done.
remote: Counting objects: 100% (3580/3580), done.
remote: Compressing objects: 100% (2130/2130), done.
remote: Total 3580 (delta 1675), reused 3174 (delta 1270), pack-reused 0
Receiving objects: 100% (3580/3580), 88.38 MiB | 7.58 MiB/s, done.
Resolving deltas: 100% (1675/1675), done.
Updating files: 100% (2597/2597), done.
拉取M61的SDK 子模块
cd ~/project/AiPi-Open-Kits/

修改.gitmodules 文件中的 github.com 为 gitee.com

vim .gitmodules
修改结果
[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
拉取SDK子模块
git submodule init
Submodule 'aithinker_Ai-M6X_SDK' (https://gitee.com/Ai-Thinker-Open/aithinker_Ai-M6X_SDK.git) registered for path 'aithinker_Ai-M6X_SDK'
git submodule update
Cloning into 'C:/Users/hbshy/project/AiPi-Open-Kits/aithinker_Ai-M6X_SDK'...
Submodule path 'aithinker_Ai-M6X_SDK': checked out 'c7f51ba430060b4ad4e187d623335e7ed6d9c0b9'

拉取toolchain_gcc_t-head_windows

cd ~/project/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/
git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git
当前文件列表

当前文件列表

配置环境变量

2023-11-13.png

测试命令

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
Using built-in specs.
COLLECT_GCC=C:\Users\hbshy\project\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\toolchain_gcc_t-head_windows\bin\riscv64-unknown-elf-gcc.exe
COLLECT_LTO_WRAPPER=c:/users/hbshy/project/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)

测试结果

编译

注释 AiPi-Open-Kits\aithinker_Ai-M6X_SDK\project.build 79 80 94
MAKE_PATH = C:/Users/hbshy/AiPiEasyStartV1.1.1/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/tools/make
NINJA_PATH = C:/Users/hbshy/AiPiEasyStartV1.1.1/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/tools/ninja
TOOLCHAIN_PATH = C:/Users/hbshy/AiPiEasyStartV1.1.1/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/toolchain_gcc_t-head_windows/bin
export PATH=$(MAKE_PATH):$(NINJA_PATH):$(TOOLCHAIN_PATH):$PATH
# avoid 'Entering|Leaving directory' messages
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif

command_flash = $(BL_FLASH_PROGRAM) --interface=uart --baudrate=$(BAUDRATE) \
    --port=$(COMX) --chipname=$(CHIP) --cpu_id=$(CPU_ID) --config=flash_prog_cfg.ini
command_efuse = $(BL_FLASH_PROGRAM) --interface=uart --baudrate=$(BAUDRATE) \
    --port=$(COMX) --chipname=$(CHIP) --efuse=build/build_out/efusedata.bin
command_puncover = $(PUNCOVER_PROGRAM) \
    --elf_file ./build/build_out/*.elf --map_file ./build/build_out/*.map \
    --build_dir ./build --src_root ${BL_SDK_BASE} --port 5001

ifeq ($(OS),Windows_NT)
CMAKE = $(BL_SDK_BASE)/tools/cmake/bin/cmake.exe
BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe
PUNCOVER_PROGRAM = puncover_riscv.exe
cmake_generator = "MinGW Makefiles"

else
    ifeq ($(shell uname),Darwin)
    CMAKE = cmake # use user cmake
    BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-macos
    PUNCOVER_PROGRAM = puncover_riscv
    cmake_generator = "Unix Makefiles"
    else ifeq ($(shell uname),FreeBSD)
    CMAKE = cmake # use user cmake
    BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-freebsd
    PUNCOVER_PROGRAM = puncover_riscv
    cmake_generator = "Unix Makefiles"
    else ifeq ($(patsubst %WSL2,WSL2,$(shell uname -r)), WSL2)
    PS_PROGRAM = /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
    CMAKE = $(BL_SDK_BASE)/tools/cmake/bin/cmake
    command_flash = $(PS_PROGRAM) make flash CHIP=$(CHIP) CPU_ID=$(CPU_ID) COMX=$(COMX) BAUDRATE=$(BAUDRATE)
    command_efuse = $(PS_PROGRAM) make efuse CHIP=$(CHIP) CPU_ID=$(CPU_ID) COMX=$(COMX) BAUDRATE=$(BAUDRATE)
    PUNCOVER_PROGRAM = puncover_riscv
    cmake_generator = "Unix Makefiles"
    else
    CMAKE = $(BL_SDK_BASE)/tools/cmake/bin/cmake
    BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-ubuntu
    PUNCOVER_PROGRAM = puncover_riscv
    cmake_generator = "Unix Makefiles"
    endif
endif

# The command to remove a file.
RM = $(CMAKE) -E remove_directory

CPU_ID ?=
CONFIG_USB_HS ?=y
CONFIG_ROMAPI ?=y
CONFIG_DEBUG ?=y
CONFIG_TLSF ?=y
COMX ?=/dev/ttyUSB0
BAUDRATE ?=2000000
BOARD_DIR ?=

#cmake definition config
cmake_definition+= -DCROSS_COMPILE=${CROSS_COMPILE}
cmake_definition+= -DCHIP=$(CHIP)
cmake_definition+= -DCPU_ID=$(CPU_ID)
cmake_definition+= -DBOARD=$(BOARD)
cmake_definition+= -DBOARD_DIR=$(BOARD_DIR)
cmake_definition+= -DCONFIG_DEBUG=$(CONFIG_DEBUG)
cmake_definition+= -DCONFIG_ROMAPI=$(CONFIG_ROMAPI)
cmake_definition+= -DCONFIG_USB_HS=$(CONFIG_USB_HS)
cmake_definition+= -DCONFIG_COMX=$(COMX)
cmake_definition+= -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
cmake_definition+= -DCONFIG_TLSF=$(CONFIG_TLSF)

build:Makefile
    $(CMAKE) -S . -B build -G $(cmake_generator) $(cmake_definition)
    make -C build -j8
    make -C build combine
#   cp $(BL_SDK_BASE)/bsp/board/bl616dk/config/edata.bin build/build_out
#   cp $(BL_SDK_BASE)/bsp/board/bl616dk/config/Rx_boot2_m61.bin build/build_out

ninja:Makefile
    $(CMAKE) -S . -B build -G Ninja $(cmake_definition)
    cd build && ninja && ninja combine

clean::
    $(RM) build

menuconfig::
    python $(BL_SDK_BASE)/tools/kconfig/menuconfig.py

flash:build
    $(command_flash)
#   cp $(BL_SDK_BASE)/tools/bflb_tools/bouffalo_flash_cube/chips/bl616/img_create/whole_flash_data.bin build/build_out/ 
efuse:
    $(command_efuse)

puncover:
    $(command_puncover)

.PHONY:build clean menuconfig ninja
编译 AiPi-Eyes_weather
cd AiPi-Open-Kits\AiPi-Eyes_weather
make
编译结果

编译结果

屏幕截图 2023-11-10 174259.png
回复

使用道具 举报

WangChong | 2023-11-10 18:16:14 | 显示全部楼层
插眼给7哥看
回复 支持 反对

使用道具 举报

爱笑 | 2023-11-14 15:28:57 | 显示全部楼层
把你的微信号私信发我
用心做好保姆工作
回复 支持 反对

使用道具 举报

hbshys | 2023-11-20 13:43:31 | 显示全部楼层
爱笑 发表于 2023-11-14 15:28
把你的微信号私信发我

为什么没有人在微信上联系我呢?
回复 支持 反对

使用道具 举报

干簧管 | 2023-11-20 13:49:42 | 显示全部楼层
慢慢等,会联系你的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则