
device-4b
by XuNeo
SKILL.md
name: device-4b description: "Operate Device 4B hardware including firmware download, flashing via fastboot, adb control, serial monitoring via minicom, and JLink debugging. Use when working with Device 4B or 4b device. Integrates with jira-crash for firmware retrieval and gdb-start for debugging." license: MIT compatibility: Requires fastboot, adb, minicom, JLinkGDBServer. Linux environment with USB access.
Device 4B Skill
Operate Device 4B hardware for firmware flashing, debugging, and monitoring.
Workflow Overview
- Get Firmware - Download from CI (URL in JIRA) or local build
- Flash Firmware - Use fastboot to flash images
- Monitor Serial - Use minicom for UART console
- Debug - Use JLink GDB server + gdb-start skill
- Control - Use adb for shell access
Skill Integration
| Task | Skill | When to Use |
|---|---|---|
| Interactive sessions | tmux skill | User needs to interact with device/console |
| Automated operations | executor skill | Fully automated tasks without interaction |
| GDB debugging | gdb-start skill | Connect to JLink GDB server |
| Get firmware URL | jira-crash skill | Retrieve firmware from JIRA issue |
Firmware Acquisition
From JIRA (Recommended)
Use the jira-crash skill to get firmware URL from JIRA issue description.
Firmware URL pattern:
https://storage.example.internal/ci-artifacts/{project}-CI/{build_number}/{timestamp}.tar.gz
Example:
https://storage.example.internal/ci-artifacts/embedded-dev-system-CI/16807/2026011909541.tar.gz
Download and Extract
# Download
wget -O firmware.tar.gz "{firmware_url}"
# Extract
mkdir -p ~/tmp/{timestamp}/images
tar -xzf firmware.tar.gz -C ~/tmp/{timestamp}/images/
Firmware Directory Structure
After extraction, the image directory contains:
firmware/
├── image_nokasan/ # Combined flash image (default) - FLASHABLE
│ ├── vela_res.bin # Resource partition image (fastboot flashable)
│ ├── vela_tee.bin # TEE partition image (fastboot flashable)
│ └── usrdata.fex # User data partition (fastboot flashable)
├── image_debug/ # Combined flash image (debug) - FLASHABLE
├── image_test/ # Combined flash image (test) - FLASHABLE
├── image_bootloader_test/ # Combined flash image (bootloader test) - FLASHABLE
├── ap/ # AP core firmware - DEBUG ONLY
│ ├── vela_ap.elf # ELF with debug symbols (for GDB)
│ ├── vela_ap.bin # Binary image
│ └── .config # Build configuration
├── ap_debug/ # AP core firmware (debug) - DEBUG ONLY
├── ap_test/ # AP core firmware (test) - DEBUG ONLY
├── bootloader/ # Bootloader firmware - DEBUG ONLY
│ ├── vela_bl.elf # ELF with debug symbols (for GDB)
│ └── vela_bl.bin # Binary image
├── tee/ # TEE firmware - DEBUG ONLY
│ ├── vela_tee.elf # ELF with debug symbols (for GDB)
│ └── vela_tee.bin # Binary image
├── ota/ # OTA firmware - DEBUG ONLY
└── build_cmd # Build commands reference
Important Notes
- Only
image_xxx/directories contain flashable images (vela_res.bin, vela_tee.bin, usrdata.fex) - Other directories (ap/, tee/, bootloader/) provide ELF files for debugging only
- Default: Use
image_nokasan/unless user specifies otherwise
Image Selection
| Use Case | Directory | Description |
|---|---|---|
| Normal use | image_nokasan/ | Default, no KASAN |
| Debug build | image_debug/ | With debug symbols |
| Test build | image_test/ | With test features |
| Bootloader test | image_bootloader_test/ | Bootloader testing |
Fastboot Flashing
Prerequisites
Before using fastboot:
# Enable debug mode on device first
echo "" > /data/debugmode
Troubleshooting fwupd Conflict
If fastboot hangs or device stuck in bootloader:
# Check if fwupd is running
ps -ef | grep fwupd | grep -v grep
# Disable fwupd service
sudo systemctl stop fwupd.service
sudo systemctl disable fwupd.service
sudo chmod -x /usr/libexec/fwupd/fwupd
Enter Fastboot Mode
# Method 1 - From device shell (if device is responsive)
reboot bootloader
# Method 2 - Via ADB (if ADB is available)
adb reboot bootloader
# Method 3 - Auto-download mode (if device is bricked)
# 1. Run fastboot command on host (enters "< waiting for any device >" state)
# 2. Reboot/power cycle device
# 3. Device will stop in bootloader when it receives PC packet
Verify device detected:
fastboot devices
Flash Partitions
Flash res partition (contains AP firmware):
fastboot flash res {image_dir}/image_nokasan/vela_res.bin
Flash tee partition:
fastboot flash tee {image_dir}/image_nokasan/vela_tee.bin
# Or from tee directory:
fastboot flash tee {image_dir}/tee/vela_tee.bin
Flash bootloader partition:
fastboot flash bootloader {image_dir}/bootloader/vela_bl.bin
Flash usrdata partition (must erase first):
fastboot erase usrdata
fastboot flash usrdata {image_dir}/image_nokasan/usrdata.fex
Reboot After Flashing
fastboot reboot
Fastboot Commands Reference
| Command | Description |
|---|---|
fastboot devices | List connected devices |
fastboot flash {partition} {file} | Flash partition |
fastboot erase {partition} | Erase partition |
fastboot reboot | Reboot device |
fastboot getvar product | Get product name |
fastboot getvar version | Get version |
fastboot getvar max-download-size | Get max download size |
Partition Names
| Partition | Content |
|---|---|
res | Resource partition (contains vela_ap.bin) |
tee | TEE firmware |
bootloader | Bootloader |
usrdata | User data (yaffs filesystem) |
ADB Control
After device boots:
Verify Connection
adb devices
Shell Access
adb shell
Common ADB Commands
| Command | Description |
|---|---|
adb devices | List connected devices |
adb shell | Interactive shell |
adb shell {cmd} | Run single command |
adb push {local} {remote} | Push file to device |
adb pull {remote} {local} | Pull file from device |
adb logcat | View system logs |
adb reboot | Reboot device |
adb reboot bootloader | Reboot to fastboot |
Serial Monitoring (minicom)
Start minicom
minicom -D /dev/ttyUSB0 -b 921600
Baud rate: 921600 (fixed for X4B)
Common serial ports:
/dev/ttyUSB0- USB-UART adapter/dev/ttyACM0- CDC ACM device
minicom Shortcuts
| Key | Action |
|---|---|
Ctrl-A Z | Help menu |
Ctrl-A X | Exit minicom |
Ctrl-A Q | Quit without reset |
Ctrl-A L | Capture to file |
Use the tmux skill to run minicom in a managed session for interactive monitoring.
JLink Debugging
Start JLink GDB Server
Connect to Core 0 (AP):
JLinkGDBServer -if JTAG -speed 1000KHZ -device R528S3-CORE0 -port 23331
Connect to Core 1 (TEE):
JLinkGDBServer -if JTAG -speed 1000KHZ -device R528S3-CORE1 -port 23332
JLink Parameters
| Parameter | Description |
|---|---|
-if JTAG | Interface type (JTAG) |
-speed 1000KHZ | JTAG clock speed |
-device R528S3-CORE0 | AP core |
-device R528S3-CORE1 | TEE core |
-port {port} | GDB server port |
Connect GDB
Use the gdb-start skill to connect GDB to JLink GDB server.
ELF files for debugging:
- AP:
{image_dir}/ap/vela_ap.elf - TEE:
{image_dir}/tee/vela_tee.elf - Bootloader:
{image_dir}/bootloader/vela_bl.elf
GDB target:
- Core 0 (AP):
localhost:23331 - Core 1 (TEE):
localhost:23332
Use the tmux skill to run JLinkGDBServer in interactive session.
Quick Reference
Flash and Boot
# 1. Download firmware (get URL from JIRA via jira-crash skill)
wget -O fw.tar.gz "{url}"
tar -xzf fw.tar.gz
# 2. Enter fastboot mode
adb reboot bootloader
# Or from device shell: reboot bootloader
# 3. Flash (use image_nokasan by default)
fastboot flash res firmware/image_nokasan/vela_res.bin
fastboot flash tee firmware/image_nokasan/vela_tee.bin
fastboot reboot
# 4. Verify
adb devices
adb shell
Debug Session
# 1. Start JLink GDB Server (use tmux skill for interactive session)
JLinkGDBServer -if JTAG -speed 1000KHZ -device R528S3-CORE0 -port 2331
# 2. Connect GDB (use gdb-start skill)
# Target: localhost:2331
# ELF: firmware/ap/vela_ap.elf
Serial Monitor
# Use tmux skill to run minicom
minicom -D /dev/ttyUSB0 -b 1500000
Memory Dump (Crash Analysis)
Dump device memory via fastboot for crash analysis.
Enable Dump Mode
Before crash occurs, enable dump mode on device:
echo "" > /data/dumpmode
When device crashes, it will automatically stop in bootloader mode, allowing memory dump.
Dump Memory
# Device is in bootloader after crash
# Dump memory region (address, size)
fastboot oem memdump 0x40000000 0x8000000
# Retrieve the dump file
fastboot get_staged 0x40000000.bin
Parameters
| Parameter | Description |
|---|---|
0x40000000 | Start address (DRAM base) |
0x8000000 | Size (128MB) |
Common Memory Regions
| Region | Address | Size | Description |
|---|---|---|---|
| DRAM | 0x40000000 | 0x8000000 | Main memory (128MB) |
Use with crash-analysis skill to analyze the memory dump with ELF symbols.
Troubleshooting
| Issue | Solution |
|---|---|
fastboot devices empty | Check USB, ensure device in fastboot mode |
| Fastboot hangs | Disable fwupd service (see above) |
adb devices unauthorized | Accept authorization on device |
/dev/ttyUSB0 permission denied | sudo usermod -aG dialout $USER |
| JLink connection failed | Check JTAG cable, verify device power |
| AVB signature error | Update bootloader to 0825+ version |
| Image rollback error | Update bootloader to 0825+ version |
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon