شعار Esp Bist Skill

Esp Bist Skill

المجتمع
JasonYANG170
esp-bist-skill

AI Skill for Espressif ESP-BIST (Built-In Self Test) safety library development. Used when users need to create, integrate, or debug IEC 60730 Class B self-test firmware on Espressif RISC-V SoCs, including CPU/CSR/PC integrity tests, RAM March A/X, Flash CRC, clock monitoring, stack overflow detection, and watchdog/windowed-WDT integration. Trigger words: "ESP-BIST", "BIST", "IEC 60730", "Class B", "自检", "内置自测", "安全关键", "safety-critical", "March A", "March X", "windowed watchdog", "CRC32", "ESP32-C3", "ESP32-C6", "ESP32-H2", "ESP32-C5"

نظرة عامة

الناشرJasonYANG170
المستودعesp-dev-skill
اسم المهارةesp-bist-skill
النجوم
32
التفريعات
3
الملفات المرفقة
18
الترخيصLGPL-3.0-or-later
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 18

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها JasonYANG170 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Esp Bist Skill في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/JasonYANG170/esp-dev-skill/tree/main/repos/esp-bist
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/JasonYANG170/esp-dev-skill.git /tmp/esp-dev-skill
mkdir -p .claude/skills
cp -r /tmp/esp-dev-skill/repos/esp-bist .claude/skills/esp-bist-skill
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Esp Bist Skill في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Esp Bist Skill تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Esp Bist Skill بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

esp-bist-skill

AI Skill for the Espressif ESP-BIST (Built-In Self Test) library. ESP-BIST is a CMake library providing IEC 60730-1 Annex H (Class B) compliant hardware self-test routines for Espressif RISC-V SoCs: CPU registers, Configuration & Status Registers (CSR), RAM (March A/X), Flash (CRC32), Program Counter, clock sources, stack overflow, watchdog, and digital I/O. This skill provides scenario recipes, a grounded API reference, the real Kconfig option map, consolidated pitfalls, and the canonical post-boot + runtime integration pattern taken from samples/standalone.

Core Principles

  1. Never invent APIs — Every bist_* function, error code, and config symbol MUST be verified against resources/api_reference.md / resources/config_reference.md, which are transcribed from the repo's headers (src/bist/**/include/*.h) and src/bist/Kconfig. If a name is not in those files, it does not exist.
  2. One umbrella header — Application code includes "bist_esp.h" (which pulls bist_esp_types.h + bist_core.h). The watchdog / GPIO / timer driver wrappers need their own headers: "wdt.h", "gpio.h", "esp_timer.h".
  3. Post-boot vs runtime split — Expensive or destructive tests (RAM March, Flash CRC, stack-overflow stress, watchdog reset, crystal) run ONCE at startup. Cheap idempotent tests (CPU regs, CSR, PC, stack-overflow check) run every main-loop iteration. Mirror samples/standalone/main.c.
  4. Every test returns bist_esp_err_t — Never ignore the return value. A non-BIST_ESP_OK result MUST route to a fail-safe handler (fail_safe_exit() infinite loop, or custom). The library never calls your fail-safe for you.
  5. WDT timeout ≥ one RTC tick (≈ 500 µs / 31 µs at 32768 Hz) — wdt_init() returns -1 for any value below one MWDT tick. The repo's own test asserts wdt_init(1) == -1.
  6. Watchdog test is a two-boot sequence — bist_wdt_test() first triggers a reset; success is only detectable on the NEXT boot by checking the reset reason is RESET_REASON_CORE_MWDT0. Do not expect it to "pass" in a single run.
  7. RAM test is non-destructive but needs the linker region — March A/X back up the region into a .dram0.safe_ram backup buffer and relocate the stack to a 256-byte safe stack before testing. The tested region is bounded by linker symbols _bist_ram_test_start .. _dram0_end, defined in src/soc/<target>/ld/linker.ld.
  8. Flash CRC needs the post-build step — bist_flash_test() compares runtime CRC32 of .flash.text / .flash.rodata against reference values injected by scripts/calculate_crc32.py into .crc_section_text / .crc_section_data. If you bypass cmake/project.cmake's post-build hook, the stored CRC is zero and the test fails with BIST_ESP_FLASH_TEST_ERR.
  9. Stack overflow uses a 0xDEADBEEF sentinel — bist_cpu_stack_overflow_init() writes the sentinel at the linker symbol _stack_overflow_protection_start. You MUST call init before bist_cpu_stack_overflow_check() will ever report BIST_ESP_STACK_TEST_OVERFLOW.
  10. CSR/PMP masks are chip-specific and safety-locked — Never write test patterns to PMP Lock or PMA_L bits; they are write-once until power-on reset. The library's masks already exclude them (e.g. PMPCFG mask 0x1D1D1D1D on C3/C6/H2, 0x0D0D0D0D on C5). Do not "improve" the masks.
  11. Windowed WDT detects BOTH too-early and too-late feeds — wdt_init_windowed(underflow_us) defines the bottom of the window; wdt_init(timeout_us) defines the top. wdt_is_underflow_detected() returns true if you fed before the underflow window. On C6/H2 (no XT WDT) the 32 kHz external-crystal test is skipped and returns BIST_ESP_OK.
  12. bist.conf is mandatory — Every application directory must contain a bist.conf (Kconfig syntax). It can be empty (defaults apply) but must exist, and is what compiles individual CONFIG_ESP_BIST_*_TEST modules in or out.

