Skip to content

Conversation

@Dzarda7
Copy link
Collaborator

@Dzarda7 Dzarda7 commented Nov 19, 2025

Description

This PR adds support for UART reception and processing of SLIP command. It was tested and works on the following targets:

esp32 v3.1
esp32c2 v2.0 (v1.0 does not work!)
esp32c3 v1.0
esp32c6 v0.1
esp32h2 v0.1
esp32s3 v0.2
esp32s2 v1.0
esp32c5 v1.0 and v1.1
esp32p4 v1.2 (need new target for >=v3.0)

Along the way, other stuff was fixed and resolved to enable this like not linking standard libraries which caused build with warnings for newer targets. Erase of bss section and account for checksum in SLIP header.

Related

Related esp-stub-lib PR, not merged yet, needs some modifications: espressif/esp-stub-lib#30

Testing

Tested on mentioned targets using esptool flash-id command. Works, some targets fail because flash chip is not attached, but stub responds correctly.

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@Dzarda7 Dzarda7 self-assigned this Nov 19, 2025
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Messages
📖 You might consider squashing your 4 commits (simplifying branch history).

👋 Hello Dzarda7, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against ae5f342

@Dzarda7 Dzarda7 marked this pull request as draft November 19, 2025 08:18
@Dzarda7 Dzarda7 force-pushed the feat/add_uart_support branch from c082f6b to e6fdc45 Compare November 19, 2025 09:59
@Dzarda7 Dzarda7 requested review from dobairoland, jedi7 and radimkarnis and removed request for dobairoland, jedi7 and radimkarnis November 19, 2025 09:59
@Dzarda7
Copy link
Collaborator Author

Dzarda7 commented Nov 19, 2025

@dobairoland @radimkarnis @jedi7 This is working implementation for UART. I do not expect many changes in the API on esp-stub-lib side, but it waits for merging as some things needs to be decided. But this can be used for testing. Also review can be done I believe.

@dobairoland dobairoland requested a review from Copilot November 19, 2025 18:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements UART reception and SLIP protocol command processing for ESP stub firmware, enabling the stub to receive and decode commands from the host. Key changes include implementing the SLIP decoder state machine with buffer management, adding UART interrupt handling, and fixing BSS initialization and checksum handling issues.

Key changes:

  • Implements complete SLIP frame reception with state machine, error handling, and buffer management
  • Adds UART interrupt handler to receive bytes and process them through SLIP decoder
  • Fixes command handler to account for checksum field in SLIP header and replaces inline register functions with macros

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/slip.h Adds function declarations for frame reception status checking and data retrieval
src/slip.c Implements SLIP decoder state machine with buffering, error detection, and frame completion tracking
src/main.c Adds BSS initialization, UART setup with interrupt handler, and main loop for processing received frames
src/command_handler.c Replaces inline register access functions with macros and accounts for checksum in SLIP header parsing
src/CMakeLists.txt Adds command_handler.c to build sources
esp-stub-lib Updates submodule to version with UART support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dobairoland
Copy link
Collaborator

LGTM in general. Thanks!

Copy link
Member

@radimkarnis radimkarnis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, this LGTM, thank you!

@Dzarda7 Dzarda7 force-pushed the feat/add_uart_support branch 2 times, most recently from 1ef9839 to aea8a71 Compare November 26, 2025 12:36
@Dzarda7 Dzarda7 force-pushed the feat/add_uart_support branch from aea8a71 to 79019f4 Compare November 28, 2025 10:22
@Dzarda7 Dzarda7 force-pushed the feat/add_uart_support branch from 79019f4 to ae5f342 Compare November 28, 2025 12:11
@Dzarda7 Dzarda7 marked this pull request as ready for review November 28, 2025 12:12
@Dzarda7
Copy link
Collaborator Author

Dzarda7 commented Nov 28, 2025

@dobairoland @radimkarnis @jedi7 I believe this should be ready, incorporates all the new changes from esp-stub-lib. I addressed all the suggestions. If you agree, I will merge this.

Copy link
Collaborator

@dobairoland dobairoland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dobairoland dobairoland requested a review from Copilot November 28, 2025 12:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

5 participants