当前位置:首页 > MCU > 正文内容

Ai-M61-32S开发环境搭建 BL616/BL618 Windows/Linux

chanra1n1年前 (2023-11-15)MCU4355


这两天正在研究BL616的板子,想搞出来USB相关做项目用(需求是USB 2.0高速),都把AI-M62的加购了,准备这两天付款(毕竟运费6块,得看看店里有没有啥可以一起买的)。
突然看到发的内容,可以白嫖。真的是想啥来啥,想要BL616的,结果白嫖BL618的。。。“就像是想吃奶了,娘来了。

你可能想问:为什么自己不买芯片画个板子?确实越来越懒了,能买成品的坚决不自己做,,,时间成本也是钱啊。先确认方案是否可行,可行再自己搞。

image.png

image.png

image.png

其实并不是没有这样一个芯片的板卡,早在几个月之前,就收到了Sipeed赠送的M0S Dock做的逻辑分析仪,只是那个引脚引出的不多,不能够满足我的需求。如下图:


1703592649734.png

1703593088732.png

1703593098685.png

1703593113533.png

image.png

1703592661815.png

image.png

BL616/BL618 handbook 手册:-> 

bl616_bl618_ds_zh_cn_1.4.pdf

不得不说,手册写的看着很头疼,我就想要USB进行开发,但是整个手册就是压根没啥实质性的相关内容。。。

下面是环境搭建过程:

一、Git克隆工程

git clone https://github.com/Ai-Thinker-Open/AiPi-Open-Kits.git
cd AiPi-Open-Kits/
git clone https://github.com/bouffalolab/toolchain_gcc_t-head_windows.git
git submodule init
git submodule update
cd aithinker_Ai-M6X_SDK/
git submodule init
git submodule update

image.png

克隆之后,需要将gcc和make添加到Path里面。

%BL61XSDKROOT%我指向了C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK 根据你的实际情况修改。
%BL61XSDKROOT%\tools\make
%BL61XSDKROOT%\tools\ninja
%BL61XSDKROOT%\toolchain_gcc_t-head_windows\bin

对于Linux环境

需要运行demo目录下的install.sh安装依赖。

二、make编译

image.png

如果进入Example直接make,会报错,这个是模版的问题。

三、排错

image.png

打开如图所示文件,注释掉这三行即可。然后程序make就可以通过。

image.png

烧录测试了一下挺好的,就是磁盘占用挺大,啥也没干,几个G就没了。

image.png

四、程序烧录

烧录需要按住IO2按键的同时按一下EN按键,然后松手运行命令

make flash CHIP=bl616 COMX=COM5

其中的COM5需要修改为具体实际的端口号。

正确烧录显示:

image.png

如果没有按按键,则程序很可能没法程序引导。