When to Use

Applicable:

  • Building safety-critical firmware on ESP32-C3 / C5 / C6 / C61 / H2 / H4 / P4 targeting IEC 60730-1 Annex H Class B (or IEC 60335-1 Annex R)
  • Integrating ESP-BIST post-boot and runtime self-tests into a new or existing bare-metal/IDF critical firmware
  • Writing or adapting a samples/standalone-style application (windowed WDT, fail-safe exit, runtime test loop)
  • Debugging a specific BIST test failure (BIST_ESP_*_ERR) and mapping it back to the IEC 60730 component
  • Configuring bist.conf / CONFIG_ESP_BIST_* Kconfig options (WDT timeouts, clock drift %, heap size, flash chunk size)
  • Adding performance-metrics collection via the RISC-V Performance Counter CSRs (BIST_METRICS_*)

Not applicable:

  • General ESP-IDF application development with no safety/self-test requirement (use the ESP-IDF skill instead)
  • Non-Espressif or non-RISC-V targets (BIST is RISC-V CSR/PMP/PMA specific)
  • Xtensa-based ESP32 / S2 / S3 / C6* classic cores (the library targets the RISC-V families listed in get_started.rst)
  • PCB / schematic design or analog circuit verification

Scenario Quick Reference (Recipes)

When user intent matches a scenario, read the corresponding recipe first — it carries the complete call chain, real code adapted from the repo, and a common-errors table.

Project Setup & Integration

recipescenario
recipes/project_setup.mdNew BIST application: CMakeLists, bist.conf, MCUboot bootloader, build/flash/QEMU
recipes/standalone_integration.mdFull IEC 60730 integration pattern — post-boot tests + runtime loop + windowed WDT + fail-safe (mirrors samples/standalone)
recipes/zephyr_integration.mdZephyr RTOS on ESP32-C6 HP+LP dual core: west build --sysbuild, mbox ping/pong IPC, LP-core BIST with ulp_lp_core_intr_disable()/enable() (mirrors samples/zephyr)

CPU & Control-Flow Tests

recipescenario
recipes/cpu_register_csr_test.mdCPU general-purpose registers + CSR (trap / PMP / PMA / mexstatus) integrity
recipes/pc_and_stack_test.mdProgram Counter test (IRAM/Flash/RTC placement) + stack overflow init/check/stress
recipes/watchdog_windowed_test.mdWDT reset test + windowed WDT (underflow / overflow / consecutive feeds)

Memory & Clock Tests

recipescenario
recipes/ram_flash_test.mdRAM March A / March X + Flash CRC32 integrity (post-build CRC injection)
recipes/clock_test.mdExternal 32 kHz crystal (XT WDT) + main 40 MHz crystal drift measurement
recipes/gpio_test.mdGPIO output / input plausibility test + invalid-GPIO handling

Utilities

recipescenario
recipes/metrics_collection.mdRISC-V Performance Counter metrics: cycles, instructions, hazards via BIST_METRICS_*

AI Assistant & Tooling

