SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (MTB & µPython)
Loading...
Searching...
No Matches
การทดสอบแบบแยกส่วน

Functions

void tesaiot_run_protected_update_isolated_test (void)
 การทดสอบ Protected Update แบบโต้ตอบตั้งแต่ต้นจนจบกับ slot ทดสอบที่แยกไว้; บล็อกอยู่ที่ scanf()

Detailed Description

หนึ่งฟังก์ชัน: การทดสอบ Protected Update แบบโต้ตอบที่ทำงานกับ slot ทดสอบที่แยกไว้ โดยไม่แตะต้องใบรับรอง (certificate) ที่ใช้งานจริง

variant ที่ใช้ได้
mtb-mpy และ mtb-only

Function Documentation

◆ tesaiot_run_protected_update_isolated_test()

void tesaiot_run_protected_update_isolated_test ( void )

การทดสอบ Protected Update แบบโต้ตอบตั้งแต่ต้นจนจบกับ slot ทดสอบที่แยกไว้; บล็อกอยู่ที่ scanf()

Run the Protected Update path end to end against the isolated test slot, leaving the live certificate untouched.

ข้อกำหนดการเรียกใช้
เดินเส้นทาง Protected Update ตั้งแต่ต้นจนจบกับ slot ทดสอบที่แยกไว้ โดยไม่แตะต้องใบรับรอง (certificate) ที่ใช้งานจริง ไม่มี call site (จุดที่มีการเรียกจริง) ในเทมเพลต ผู้เรียกจริงรายเดียวคือ binding optiga.clm_menu() ของ MicroPython ที่อยู่ใน archive (modoptiga.c:1681) ซึ่งปฏิเสธขณะที่ "optiga not initialized" — ตัวอย่างด้านล่างเขียนตามตัวกันนั้น เงื่อนไขก่อนเรียก: ต้องผ่าน optiga_manager_init() และ เปิด application แล้ว (ใน MicroPython optiga.init() ทำทั้งสองอย่างและหยุดการวนถาม (polling) การสัมผัส (touch) ของ CM55 ด้วย) ส่วนตัวทดสอบที่พอร์ตมานั้นสร้าง optiga_util_t ของตัวเองแต่ไม่เคยเปิด application เป็นแบบโต้ตอบ: บล็อกอยู่ที่ scanf() (tesaiot_protected_update_isolated.c:103) และอาศัย stdin แบบวนถามของ retarget-io บน UART ของ CM33_NS จะคืนค่าก็ต่อเมื่อเลือกตัวเลือกออกจากเมนูเท่านั้น — ห้ามเรียกจาก task ที่ระบบย่อยอื่นรออยู่ ต้องเป็น build ที่ตั้ง ENABLE_OPTIGA_CLM=1
variant ที่ใช้ได้
mtb-mpy และ mtb-only
ตัวอย่าง (เขียนขึ้นเอง — ไม่มี call site ในของที่ส่งมอบจริง)
static void bento_ex_tesaiot_run_protected_update_isolated_test(void)
{
/* Probe that the manager is up. optiga_manager_lock() returns false
* when optiga_manager_init() never ran — and, unlike
* optiga_chip_enter(), never lies about an uninitialised manager. */
return; /* not initialised — refuse to run */
}
optiga_manager_unlock(); /* probe only: one unlock per
* successful lock, and do NOT hold
* the lock across the test */
/* The OPTIGA application must already be open (optiga.init() /
* optiga_trust_open_application()) — manager init alone is not
* enough; the test does not open it for you. */
/* Blocks on the UART menu until the operator exits. Dedicated
* maintenance task only. */
}