./../../tools/cmake/bin/cmake.exe -S . -B build -G "MinGW Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl616 -DCPU_ID= -DBOARD=bl616dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM5 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y
-- [register library : libc], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/libc
-- [register library : mm], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/mm
-- [register library : utils], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/components/utils
-- [register library : lhal], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
-- [register extern library : libcsi_xt900p32f_dsp], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
-- [register extern library : libpka], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/lhal
-- [register library : std], path:C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/drivers/soc/bl616/std
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ai-thinker/AiPi-Open-Kits/aithinker_Ai-M6X_SDK/examples/helloworld/build
make -C build -j8
[  2%] Built target app
[ 16%] Built target std
[ 19%] Built target mm
[ 62%] Built target libc
[ 66%] Built target utils
[ 98%] Built target lhal
[100%] Built target helloworld_bl616.elf
make -C build combine
[15:05:30.470] - bflb firmware post process : V1.2.0
[15:05:30.470] - Chipname: bl616
[15:05:30.470] - Board config dir: ./../../bsp/board/bl616dk/config
[15:05:30.470] - Create partition using partition_cfg_4M.toml
[15:05:30.473] - Create dts for C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\helloworld_bl616.bin
[15:05:30.473] - Create dts using bl_factory_params_IoTKitA_auto.dts
[15:05:30.476] - 4K header found,append dts file
[15:05:30.477] - Copy boot2_bl616_release_v8.0.8.bin
[15:05:30.478] - Copy mfg_bl616_gu_af8b0946f_v2.26.bin
[15:05:30.479] - Create dts for C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
[15:05:30.479] - Create dts using bl_factory_params_IoTKitA_auto.dts
[15:05:30.484] - 4K header found,append dts file
[15:05:30.484] -
Process C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\helloworld_bl616.bin
[15:05:30.485] - ========= sp image create =========
[15:05:30.486] - Flash config crc: b'b5fec518'
[15:05:30.486] - Clock config crc: b'4a05f490'
[15:05:30.486] - Image Offset:0x1000
[15:05:30.486] - Image hash is b'0d02ff085429a6e186cc7bcfd40c86d776ca0810eda53a8a471b9347d09934fc'
[15:05:30.486] - Encrypt efuse data
[15:05:30.489] - Image Offset:0x1000
[15:05:30.489] - Image hash ignore,not calculate
[15:05:30.489] - Bootheader config crc: b'4ddfb44c'
[15:05:30.489] -
Process C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\boot2_bl616_release_v8.0.8.bin
[15:05:30.490] - ========= sp image create =========
[15:05:30.490] - Flash config crc: b'b5fec518'
[15:05:30.490] - Clock config crc: b'4a05f490'
[15:05:30.490] - Image Offset:0x2000
[15:05:30.490] - Image hash is b'4f4eecaddc6e597708f626253879f5560534d2e3baff848f4d96fabbce4b020f'
[15:05:30.491] - Encrypt efuse data
[15:05:30.491] - Image Offset:0x2000
[15:05:30.491] - Image hash ignore,not calculate
[15:05:30.491] - Bootheader config crc: b'ccbfa125'
[15:05:30.492] -
Process C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\mfg_bl616_gu_af8b0946f_v2.26.bin
[15:05:30.492] - ========= sp image create =========
[15:05:30.493] - Flash config crc: b'4fb1fe70'
[15:05:30.493] - Clock config crc: b'0b34ef89'
[15:05:30.493] - Image Offset:0x1000
[15:05:30.495] - Image hash is b'69de5b7af45fea2e456fb6864612126bbdad58e69294d1466a2f892e010d1f3d'
[15:05:30.495] - Encrypt efuse data
[15:05:30.496] - Image Offset:0x1000
[15:05:30.496] - Bootheader config crc: b'f9cf01e0'
[15:05:30.496] - create OTA file:C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\helloworld_bl616.bin.ota
[15:05:30.500] - create XZ file:C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\helloworld_bl616.xz
[15:05:30.513] - create XZ OTA file:C:\ai-thinker\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\examples\helloworld\build\build_out\helloworld_bl616.xz.ota
Built target combine
./../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe --interface=uart --baudrate=2000000 --port=COM5 --chipname=bl616 --cpu_id= --config=flash_prog_cfg.ini
['./../../tools/bflb_tools/bouffalo_flash_cube/BLFlashCommand.exe', '--interface=uart', '--baudrate=2000000', '--port=COM5', '--chipname=bl616', '--cpu_id=', '--config=flash_prog_cfg.ini']
[15:05:32.202] - Serial port is COM5
[15:05:32.202] - ==================================================
[15:05:32.203] - Program Start
[15:05:32.203] - ========= eflash loader cmd arguments =========
[15:05:32.204] - serial port is COM5
[15:05:32.204] - chiptype: bl616
[15:05:32.205] - cpu_reset=False
[15:05:32.214] - ========= Interface is uart =========
[15:05:32.214] - Bootrom load
[15:05:32.214] - ========= get_boot_info =========
[15:05:32.214] - ========= image get bootinfo =========
[15:05:32.501] - tx rx and power off, press the machine!
[15:05:32.501] - cutoff time is 0.05
[15:05:32.564] - power on tx and rx
[15:05:33.561] - reset cnt: 0, reset hold: 0.05, shake hand delay: 0.1
[15:05:33.561] - clean buf
[15:05:33.572] - send sync
[15:05:33.824] - ack is b'00000000000000000000000000000000000000f80000f80000f800f80000f800f8000000000000008000000000800000008000000000f800000000000000f80078f8000000f800000000000000000000000000800000000000f8000000000000f800000000f800f880800000000000000000000080f800000000000000f80000f80000800000800000000000f80000000000000000f80000f800f80000000000000000000000000000f880000000f800f800f88000f800000000f8f8000000000000000080000000000000008000f8000000f8000000f800f8000000f800f8f80000007800f800000000800000000000000000000000f8000000f800f80000f8000000008000000000000000000000000000780000000000000000f80000000000f800f8f8000000f800f8f80000000000000000f8f8000000f80000800000000000f800000080000000000000f800f8000000000000000000800000000000000000f80000f8000000000000000000000080000000f8800000000000f80000f800f800f800000000f800f8000000000000f8000000000000000000f800f800008000000000000000000000f80000000000f8000000f80000f8007800f8000000f800f880000000000000008000000000000000000000000000000000000000f8800000f8f80000f800000000f80000f800f80000000000000000f80000000000000000f800f80000000000000000f800008080f800f80000000000f800f80000f800f8f80000f800780000000000000000f800000000'
[15:05:33.824] - reshake
[15:05:34.080] - tx rx and power off, press the machine!
[15:05:34.080] - cutoff time is 0.05
[15:05:34.142] - power on tx and rx
[15:05:35.140] - reset cnt: 0, reset hold: 0.05, shake hand delay: 0.1
[15:05:35.140] - clean buf
[15:05:35.151] - send sync
[15:05:35.403] - ack is b'0000000000000000000000000000000000000000f8000000000000f800f8f880000000000000000078000000f8800000000000000000f8000000f8f800000000008000000000000000000000000000f8000000f800f800f8000000000080008000000000000000000000000000f8000000f80000000000f800f800f8000000000000000000f80000000000008000f80000000000000000000000f80000000000f800f800000000000000f800000000f800780000000000f800f80000000080000000f800000000f8000000800000000000800000000000f80000f800f800000000000000008000f8f80000000000008000000000f8000000f8000000f800f800f8000000f800000000f8f8000000f800000000800000000000f800f80000000000000000f800f800f800f800f800f8000000f800f80000f80000800000000000000000008000000000f8000000f8000000008000f80000f800f80000800000000000f800f800000000000000000000000000000000f88000000000f800f800f8000000f88080000000f800f8007800000000008000780000f800000000000000000000f8000000f8000000008000f800f8000000f8f80000f8f800f8f80000000000000000800000000000f800f8f8008000000000800000f800f8000000f88080f800f8000000000000000080f8f8000000000000000000000000f800f800780000000000000000000000f800f8000000000000000000f8007800f8000000000000000000000000f8f80000008000000000000000f8000000000000'
[15:05:35.403] - reshake
[15:05:35.670] - tx rx and power off, press the machine!
[15:05:35.670] - cutoff time is 0.05
[15:05:35.732] - power on tx and rx
[15:05:36.726] - reset cnt: 0, reset hold: 0.05, shake hand delay: 0.1
[15:05:36.726] - clean buf
[15:05:36.736] - send sync
[15:05:36.990] - ack is b'000000000000000000000000000000000000800000f80000000000f80000000000f8800000f800000000008000000000f800f800f800008080000000f8000000000000f80078f8007880f8000000000000800000000000000000f80000000000f800f800f800f8000080000000f80000f80000f800f80000000000000000000000000000000080800000000000000000f800000000000000f8f800000000f80000f8000000f80000000000000000f80000000000f800000000000000f8f80000f800000000000000000000f800f8000000000000008000000080000000000000f80000000000000000000000f800f8000000000000000000f800000000000000f8f800000000808080000000f88000000000f8000000f8000000000000800000f8000000000080000000f80000000000f8000000007880000000f80078f80000800000000000000000000000f800f8000080000000f8f8800000f8000000f800000000f8000000000000000000f800f800000000f88000000000f8000000000000000000000000f8f800f800f80000000000000000000000f8000000000000000000f800f800780080f800008000000000000000000000000000f880000000f80000f80000f800f80000f80000000000000000000000f800000000f80000000000f800000000000000f80000000000000000000000f8000000000000f8000000f80000f80000f8000000000000f80000f8f8f80000008080000000800000000000f80000f8000000f8000000f800008000f800f8f800f800000000000000f80000000000f8000000'
[15:05:36.990] - reshake
[15:05:36.996] - shake hand fail
[15:05:36.996] - ########################################################################
[15:05:36.996] - 请按照以下描述排查问题:
[15:05:36.996] - Boot pin是否上拉到板子自身的3.3V,而不是外部的3.3V
[15:05:36.996] - UART RX是否连接到USB转串口的TX引脚
[15:05:36.996] - UART TX是否连接到USB转串口的RX引脚
[15:05:36.996] - 在使用烧录软件进行烧录前,是否在Boot pin拉高的情况下,使用Reset/Chip_En复位了芯片
[15:05:36.996] - 烧录软件所选择的COM口,是否是连接芯片的串口
[15:05:36.996] - 烧录软件上选择的波特率是否是USB转串口支持的波特率
[15:05:36.996] - 3.3V供电是否正常
[15:05:36.996] - 板子供电电流是否正常(烧录模式下,芯片耗电电流5-7mA)
[15:05:36.997] - ########################################################################
[15:05:36.997] - shake hand fail
[15:05:36.998] - ========= ChipID:  =========
[15:05:36.999] - Get bootinfo time cost(ms): 4784.926513671875
[15:05:36.999] - {"ErrorCode": "0050","ErrorMsg":"BFLB IMG LOAD SHAKEHAND FAIL"}
[15:05:36.999] - Burn Retry
[15:05:36.999] - Burn return with retry fail