recipescenario
recipes/mcp_server_setup.mdWire the shipped ESP-BIST MCP server (6 tools, FastMCP + BM25) into Cursor / VS Code; regenerate data/*.json via ingest.py; satisfy the mcp_data_drift CI job

Safety Certification

recipescenario
recipes/safety_validation_workflow.mdIEC 60730 Class B evidence workflow: QEMU -icount 3 + GDB :1234 fault injection driven by pytest_qemu_*, JUnit XML → traceability matrix → coverage → tool qualification → safety case summary

Supported SoCs

Source: README.md, src/bist/README.md, docs/en/get_started.rst.

SoCCPU / ArchMax FreqSRAMXT WDT (32 kHz test)CSR count
ESP32-C3Single-core RISC-V160 MHz400 + 8 RTC KBYes (SOC_XT_WDT_SUPPORTED)25
ESP32-C5RISC-V + LP RISC-V240 MHz384 HP + 16 LP KBNo (skipped)39 (+ mexstatus, mhint)
ESP32-C6RISC-V + LP RISC-V160 MHz512 HP + 16 LP KBNo (skipped)37 (PMA addr)
ESP32-H2Single-core RISC-V96 MHz320 + 4 RTC KBNo (skipped)37 (PMA addr)
ESP32-C61 / H4 / P4RISC-V familiesper datasheetper datasheetper chipper chip

Note: The two README files list slightly different active sets (README.md names C3/C5/C6/H2; get_started.rst additionally documents C61/H4/P4 as supported targets). The CI toolchain files in cmake/ cover esp32c3, esp32c5, esp32c6, esp32h2. Prefer those four for guaranteed build support.

Key Configuration (Kconfig)

Full list in resources/config_reference.md. All symbols live in src/bist/Kconfig.

SymbolTypeDefaultPurpose
CONFIG_ESP_BISTboolyMaster enable for the whole library
CONFIG_ESP_BIST_CPU_REG_TESTboolyCompile bist_cpu_regs_test
CONFIG_ESP_BIST_CPU_CSR_REG_TESTboolyCompile bist_cpu_csr_regs_test
CONFIG_ESP_BIST_MEMORY_RAM_TESTboolyCompile March A / March X
CONFIG_ESP_BIST_MEMORY_FLASH_TESTboolyCompile bist_flash_test
CONFIG_BIST_FLASH_TEST_CHUNK_SIZEhex0x1000Flash CRC chunk size (bytes)
CONFIG_ESP_BIST_STACK_TESTboolyCompile stack overflow tests
CONFIG_ESP_BIST_CLOCK_TESTboolyCompile clock tests
CONFIG_ESP_BIST_CLOCK_PERCENT_FREQUENCY_DRIFTint1Allowed main XTAL drift (%)
CONFIG_ESP_BIST_GPIO_TESTboolyCompile GPIO plausibility tests
CONFIG_ESP_BIST_PROGRAM_COUNTER_TESTboolyCompile PC test
CONFIG_ESP_BIST_WATCHDOG_TESTboolyCompile bist_wdt_test
CONFIG_ESP_BIST_FLASH_SIZEhex0x400000Flash size (bytes)
CONFIG_ESP_BIST_HEAP_SIZEhex0x1000Heap size for BIST ops
CONFIG_ESP_BIST_STACK_PROTECTION_BLOCK_SIZEhex0x100Stack sentinel block size
CONFIG_ESP_BIST_WDT_TIMEOUT_USint50000WDT timeout (top of window)
CONFIG_ESP_BIST_WDT_WINDOWED_UNDERFLOW_TIMEOUT_USint10Windowed WDT underflow (bottom)
CONFIG_ESP_BIST_METRICSboolyEnable BIST_METRICS_* macros

Error Code Reference (bist_esp_err_t)

Source: src/bist/include/bist_esp_types.h.

ValueNameMeaning
0BIST_ESP_OKTest passed
1BIST_ESP_CPU_TEST_ERRCPU register test failed
2BIST_ESP_CPU_CSR_TEST_ERRCSR test failed
3BIST_ESP_RAM_TEST_ERRRAM March A/X mismatch
4BIST_ESP_FLASH_TEST_ERRFlash CRC mismatch
5BIST_ESP_PC_TEST_ERRProgram Counter mismatch
6BIST_ESP_CLOCK_TEST_ERRClock failure / drift out of tolerance
7BIST_ESP_STACK_TEST_ERRStack overflow detection mechanism failed
8BIST_ESP_STACK_TEST_OVERFLOWStack sentinel corrupted (overflow detected)
9BIST_ESP_WDT_TEST_ERRWatchdog did not trigger expected reset
10BIST_ESP_IO_TEST_ERRGPIO output/input plausibility failed

Standalone Execution Flow (state machine)

Adapted from docs/en/application_guide.rst and samples/standalone/main.c:

Boot
 │
 ▼
Post-Boot Tests  ── fail ──►  fail_safe_exit()  (infinite loop)
 │ pass
 ▼
bist_cpu_stack_overflow_init()        (write 0xDEADBEEF sentinel)
 │
 ├─ esp_xt_wdt_register_callback(fail_safe_exit)   (only if SOC_XT_WDT_SUPPORTED)
 ├─ wdt_register_callback(wdt_callback)
 ▼
configure_gpio()  →  wdt_init(TIMEOUT_US)  →  wdt_init_windowed(UNDERFLOW_US)
 │
 ▼
┌─── Main Loop ──────────────────────────────────────┐
│  application_logic()                               │
│  runtime_tests():                                  │
│     bist_cpu_regs_test()       → fail_safe_exit    │
│     bist_cpu_csr_regs_test()   → fail_safe_exit    │
│     bist_cpu_stack_overflow_check() → fail_safe_exit │
│     bist_pc_test()             → fail_safe_exit    │
│  wdt_feed()   (must be inside the windowed window) │
└───────────────────── loop ─────────────────────────┘

Critical Pitfalls (Must Read)

These are the most common errors. Each shows a real WRONG vs CORRECT pattern grounded in the repo's headers, examples, and docs.

1. Ignoring the bist_esp_err_t return value

c
// ❌ WRONG — fire-and-forget; a fault passes silently
bist_cpu_regs_test();
bist_cpu_csr_regs_test();

// ✅ CORRECT — route every failure to a fail-safe handler
bist_esp_err_t err = bist_cpu_regs_test();
if (err == BIST_ESP_CPU_TEST_ERR) {
    ESP_LOGE(TAG, "CPU register test failed");
    fail_safe_exit();
}

2. Calling bist_cpu_stack_overflow_check() without init()

c
// ❌ WRONG — sentinel never written, check can never report overflow
while (1) {
    if (bist_cpu_stack_overflow_check() == BIST_ESP_STACK_TEST_OVERFLOW) {
        fail_safe_exit();
    }
}

// ✅ CORRECT — init the 0xDEADBEEF sentinel once after post-boot tests
bist_cpu_stack_overflow_init();   // writes _stack_overflow_protection_start
while (1) {
    if (bist_cpu_stack_overflow_check() == BIST_ESP_STACK_TEST_OVERFLOW) {
        fail_safe_exit();
    }
}

3. Expecting bist_wdt_test() to pass in a single boot

c
// ❌ WRONG — first execution triggers a reset; "OK" only appears next boot
int main(void) {
    if (bist_wdt_test() != BIST_ESP_OK) fail_safe_exit();  // always resets first time
}

// ✅ CORRECT — two-boot design: trigger reset, then verify reset reason on next boot
//   The library checks reset reason == RESET_REASON_CORE_MWDT0 internally.
//   Integrate into post-boot tests (see samples/standalone) and accept the reboot.
static void post_boot_tests(void) {
    bist_esp_err_t err = bist_wdt_test();
    if (err == BIST_ESP_WDT_TEST_ERR) fail_safe_exit();
}

4. WDT timeout below one RTC tick

c
// ❌ WRONG — 1 us is below one MWDT tick (~31 us @ 32768 Hz); init refuses
wdt_init(1);   // returns -1, watchdog never starts

// ✅ CORRECT — minimum accepted is 500 us (one MWDT tick)
if (wdt_init(500) != 0) {
    ESP_LOGE(TAG, "WDT init failed");
    fail_safe_exit();
}
// Or use the configured default:
wdt_init(CONFIG_ESP_BIST_WDT_TIMEOUT_US);

5. Forgetting the windowed WDT lower bound

c
// ❌ WRONG — only top of window set; underflow (too-early feed) undetected
wdt_init(50000);
while (1) { /* ... */ wdt_feed(); }   // feeding in a tight loop looks "fine"

