This directory contains a full system integration test for the USART (Universal Synchronous/Asynchronous Receiver-Transmitter) driver on the AST10x0 platform. The test validates that the USART server and client communicate correctly over IPC channels in a multi-process QEMU-based simulation.
target.rs: Kernel entry point for the AST10x0 virt targetserver_main.rs: USART server process - handles requests from clientsclient_main.rs: USART client process - sends configuration and write requestssystem.json5: System configuration file defining memory layout and process definitionsBUILD.bazel: Bazel build rules and test targetsARM Cortex-M4 @ 200 MHz, 768KB SRAM (0x00000000 - 0x000BFFFF) 0x00000000 - 0x00000500: Vector table (1280 bytes) 0x00000500 - 0x00020000: Kernel code (~126KB, ends at 128KB boundary) 0x00020000 - 0x00060000: ipc multi-process app code (256KB, two processes) 0x00060000 - 0x00080000: Kernel RAM (128KB) 0x00080000 - 0x000A0000: App RAM (128KB)
The test instantiates two processes:
USART Server (usart_server_bin):
//drivers/usart/server:usart_serverUSART Client (usart_client_app):
"usart client online\r\n"//drivers/usart/client:usart_clientbazelisk installed and in PATH# Run with virt_ast10x0 platform config bazelisk test //target/ast10x0/tests/usart:usart_test --config=virt_ast10x0 # With verbose/streamed output bazelisk test //target/ast10x0/tests/usart:usart_test --config=virt_ast10x0 --test_output=streamed # Show all test output bazelisk test //target/ast10x0/tests/usart:usart_test --config=virt_ast10x0 --test_output=all
INFO: Found 1 test target... Target //target/ast10x0/tests/usart:usart_test up-to-date: bazel-bin/target/ast10x0/tests/usart/usart_test INFO: Build completed successfully, X total actions //target/ast10x0/tests/usart:usart_test PASSED in 0.4s Executed 1 out of 1 test: 1 test passes.
System Initialization:
Server Setup:
Signals::READABLEruntime::run()Client Execution:
UsartClient with IPC handleconfigure(1_500_000) callwrite(b"usart client online\r\n") callServer Processing:
object_wait()channel_respond()Test Completion:
debug_shutdown(Ok(()))The test uses the concrete AST10x0 USART backend:
//target/ast10x0/backend/usart:usart_backend_ast10x0Defined in //drivers/usart/api:
UsartOp enum: Configure, Write, Read, GetLineStatus, (Enable/Disable)InterruptsUsartError variants: Success, InvalidOperation, BufferTooSmall, Busy, Timeout, etc.Dispatch loop in //drivers/usart/server:runtime:
user_data:If Bazel build fails with incompatibility error:
ERROR: Target is incompatible and cannot be built
Solution: Use --config=virt_ast10x0 to set the correct platform.
If test hangs or times out:
--test_output=all| Symptom | Cause | Fix |
|---|---|---|
| Process crashes at startup | Missing codegen or wait group | Rebuild with clean cache |
| IPC channel not found | Incorrect process/object names | Match system.json5 and codegen |
| USART timeout | Backend not driving UART5 | Check backend initialization |
| Data corruption | Buffer overflow or alignment | Verify MAX_PAYLOAD_SIZE contract |
This test is a foundation for:
try_read, try_write)get_async_result)See ASYNC_NONBLOCKING_IMPLEMENTATION_PLAN.md for planned enhancements.
After a successful build, the test artifacts are located at:
bazel-bin/target/ast10x0/tests/usart/ ├── usart # System image (kernel + rootfs) ├── usart_test # Test runner ├── usart_server_bin # Compiled server binary └── usart_client_app # Compiled client binary
When modifying this test:
Licensed under the Apache-2.0 license. See LICENSE file in repository root.