跳转至

ipro_reef_teach

Reef 的 Edge AI 固件:一个镜像包含三个 Teach 工具,image(USB 摄像头+图像分类)、voice(声纹识别)与 sensor(传感器分类),启动时根据 Flash 中保存的模式选择其一运行,由 IPRO AI Studio 操作。完整操作见 IPRO AI Teach

项目 内容
源代码 apps/ai/ipro_reef_teach
开发板与配置 Reef(.config);image 模式需要 OV5640 摄像头
控制台 UART 115200
构建 make -C apps/ai/ipro_reef_teach

在 Reef 上运行

这个固件使用自己的分区表 partition_reef_teach.toml(固件 640 KB、mfg 1364 KB),首次烧录时连同 mfg 数据(启动模式与声纹模型)一起写入。图像与传感器模型之后由 IPRO AI Studio 经 USB 部署。

  1. 构建

    make -C apps/ai/ipro_reef_teach
    

    镜像位于 apps/ai/ipro_reef_teach/build/build_out/ipro_reef_teach_IPRO7.bin(约 360 KB)。

  2. 生成 mfg 数据:启动模式(此处为 image)与随附的声纹模型

    python3 apps/ai/ipro_reef_teach/mfg_payload.py \
        --voice apps/ai/ipro_reef_teach/model/model_b.spkb --mode image -o reef_teach_mfg.bin
    

    在 SDK 根目录生成 reef_teach_mfg.bin。

  3. 烧录:让开发板进入下载模式,在 IntelProCube 目录执行

    ./ipro_iot_tool_macos --chipname ipro7 --chip-variant IPRO7AI \
        --port /dev/cu.usbserial-XXXX --baudrate 921600 \
        --skip-ota --pt <SDK>/apps/ai/ipro_reef_teach/partition_reef_teach.toml \
        --firmware <SDK>/apps/ai/ipro_reef_teach/build/build_out/ipro_reef_teach_IPRO7.bin \
        --mfg <SDK>/reef_teach_mfg.bin
    

    确认输出中有 [All Success],按一下 SW2。之后只更新固件时去掉 --mfg,模式与三个模型都会保留。

  4. 确认模式:以 115200 baud 打开控制台。启动信息中的 RTCH: mode: image 一行表示当前的模式。输入 mode voice,开发板约 2 秒后以声纹模式重启,打印 RTCH: voice ready。