// ✅ CORRECT — both bounds; feed only after the underflow window elapses
wdt_init(50000);                              // top of window
wdt_init_windowed(2000);                      // bottom of window (2 ms)
while (1) {
    /* application work taking >= underflow_us */
    wdt_feed();
    if (wdt_is_underflow_detected()) fail_safe_exit();
}

6. Calling wdt_feed() immediately after wdt_init_windowed() then again too soon

c
// ❌ WRONG — the first feed clears window_open_flag; an immediate second feed
//            fires the underflow violation (this is the repo's own negative test)
wdt_init_windowed(2000);
wdt_feed();
ets_delay_us(100);   // << underflow window
wdt_feed();          // wdt_is_underflow_detected() == true

// ✅ CORRECT — wait >= underflow_timeout_us between feeds
ets_delay_us(UNDERFLOW_TIMEOUT_US + FEED_MARGIN_US);
wdt_feed();
TEST_ASSERT_FALSE(wdt_is_underflow_detected());

7. Flash CRC "fails" because the post-build injection step was skipped

c
// ❌ WRONG — custom build system that never runs scripts/calculate_crc32.py
//            _crc_section_text_start / _crc_section_data_start stay zero
bist_flash_test();   // → BIST_ESP_FLASH_TEST_ERR

// ✅ CORRECT — build through cmake/project.cmake, which runs post-build:
//   python scripts/calculate_crc32.py <elf> .flash.text  .crc_section_text
//   python scripts/calculate_crc32.py <elf> .flash.rodata .crc_section_data
// Then at runtime the stored CRCs are non-zero and bist_flash_test() returns OK.

