Skip to content

Add uart#93

Merged
IvanArkhipov1999 merged 15 commits intomainfrom
uart
Oct 2, 2025
Merged

Add uart#93
IvanArkhipov1999 merged 15 commits intomainfrom
uart

Conversation

@IvanArkhipov1999
Copy link
Owner

@IvanArkhipov1999 IvanArkhipov1999 commented Sep 5, 2025

Note

Adds a new uart feature with APIs and ESP32 UART2/IO support, centralizes peripheral init, introduces a UART echo example, updates CI, and does minor refactors/tests tweaks.

  • Core API:
    • Add uart feature in Cargo.toml and public getters get_uart2/get_io; call setup_uart() from init_system() when enabled.
    • Extend PortTrait with type Uart2Type, type IoType, and methods setup_uart(), get_uart2(), get_io().
  • ESP32 (xtensa/riscv32):
    • New peripherals module centralizing esp_hal::init and storing raw handles (TIMG0/1, RNG, RADIO_CLK, WIFI, UART2, GPIO, IO_MUX).
    • Refactor hardware_timer to use centralized peripherals.
    • Update network to pull peripherals from new module.
    • Implement uart module providing UART2/Io acquisition and one-time init.
  • Other Ports:
    • MIPS64: add uart stub module and wire types/methods.
    • Mok: add mock uart module and wire types/methods.
  • Examples & CI:
    • Add examples/rust-examples/xtensa-esp32/uart (UART echo) with tooling/config.
    • CI: add xtensa-esp32-rust-example-uart job to build/format the new example.
  • Scheduler/Tests:
    • Preemptive: replace tight infinite loops with spin_loop, add Default for PreemptiveTaskManager, allow attributes for lints.
    • Tests: gate cooperative tests to skip under preemptive feature.
  • Misc:
    • Minor cleanups: boolean simplifications, #[allow(static_mut_refs)] and similar lints.

Written by Cursor Bugbot for commit 750cdb5. This will update automatically on new commits. Configure here.

- Introduced a new `peripherals` module to manage ESP32 peripheral initialization.
- Updated `setup_hardware_timer` and `setup_uart` functions to utilize the new peripheral management.
- Simplified timer index validation in `valid_timer_index`.
- Adjusted trait methods in `PortTrait` implementations for better clarity and consistency.
- Modified test conditions for cooperative tests to exclude preemptive feature.
Resolved conflicts in src/task_manager/preemptive.rs:
- Kept improved documentation from main branch
- Removed unnecessary #[allow(dead_code)] and #[allow(static_mut_refs)] attributes
- Preserved all functionality from both branches
- Changed code block formatting in documentation to use `rust,ignore` and `text` for better clarity.
- Refactored UART peripheral initialization to support architecture-specific types.
- Updated UART handling in the ESP32 module to use a unified `UartPeriph` type.
- Enhanced task manager documentation to reflect changes in task registration examples.
- Added initialization of peripherals specifically for ESP32 platforms in the `init_system` function.
- Removed direct call to `init_peripherals` from `setup_hardware_timer` to streamline hardware timer setup.
- Introduced a new UART echo example demonstrating UART communication using the Martos RTOS framework.
- Added necessary configuration files including `Cargo.toml`, `.cargo/config.toml`, and `rust-toolchain.toml`.
- Implemented main functionality in `src/main.rs` to handle UART communication, including byte reception and echoing.
- Updated GitHub Actions workflow to include build and formatting steps for the new example.
- Removed unnecessary comments regarding the UART instance signature in both ESP32-C6 and Xtensa examples for clarity.
- Streamlined code documentation to focus on essential information.
- Increased the length of the DRAM segment in the ESP32 linker script from 0x10120 to 0x10200 to accommodate additional memory requirements.
@IvanArkhipov1999 IvanArkhipov1999 merged commit c3e3d80 into main Oct 2, 2025
29 checks passed
@IvanArkhipov1999 IvanArkhipov1999 deleted the uart branch October 2, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant