Ai-M61/Ai-M62 series module Linux development environment construction

1. Ubuntu installation

The compilation speed under Linux is much faster than that under Windows, and it is generally recommended to use the Linux environment for development first. Ubuntu is a very common Linux operating system. Here is how to quickly build an Ubuntu virtual machine.

1.1 Install VMware Workstation Pro

Download VMware Workstation Pro 16
and install
insert image description here
insert image description here
the rest, click Next until the installation is complete

Activation:
Open VMware Workstation Pro -> Help -> Enter License Key.
Learning purposes: Google "vmware workstation 16 license key".
Commercial use: Go to the VMware official website to purchase genuine licenses.

1.2 Install Ubuntu

Here we take the installation of Ubuntu 20.04.6 LTS version as an example. The link to obtain the mirror image is: Ubuntu 20.04.6 LTS . If the link is invalid, visit the official website of ubuntu and obtain the link for desktop version resources: https://releases.ubuntu.com /jammy/

After obtaining the image, you can install the ubuntu system. Reference link for how to install Ubuntu under VMWare: Detailed tutorial on installing Ubuntu on VMware

The following is the mobile ubuntu system virtual machine that we have built for the Ai-M61/Ai-M62 development environment. For resources, please contact the staff of Anxinke.
Just open the system startup file in the VMware software, the specific operation is as follows: Open VMware Workstation Pro -> File -> Open -> select the downloaded and decompressed Ubuntu file path and start it directly, the user name and password are both 123 Ubuntu
insert image description here
virtual
insert image description here
machine The development environment for Ai-M61/Ai-M62 series modules has been installed, and the sdk is located in the main directory -> bouffalo_sdk/
insert image description here

下面括号内内容针对阅读此博文前已安装过Ubuntu的用户
{

  1. No need to reinstall Ubuntu
  2. Create M61 or M62SDK and tool chain storage folder:mkdir bl61x
  3. Enter the "bl61x" folder: cd bl61x, get the SDK: git clone https://github.com/bouffalolab/bouffalo_sdk.git, after completing the above operations, you will see the SDK storage folder "bouffalo_sdk" under the "bl61x" folder.
  4. Open the terminal, install make, command: sudo apt-get updatesudo apt-get install make ninja-build -y
  5. Get the toolchain:git clone https://gitee.com/bouffalolab/toolchain_gcc_t-head_linux.git
  6. Copy the toolchain to the folder where the system commands are stored:sudo cp -rf toolchain_gcc_t-head_linux/ /usr/bin
  7. Add the toolchain operation directory to the environment variable and write it into the ".bashrc" file:echo "export PATH=\"$PATH:/usr/bin/toolchain_gcc_t-head_linux/bin\"" >> ~/.bashrc
  8. Run the ".bashrc" file once:source ~/.bashrc
  9. Install the serial port tool, choose cutecom here, execute the command: sudo apt-get install cutecom
  10. To add users to dialout in Linux, execute the command: sudo usermod -a -G dialout $USER
    }

Two, compile

Enter the project directory that needs to be compiled, such as entering the hello world project, command: cd examples/helloworld, to compile, the command make CHIP=bl616
shows the following log indicating that the compilation has been successful:
insert image description here
the firmware generated by the compilation is in the build/build_out folder: helloworld_bl616.bin

3. Burn the firmware to the device

3.1 Method 1: Burning with the command line

  • Module wiring
    USB to TTL | Ai-M62-12F
    -------- | -----
    VCC | 3.3V
    GND | GND
    TXD | RXD
    RXD | TXD
    RTS | EN (reset function)
    DTR | IO2 ( dots on the back)

注意IO2在模组背面的圆点上

  • The development board enters the burning mode:
    connect the USB to the computer, press the BURN and EN buttons at the same time, first release the EN button and then release the BURN button
    Note: The operation method of M61 is the same as above.

The real thing is as follows:
insert image description here

Connect the device to the virtual machine
insert image description here
Burn and execute the command line:

make flash CHIP=bl616

The following log shows that the burning is successful.
insert image description here
After the burning is completed, open the serial port assistant: sudo cutecom
After setting the baud rate in cutecom, open the serial port.
insert image description here
After resetting the module, print helloworld
insert image description here

3.2 Method 2: burn with visual software (windows)

Download software: bl6xx_flash_download_tool

  • The module wiring is the same as above, so I won’t go into details here;
    the development board wiring:
    just connect the usb to the computer directly.
  1. Double-click the BLDevCube.exe software, as shown below
    insert image description here
  2. Choose BL616/618 chip
    insert image description here

(1) Select BL616/618 chip
(2) Click OK

  1. Select the download method of IOT
    insert image description here

  2. For specific instructions on the parameters of the burning software, you can check the docs directory in the burning software. Here is a brief introduction to the parameters in the red box area.
    insert image description here

– Interface: It is used to select the communication interface for downloading and burning, you can choose Jlink or UART, the user can choose according to the actual physical connection, and the default is UART
– Port/SN: When selecting UART for downloading, here select the COM port connected to the chip , you can click the Refresh button to refresh the COM number
– Uart Rate: When selecting UART for downloading, fill in the baud rate, the recommended download frequency is set to 921600
– JLink Ra’te: When selecting JLink for downloading, the programming speed configuration, the default value is 1000

A total of four files need to be burned:
(1) Partition file: BL616_flash_tool/chips/bl616/partition/partition_cfg_4M.toml
(2) RF parameter file: BL616_flash_tool/chips/bl616/device_tree/bl_factory_params_IoTKitA_auto.dts
(3) Boot file: BL616_flash_to ol /chips/bl616/builtin_imgs/boot2_isp_bl616_v6.5.1/boot2_isp_release.bin
(4) APP file compiled by the user: assigned to the newly compiled helloworld_bl616.bin

The result of successful burning is as follows:
insert image description here

The default baud rate of the log serial port is 2000000. If you need to modify the baud rate of the log serial port, you can modify it in the file BL616_flash_tool\chips\bl616\device_tree\bl_factory_params_IoTKitA_auto.dts, and download it again after modification.
insert image description here
Profile selection:

4. Development data

Anxinke official website docs: https://docs.ai-thinker.com/wifi
bouffalolab official SDK: https://github.com/bouffalolab/bl_iot_sdk , the official routines are located in the customer_app folder.
Programming Guide: https://bouffalolab.github.io/bl_iot_sdk

Guess you like

Origin blog.csdn.net/Boantong_/article/details/131226778