8. Passing an invalid GPIO number to the IO test

c
// ❌ WRONG — SOC_GPIO_PIN_COUNT / -1 are out of range
bist_gpio_output_test(SOC_GPIO_PIN_COUNT);   // → BIST_ESP_IO_TEST_ERR
bist_gpio_input_test(-1, 0);                 // → BIST_ESP_IO_TEST_ERR

// ✅ CORRECT — use a real, board-routed GPIO; input test needs external level
#define LED_GPIO 7
#define BTN_GPIO 9
bist_gpio_output_test(LED_GPIO);                 // expect BIST_ESP_OK
bist_gpio_input_test(BTN_GPIO, 1);               // button tied high = expect 1

9. Running GPIO tests AFTER the application has reconfigured the pins

c
// ❌ WRONG — IO tests reset and reconfigure pins; do them before app GPIO setup
configure_led();        // sets GPIO7 as output
bist_gpio_output_test(LED_GPIO);   // pin state fight with app config

// ✅ CORRECT — order matches samples/standalone: tests first, then app config
post_boot_tests();      // includes bist_gpio_output_test / input_test
configure_led();
configure_button();

10. Expecting the 32 kHz external-crystal test to actually run on C6/H2

c
// ❌ WRONG — assuming the test will catch a dead 32 kHz crystal on C6/H2
// (those SoCs lack SOC_XT_WDT_SUPPORTED; the test returns BIST_ESP_OK = "skipped")
if (bist_ext_crystal_fail_test() != BIST_ESP_OK) fail_safe_exit();

// ✅ CORRECT — guard with SOC_XT_WDT_SUPPORTED; rely on main crystal test otherwise
bist_esp_err_t err = bist_ext_crystal_fail_test();   // skipped → OK on C6/H2
if (err == BIST_ESP_CLOCK_TEST_ERR) fail_safe_exit();
err = bist_main_crystal_test();                       // always validates 40 MHz
if (err == BIST_ESP_CLOCK_TEST_ERR) fail_safe_exit();

11. Defining wdt_callback without IRAM_ATTR

c
// ❌ WRONG — MWDT callback runs before reset from IRAM context; a flash callback
//            may fault if flash cache is disabled
void wdt_callback(void *args) { ESP_LOGE(TAG, "WDT"); }

// ✅ CORRECT — place the callback in IRAM (as samples/standalone does)
void IRAM_ATTR wdt_callback(void *args) {
    ESP_LOGE(TAG, "User WDT callback triggered");
}
wdt_register_callback(wdt_callback, NULL);

12. Omitting the mandatory bist.conf file

bash
# ❌ WRONG — empty app dir, no bist.conf; build fails or uses no module selection
my_app/
└── main.c

# ✅ CORRECT — bist.conf is mandatory even when empty (defaults apply)
my_app/
├── CMakeLists.txt
├── bist.conf        # can be empty, or pin CONFIG_ESP_BIST_*_TEST=y/n
└── main.c

Execution Workflow