如果发生了上面提示的报错,请按住IO2按键的同时按一下EN按键,然后松手后再运行烧录命令。

扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://myfpga.cn/index.php/post/341.html

分享给朋友:

“Ai-M61-32S开发环境搭建 BL616/BL618 Windows/Linux” 的相关文章

UART通信方式简明教程

UART通信方式简明教程

Uart 即最常见的串口通信方式,相信你点进来之前就对此有或多或少的了解了,不对基本介绍做赘述,Uart协议采用两根数据总线,一根是RXD,一根是TXD,怎么区分呢?R是Receive接收的意思,T是Transmit发送的意思协议需要掌握的有3个:时序、寄存器Uart协议标准的构成为:起始...

TI-TM4C123x系列单片机编程救急宝典(持续更新中...)

TI-TM4C123x系列单片机编程救急宝典(持续更新中...)

前言TI-TM4C123x系列单片机的编程有种面向过程的感觉,无论是时钟设置,端口配置,还是操作外设都是采样的函数调用方式。这种方式有很强的结构化感觉,也便于初学者学习。下面作者将从多个角度介绍。本手册更接近应用,跳过了大多的理论和原理,大篇幅讲述如何快速入门和使用起来该单片机,作者更建议读者认真阅...

使用ADC+DAC实现程控增益放大器V3.1,基于STC8G单片机 开源页面

使用ADC+DAC实现程控增益放大器V3.1,基于STC8G单片机 开源页面

本项目主要是研究目的,如果希望用于实际用途,还请使用放大器+数字电位器,或者直接使用程控仪表放大器,例如AD603等。原理图:代码://main.c /* 注意:请不要输入超过5.5V的信号,否则可能会导致芯片永久损坏! 当输入的信号封装为0~0.5V范围时,输出会放大十倍。 当输入的信号封...

基于nRF52840实现一个FIDO2安全密钥

基于nRF52840实现一个FIDO2安全密钥

项目参考了1.https://github.com/google/OpenSK 2.https://github.com/adafruit/Adafruit_nRF52_Bootloader 3.https://github.com/canokeys/canokey-nrf52 坑已经踩完了,大家可...