ast10x0/peripherals/smc: Fix panic paths to pass no_panics tests

Eliminate potential panic vectors in the SMC driver and debug utilities
to allow compile-time verification to pass:
- Replaced variable array indexing with match-based helpers for
  `flash_window_base` and `normal_read_ctrl` in `controller.rs`.
- Refactored `spi_read_data` and `spi_write_data` to use safe chunks
  instead of manual slicing/indexing.
- Replaced divisions in `run_timing_sweep` and `spi_freq_div` with a
  lookup table and multiplication, respectively, to avoid division-by-zero
  panic paths.
- Avoided possible underflow in `poll_blocking_dma_completion` by
  checking the timeout before decrementing.
- Simplified `dump_smc_read` in `target_debug.rs` to use `chunks_exact`
  without `unwrap()`.
- Avoided overflow panics in `dump_smc_register` and `get_mid_point_of_longest_one`.

TAG=agy
CONV=9d66bdb8-5246-47e2-b9b4-6f032c6a9480
3 files changed
tree: a6586d23a8d5f0fb7b4b873469ff6100decc8431
  1. .github/
  2. docs/
  3. drivers/
  4. hal/
  5. openprot/
  6. platform/
  7. presubmit/
  8. services/
  9. target/
  10. third_party/
  11. tools/
  12. util/
  13. .bazelignore
  14. .bazelrc
  15. .bazelversion
  16. .clang-format
  17. .gitignore
  18. .semgrepignore
  19. BUILD.bazel
  20. CONTRIBUTING.md
  21. LICENSE
  22. MODULE.bazel
  23. MODULE.bazel.lock
  24. pw
  25. README.md
  26. rust-toolchain.toml
  27. workflows.json
README.md

OpenPRoT

Technical Charter

The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md

Getting Started

NOTE: We are converting our build system to bazel. We recommend installing bazelisk to automatically manage bazel versions.

Available Tasks

You can run tasks using the Pigweed workflow launcher pw or bazel.

  • ./pw presubmit - Run presubmit checks: formatting, license checks, C/C++ header checks and clippy.
  • ./pw format - Run the code formatters.
  • bazel test //... - Run all tests.
  • bazel build //docs - Build documentation.

Development

The project is structured as a bazel module.

Requirements

  • Bazel. We recommend installing bazelisk to automatically manage bazel versions.

No additional tools are required - all dependencies are managed by bazel.