每个模式的 USB-C 标识不同(VID 0x3896):image 为 PID 0x0705(UVC 摄像头+串口),voice 为 0x0720、sensor 为 0x0721(串口)。不安装 IPRO AI Studio 时,可以使用浏览器版图像 Teach(python3 tools/teach_web/serve.py,用 Chrome 或 Edge 打开 http://localhost:8780)。各模式的操作见 IPRO AI Teach。

README

README 原文

以下是应用附带的 README(SDK V2.2.1),保留原文、未翻译;只替换了不适合公开的内容。

One image for the IPRO7AI Reef that runs any of the three Teach tools, one at a time:

mode what it does sources USB IPRO AI Studio page
image USB camera + classifier apps/multimedia/ipro7_uvc_cam 3896:0705, camera + serial Teach
voice who is speaking apps/ai/ipro_reef_teach/voice 3896:0720, serial Audio
sensor any sensor, five simulated apps/ai/ipro_reef_teach/sensor 3896:0721, serial Sensor

This is the one Edge AI firmware for the Reef; the source folders above hold each tool's code and are built only as part of it. The mode stored in flash picks which tool starts at boot, each with its own USB identity, so each IPRO AI Studio page finds the board. Switching stores another mode and restarts into it (about 2 s). Each tool keeps its model in its own slot, so switching loses none of them: deploy all three once and move between them freely.

Switching

  • IPRO AI Studio: open the page for the tool you want. When the Reef is in another mode, the page says so and offers Switch to ….
  • Console (UART0, 115200): mode shows the current one; mode image, mode voice or mode sensor restarts into another.
  • USB: APP / APP <mode> on the voice and sensor serial protocols (answers APP <current> image voice sensor / APP OK <mode>, then the board restarts); on the image one, a 16-byte header "TAPP", u32 mode (0 image, 1 voice, 2 sensor, 0xFFFFFFFF to ask), u32 0, u32 0 (answers TAPP <current> image voice sensor / TAPP OK <mode>).

Build and flash

make -C apps/ai/ipro_reef_teach

This firmware needs its own partition table, partition_reef_teach.toml: the firmware partition is cut to 640 KB (the image is about 360 KB) and mfg grows to 1364 KB so all three models fit at once. PSM, backup, media and factory stay where the stock table has them.

The voiceprint model is flashed with the firmware, together with the mode to start in; the image and Sensor models are deployed from IPRO AI Studio later. Build the mfg payload, then flash everything:

python3 apps/ai/ipro_reef_teach/mfg_payload.py --voice apps/ai/ipro_reef_teach/model/model_b.spkb --mode image \
    -o reef_teach_mfg.bin
TOOL=<IntelProCube dir>/ipro_iot_tool_macos
$TOOL --chipname ipro7 --chip-variant IPRO7AI --port <download UART> --baudrate 921600 \
    --skip-ota --pt apps/ai/ipro_reef_teach/partition_reef_teach.toml \
    --firmware apps/ai/ipro_reef_teach/build/build_out/ipro_reef_teach_IPRO7.bin \
    --mfg reef_teach_mfg.bin

The tool exits 0 even when it fails; look for [All Success]. Leave out --mfg to update only the firmware: the mode and the three models stay.

At boot the console shows the mode:

RTCH:   mode: voice (`mode <image|voice|sensor>` to switch)
SPKM: model 'b3-e12': 437200 B, trunk 16/16 layers on the NPU, ...
RTCH: voice ready - shell `spk`, IPRO AI Studio Audio page over USB-C

The mfg partition

offset size holds
0x000000 4 KB the partition header
0x001000 4 KB the mode: "RTMD", mode, ~mode (blank: image)
0x002000 448 KB voiceprint model (model_b.spkb, b3: 437 KB)
0x072000 512 KB image model (.inm + labels; MobileNetV2 0.35 is 461 KB)
0x0F2000 256 KB Sensor model (.inm + SNS1; the large size is 191 KB)
0x132000 140 KB free

src/reef_mode.h has the map and CMakeLists.txt passes it to the three tools' sources (VOICE_MFG_*, TEACH_MFG_*, SENSOR_MFG_*).

Each slot ends with a 4 KB record of the model store (components/ai/store): a deploy is committed only after it has been written and read back, so a reset during one leaves the slot's model either complete or reported missing (install interrupted), never half written. A slot's room is its size less that sector: voice 444 KB, image 508 KB, Sensor 252 KB. mfg_payload.py writes the voice model's record too, so a model flashed with --mfg is found CRC-checked (SPKM: store: install #1, CRC … checked). Models deployed by the V1.1 firmware are still found (V1.1 payload, no record).

How it is put together

  • main.c reads the mode and starts one tool (src/reef_apps.c) from a task at that tool's own start-up priority.
  • cherryusb calls usbd_event_handler and usbd_cdc_acm_set_dtr by name. Built here (REEF_TEACH_COMBINED), each tool's are renamed <mode>_usbd_... and src/reef_usb.c forwards to the running one.
  • .config is the union of the three tools' configurations, without CONFIG_SINGLE_PRECISION_FLOAT: the Sensor front end has to equal IPRO AI Studio's value for value. The camera sources get -fsingle-precision-constant on their own, as in their firmware.
  • All three tools' static data is linked in (207 KB, in PSRAM); the large buffers (camera frames, sample rings, deploy staging) are allocated at start by the running tool only.
  • Every tool answers the IPRO Edge AI platform's V2.0 queries (device protocol 2 - IPRO Edge AI Programming Guide, Device protocol chapter) with fw=ipro_reef_teach; CAPS/TCAP lists the three modes. IPRO AI Studio's ipro-ai model list --all walks through them and comes back.
  • The AON watchdog is armed (CONFIG_APP_WATCHDOG, 8 s nominal, about 5.6 s on the Reef's RC clock) and fed from a top-priority task by hardware-timer time (components/os/freertos/app_watchdog.h): a stalled SoC restarts in the mode it was in, with its models. Console: watchdog, watchdog test.
  • Test commands on the UART shell: multi [runs] (voice mode: the Sensor model opened beside the voice trunk and both run from two tasks, every output checked against the model alone), sens poll <Hz> <s> and sens prof (sensor mode).

Measured (2026-10-31, Reef)

firmware image 364 KB (397 KB in 2.0.0-rc2, with the NPU timeout and the watchdog)
switching, APP/TAPP to the new mode's port on USB 1.4–2.8 s
all three models deployed (image MobileNetV2 461 KB, voice 437 KB, Sensor large 191 KB), cycled through every mode each still loaded in its own mode
Sensor mode, sim_vib four states taught, large model front end equal to Studio's, NPU within one step, 94 / 94 live
voice mode, enroll from a laptop speaker, name a stranger, stranger mode the same behaviour as the voice tool built on its own
IPRO AI Studio Teach / Sensor / Audio pages, Switch to … the board found in its new mode in 2.2–3.0 s

The image mode's camera pipeline was not run in this test: the test Reef has no camera fitted.

The tools, their pages, the console commands and the device protocol are described in the IPRO7AI Reef user guide and the IPRO Edge AI Programming Guide.