-
Notifications
You must be signed in to change notification settings - Fork 112
feat(esp_isotp): add ISO-TP protocol component's echo example (IEC-376) #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(esp_isotp): add ISO-TP protocol component's echo example (IEC-376) #568
Conversation
} | ||
|
||
/// isotp-c library stub function: print debug message | ||
/** |
Check warning
Code scanning / clang-tidy
Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning
/// isotp-c library stub function: print debug message | ||
/** | ||
* @brief Print a formatted debug message from isotp-c. | ||
* |
Check warning
Code scanning / clang-tidy
Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning
#ifdef ISO_TP_TRANSMIT_COMPLETE_CALLBACK | ||
if (config->tx_callback) { | ||
isotp_set_tx_done_cb(&isotp->link, esp_isotp_tx_wrapper, isotp); | ||
} |
Check warning
Code scanning / clang-tidy
Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump the component version.
And this leftover nitpick: #563 (comment)
b9a00a4
to
77032d6
Compare
77032d6
to
38aab01
Compare
Could I get a Copilot reviewer first? :) |
There was a problem hiding this 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 adds a complete ISO-TP (ISO 15765-2) protocol component for ESP-IDF, enabling automotive and industrial CAN communication applications that require multi-frame data transmission.
- Implements full ISO-TP protocol with single-frame and multi-frame support
- Provides comprehensive echo example with pytest-based testing
- Includes QEMU integration for automated testing without hardware
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
esp_isotp/src/esp_isotp.c | Moves size validation check earlier in TWAI frame transmission function |
esp_isotp/pytest.ini | Configures pytest for QEMU-based testing with CAN bus simulation |
esp_isotp/examples/echo/sdkconfig.defaults | Sets default configuration for echo example |
esp_isotp/examples/echo/pytest_isotp_echo.py | Comprehensive test suite for ISO-TP echo functionality |
esp_isotp/examples/echo/main/isotp_echo_main.c | Main application implementing ISO-TP echo server |
esp_isotp/examples/echo/main/idf_component.yml | Component dependency configuration |
esp_isotp/examples/echo/main/Kconfig.projbuild | Configuration menu for echo example |
esp_isotp/examples/echo/main/CMakeLists.txt | Build configuration for main component |
esp_isotp/examples/echo/conftest.py | Pytest configuration for CAN interface setup |
esp_isotp/examples/echo/README.md | Documentation for echo example usage |
esp_isotp/examples/echo/CMakeLists.txt | Top-level build configuration for echo example |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Total 60KB data simulating firmware transmission. | ||
""" | ||
chunk_size = 2048 | ||
iterations = 30 # 60KB total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment '60KB total' is inconsistent with the actual calculation. 30 iterations × 2048 bytes = 61440 bytes = 60KB. Consider updating the comment to '30 iterations × 2K = 60KB' to be more precise.
iterations = 30 # 60KB total | |
iterations = 30 # 30 iterations × 2K = 60KB |
Copilot uses AI. Check for mistakes.
ESP_ERROR_CHECK(esp_isotp_poll(isotp_handle)); | ||
|
||
// Small delay to ensure accurate STmin timing and prevent 100% CPU usage | ||
vTaskDelay(pdMS_TO_TICKS(CONFIG_EXAMPLE_ECHO_POLL_DELAY_MS)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration symbol CONFIG_EXAMPLE_ECHO_POLL_DELAY_MS is used but not defined in the provided Kconfig file. This should reference CONFIG_EXAMPLE_ECHO_POLL_DELAY_MS which is defined in Kconfig.projbuild.
Copilot uses AI. Check for mistakes.
cmake_minimum_required(VERSION 3.16) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(COMPONENTS main) |
Checklist
url
field definedChange description
Add ESP-IDF ISO-TP Component
This PR adds the
esp_isotp
component, providing a complete ISO-TP (ISO 15765-2) protocol implementation for ESP-IDF. ISO-TP is essential for automotive and industrial applications requiring CAN-based diagnostic communication.Key Features
Component Structure
Testing
Integration Status
Use Cases
This component fills a critical gap for CAN-based applications in the ESP-IDF ecosystem, providing a robust, production-ready ISO-TP implementation with comprehensive testing and documentation.