StepNameDescription
1PlanIdentify target SoC, which IEC 60730 components apply, post-boot vs runtime split
2RecipeIf the scenario matches a recipe in recipes/, follow its call chain and code
3QueryFor any API/config not in a recipe, look it up in resources/api_reference.md or resources/config_reference.md
4ValidateVerify the function name exists in resources/api_reference.md; verify the Kconfig symbol exists in resources/config_reference.md; if absent, do NOT invent it
5ConfirmPresent: includes (bist_esp.h + driver headers), bist.conf, init order, runtime loop, fail-safe path
6ExecuteFor a new app, copy the closest reference: samples/standalone/ for full integration, or tests/<name>/ for a single test, then modify
7Buildcmake -DSOC_TARGET=<target> -B build -GNinja && ninja -C build (after . $IDF_PATH/export.sh)
8Runninja -C build qemu (QEMU) or ninja -C build flash + ninja -C build monitor (device)
9VerifyConfirm each test prints BIST_ESP_OK; on a deliberate fault (fault-injection via GDB) confirm fail_safe_exit() triggers
10CertifyUse docs/en/test_traceability_matrix.rst + docs/en/safety_case_summary.rst for IEC 60730 evidence

Step 6 Detail — Project Creation Strategy

  • Full IEC 60730 integration → copy samples/standalone/ (has main.c, CMakeLists.txt, bist.conf, post-boot + runtime + windowed WDT)
  • Single-test harness (Unity) → copy tests/<test_name>/ (e.g. tests/cpu_reg_test/, tests/ram_test/, tests/windowed_wdt_test/)
  • Zephyr integration → start from samples/zephyr/
  • Always edit the copied bist.conf to enable exactly the CONFIG_ESP_BIST_*_TEST modules you need (see any tests/*/bist.conf for the pattern).

Failure Strategies

SituationAction
A bist_* name is not in resources/api_reference.mdStop; the API does not exist in this version of the library. Inform the user.
wdt_init() returns -1The timeout is below one MWDT tick (≈ 500 µs / 31 µs). Raise it to at least 500 µs.
bist_flash_test() fails on a fresh buildConfirm the post-build CRC injection (scripts/calculate_crc32.py) ran via cmake/project.cmake; check _crc_section_text_start is non-zero.
bist_cpu_stack_overflow_check() never tripsbist_cpu_stack_overflow_init() was not called, or the linker symbol _stack_overflow_protection_start is mis-placed.
bist_ext_crystal_fail_test() "passes" on C6/H2 with no crystalExpected — on SoCs without SOC_XT_WDT_SUPPORTED the test is skipped (BIST_ESP_OK). Use bist_main_crystal_test() for clock validation.
Windowed WDT flags underflow unexpectedlyApplication loop is faster than CONFIG_ESP_BIST_WDT_WINDOWED_UNDERFLOW_TIMEOUT_US. Either raise the underflow value or add a deliberate delay before wdt_feed().
wdt_init_windowed() "first feed then immediate feed" underflowsThis is by design (the repo's test_BIST_WINDOWED_WDT_UNDERFLOW proves it). Wait ≥ underflow window between feeds.
Unsure which CSR mask appliesIt is chip-specific and already encoded in the library (PMPCFG 0x1D1D1D1D on C3/C6/H2, 0x0D0D0D0D on C5; PMA not tested for cfg due to write-once Lock bit). Do not override.
Build cannot find esp_xt_wdt.hThat header comes from the ESP-IDF HAL (components/), not the BIST tree. Guard its use with #if SOC_XT_WDT_SUPPORTED.

References

  • Scenario recipes → recipes/ directory
  • API quick reference (every bist_* signature) → resources/api_reference.md
  • Kconfig / config reference → resources/config_reference.md
  • Consolidated pitfalls → resources/pitfalls.md
  • Real example & sample paths index → resources/example_list.md
  • Upstream repo → https://github.com/espressif/esp-bist

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Esp Bist Skill؟

AI Skill for Espressif ESP-BIST (Built-In Self Test) safety library development. Used when users need to create, integrate, or debug IEC 60730 Class B self-test firmware on Espressif RISC-V SoCs, including CPU/CSR/PC integrity tests, RAM March A/X, Flash CRC, clock monitoring, stack overflow detection, and watchdog/windowed-WDT integration. Trigger words: "ESP-BIST", "BIST", "IEC 60730", "Class B", "自检", "内置自测", "安全关键", "safety-critical", "March A", "March X", "windowed watchdog", "CRC32", "ESP32-C3", "ESP32-C6", "ESP32-H2", "ESP32-C5"

لماذا تستخدم Esp Bist Skill على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Esp Bist Skill عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Esp Bist Skill في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/JasonYANG170/esp-dev-skill/tree/main/repos/esp-bist. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Esp Bist Skill؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Esp Bist Skill؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Esp Bist Skill معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Esp Bist Skill مجانية؟

نعم. نشرها JasonYANG170 على GitHub بموجب ترخيص LGPL-3.0-or-later. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