AI智能硬件创业者社区 小智AI本地编译部署

小智AI本地编译部署

默认桌面添加两个快捷方式,双击启动Powershell。如果安装了多个不同版本,可以通过箭头下拉框这里选择。

egzosn  ·  2025-06-17 15:15:49 发布

1. 开发环境安装

下载安装官方IDF(ESP32官方推荐: https://dl.espressif.com/dl/esp-idf/)或者( 网盘下载开发环境)

小智AI本地编译部署_小智AI

小智AI本地编译部署_人工智能_02

小智AI本地编译部署_智能语音_03

小智AI本地编译部署_本地部署_04

小智AI本地编译部署_#include_05

2. 开发环境编译测试

2.1 启动IDF

默认桌面添加两个快捷方式,双击启动Powershell

小智AI本地编译部署_#include_06

小智AI本地编译部署_人工智能_07

如果安装了多个不同版本,可以通过箭头下拉框这里选择。

小智AI本地编译部署_#include_08

2.2 编译官方示例(hello world)
# 进入工程目录
 cd .\examples\get-started\hello_world\
 # 启动编译
 idf.py build
 # 芯片默认ESP32,不同时候需要设置
 # idf.py set-target esp32s3       #设置目标芯片为esp32s3
 # idf.py set-target esp32s2       #设置目标芯片为esp32s2
 # idf.py set-target esp32c3       #设置目标芯片为esp32c3
 # idf.py set-target esp32         #设置目标芯片为esp32
 # 程序下载运行
 idf.py build flash monitor
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.

小智AI本地编译部署_人工智能_09

小智AI本地编译部署_人工智能_10

小智AI本地编译部署_#include_11

小智AI本地编译部署_#include_12

小智AI本地编译部署_人工智能_13

小智AI本地编译部署_本地部署_14

2.3 hello world源码
/*
 * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: CC0-1.0
 */

#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"

void app_main(void)
{
    printf("Hello world!\n");

    /* Print chip information */
    esp_chip_info_t chip_info;
    uint32_t flash_size;
    esp_chip_info(&chip_info);
    printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
           CONFIG_IDF_TARGET,
           chip_info.cores,
           (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
           (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
           (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
           (chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "");

    unsigned major_rev = chip_info.revision / 100;
    unsigned minor_rev = chip_info.revision % 100;
    printf("silicon revision v%d.%d, ", major_rev, minor_rev);
    if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
        printf("Get flash size failed");
        return;
    }

    printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
           (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");

    printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());

    for (int i = 10; i >= 0; i--) {
        printf("Restarting in %d seconds...\n", i);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
    printf("Restarting now.\n");
    fflush(stdout);
    esp_restart();
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.

3. 源码编译

3.1 下载源码

通过( https://github.com/78/xiaozhi-esp32.git)或者( 网盘下载源码)

3.2 设置芯片类型
cd D:\Suo\code\xiaozhi-esp32\
idf.py set-target esp32s3       #设置目标芯片为esp32s3
  • 1.
  • 2.

小智AI本地编译部署_#include_15

小智AI本地编译部署_人工智能_16

3.3 设置目标板卡
# 进入配置界面
idf.py menuconfig
# 根据自己板子型号选择
# Xiaozhi Assistant -> Board Type(面包板新版接线(WiFi)) -> 面包板新版接线(WiFi)+LCD -> 
# -> LCD Type (ST7789, 分辨率240*320, IPS) -> ST7789,分辨率240*240, 7PIN ->
# -> s(保存)-> q(退出配置界面)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

小智AI本地编译部署_小智AI_17

小智AI本地编译部署_人工智能_18

小智AI本地编译部署_小智AI_19

小智AI本地编译部署_智能语音_20

小智AI本地编译部署_人工智能_21

小智AI本地编译部署_人工智能_22

小智AI本地编译部署_#include_23

3.4 编译
idf.py build
  • 1.

小智AI本地编译部署_智能语音_24

小智AI本地编译部署_智能语音_25

3.5 下载运行
idf.py build flash monitor
  • 1.

小智AI本地编译部署_#include_26

小智AI本地编译部署_小智AI_27

小智AI本地编译部署_智能语音_28

4. 修改唤醒词

# 进入配置界面
idf.py menuconfig

# ESP Speech Recognition -> Load Multiple Wake Words(WakeNet9) -> 选中对应唤醒词 -> s(保存)-> q(退出)
  • 1.
  • 2.
  • 3.
  • 4.

小智AI本地编译部署_小智AI_29

小智AI本地编译部署_本地部署_30

小智AI本地编译部署_本地部署_31

小智AI本地编译部署_人工智能_32

5. 修改websocket地址(160版本)

# 进入配置界面
idf.py menuconfig

# Xiaozhi Assistant -> Connection Type(MQTT + UDP) -> Websocket -> 修改地址 -> s(保存)-> q(退出)
  • 1.
  • 2.
  • 3.
  • 4.

小智AI本地编译部署_本地部署_33

小智AI本地编译部署_智能语音_34

小智AI本地编译部署_本地部署_35

小智AI本地编译部署_小智AI_36

小智AI本地编译部署_智能语音_37

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐

  • 浏览量 943
  • 收藏 0
  • 0

所有评论(0)

查看更多评论 
已为社区贡献1条内容