【板子申请】Ai-M61-32S开发环境搭建及示例代码编译

[复制链接]
查看315 | 回复1 | 2023-11-11 00:06:58 | 显示全部楼层 |阅读模式
先在官网下载并安装vscode

Snipaste_2023-11-10_13-07-57.png

接着按照教程依次克隆库文件,要注意的是文件的路径中不能包括空格,否则后续make时会提醒找不到指定文件
  1. git clone https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git
  2. cd AiPi-Open-Kits/
  3. git submodule init
  4. git submodule update
  5. cd aithinker_Ai-M6X_SDK/
  6. git submodule init
  7. git submodule update
  8. git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_windows.git
复制代码
其中需要访问GitHub,如果你的电脑不能访问可以换源到gitee或者开加速器
Snipaste_2023-11-10_13-19-42.png

然后按照教程要求添加环境变量(好像添加顺序并不影响)
Snipaste_2023-11-10_13-26-24.png

下一步检查环境变量是否生效(可以先重启电脑)
  1. make -v
  2. riscv64-unknown-elf-gcc -v
复制代码
输出如下则正常

Snipaste_2023-11-10_13-27-23.png

下一步打开vscode,定位到AiPi-Eyes_weather文件夹,右键在内置命令行打开,输入make,也可以加V=sc来输出详细信息,加-j16来加速编译
  1. make V=sc -j16
复制代码
编译成功时结果如下
Snipaste_2023-11-10_23-42-16.png

如果编译错误,记得修改|AiPi-Open-Kits\aithinker_Ai-M6X_SDK里的project.build文件如下
  1. # avoid 'Entering|Leaving directory' messages
  2. ifndef VERBOSE
  3. MAKEFLAGS += --no-print-directory
  4. endif

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

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

  17. else
  18.         ifeq ($(shell uname),Darwin)
  19.         CMAKE = cmake # use user cmake
  20.         BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-macos
  21.         PUNCOVER_PROGRAM = puncover_riscv
  22.         cmake_generator = "Unix Makefiles"
  23.         else ifeq ($(shell uname),FreeBSD)
  24.         CMAKE = cmake # use user cmake
  25.         BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-freebsd
  26.         PUNCOVER_PROGRAM = puncover_riscv
  27.         cmake_generator = "Unix Makefiles"
  28.         else ifeq ($(patsubst %WSL2,WSL2,$(shell uname -r)), WSL2)
  29.         PS_PROGRAM = /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
  30.         CMAKE = $(BL_SDK_BASE)/tools/cmake/bin/cmake
  31.         command_flash = $(PS_PROGRAM) make flash CHIP=$(CHIP) CPU_ID=$(CPU_ID) COMX=$(COMX) BAUDRATE=$(BAUDRATE)
  32.         command_efuse = $(PS_PROGRAM) make efuse CHIP=$(CHIP) CPU_ID=$(CPU_ID) COMX=$(COMX) BAUDRATE=$(BAUDRATE)
  33.         PUNCOVER_PROGRAM = puncover_riscv
  34.         cmake_generator = "Unix Makefiles"
  35.         else
  36.         CMAKE = $(BL_SDK_BASE)/tools/cmake/bin/cmake
  37.         BL_FLASH_PROGRAM = ${BL_SDK_BASE}/tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand-ubuntu
  38.         PUNCOVER_PROGRAM = puncover_riscv
  39.         cmake_generator = "Unix Makefiles"
  40.         endif
  41. endif

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

  44. CPU_ID ?=
  45. CONFIG_USB_HS ?=y
  46. CONFIG_ROMAPI ?=y
  47. CONFIG_DEBUG ?=y
  48. CONFIG_TLSF ?=y
  49. COMX ?=/dev/ttyUSB0
  50. BAUDRATE ?=2000000
  51. BOARD_DIR ?=

  52. #cmake definition config
  53. cmake_definition+= -DCROSS_COMPILE=${CROSS_COMPILE}
  54. cmake_definition+= -DCHIP=$(CHIP)
  55. cmake_definition+= -DCPU_ID=$(CPU_ID)
  56. cmake_definition+= -DBOARD=$(BOARD)
  57. cmake_definition+= -DBOARD_DIR=$(BOARD_DIR)
  58. cmake_definition+= -DCONFIG_DEBUG=$(CONFIG_DEBUG)
  59. cmake_definition+= -DCONFIG_ROMAPI=$(CONFIG_ROMAPI)
  60. cmake_definition+= -DCONFIG_USB_HS=$(CONFIG_USB_HS)
  61. cmake_definition+= -DCONFIG_COMX=$(COMX)
  62. cmake_definition+= -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
  63. cmake_definition+= -DCONFIG_TLSF=$(CONFIG_TLSF)

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

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

  73. clean::
  74.         $(RM) build

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

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

  82. puncover:
  83.         $(command_puncover)

  84. .PHONY:build clean menuconfig ninja
复制代码
第一次写帖子,如有不妥请谅解,谢谢
回复

使用道具 举报

爱笑 | 2023-12-1 11:25:40 | 显示全部楼层
通过
用心做好保姆工作
回复

使用道具 举报

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

本版积分规则