-
Notifications
You must be signed in to change notification settings - Fork 117
new feature: Add RT-Thread platform support #1012
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: main
Are you sure you want to change the base?
new feature: Add RT-Thread platform support #1012
Conversation
|
PR missing one of the required labels: {'internal', 'breaking-change', 'bug', 'documentation', 'enhancement', 'new feature', 'dependencies'} |
- Implement platform abstraction layer for RT-Thread RTOS - Add network layer with TCP/UDP unicast/multicast support - Integrate with RT-Thread build system (SCons, Kconfig) - Provide comprehensive examples and documentation - Support RT-Thread 4.0+ with lwIP network stack - Memory optimized for embedded environments (16-32KB RAM) Features implemented: - Multi-threading with RT-Thread primitives - Memory management using RT-Thread allocators - Network communication (TCP/UDP unicast/multicast) - Time management and sleep functions - Synchronization primitives (mutexes, condition variables) - Random number generation - MSH command integration for examples - Kconfig-based configuration - SCons build system integration Testing completed: - Basic functionality (memory, threads, mutexes, time) - Network operations (TCP/UDP sockets, multicast) - Zenoh protocol (sessions, pub/sub, query/reply) - Integration with RT-Thread build system
b9728e8 to
83c2d09
Compare
|
PR missing one of the required labels: {'breaking-change', 'bug', 'new feature', 'dependencies', 'documentation', 'enhancement', 'internal'} |
|
This workflow requires one of the following labels: internal, breaking-change, bug, documentation, enhancement, new feature, dependencies. |
|
Could you please add the "new feature" label to this PR? This adds RT-Thread platform support to zenoh-pico. @eclipse-zenoh/maintainers |
| return ret; | ||
| } | ||
|
|
||
| (void)memcpy(&ep->_sockaddr, result->ai_addr, result->ai_addrlen); |
Check failure
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Error
| } | ||
|
|
||
| if (ret == _Z_RES_OK) { | ||
| (void)memcpy(&sock->_addr, &rep._sockaddr, sizeof(struct sockaddr_in)); |
Check failure
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Error
| case AF_INET6: { | ||
| struct ipv6_mreq mreq; | ||
| (void)memset(&mreq, 0, sizeof(mreq)); | ||
| (void)memcpy(&mreq.ipv6mr_multiaddr, &((struct sockaddr_in6 *)&rep._sockaddr)->sin6_addr, |
Check failure
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Error
| } | ||
|
|
||
| if (ret == _Z_RES_OK) { | ||
| (void)memcpy(&sock->_addr, &rep._sockaddr, sizeof(struct sockaddr_in)); |
Check failure
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Error
|
|
||
| if ((rb != SIZE_MAX) && (addr != NULL)) { | ||
| *addr = _z_bytes_make(raddrlen); | ||
| (void)memcpy((uint8_t *)addr->start, &raddr, raddrlen); |
Check failure
Code scanning / Flawfinder (reported by Codacy)
Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Error
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.
Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Markdownlint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Add RT-Thread Platform Support
Summary
This PR adds comprehensive support for the RT-Thread real-time operating system to zenoh-pico, enabling zenoh communication capabilities on RT-Thread-based embedded devices.
Changes Overview
🎯 Platform Abstraction Layer
Platform Header:
include/zenoh-pico/system/platform/rtthread.hSystem Implementation:
src/system/rtthread/system.crt_tick_get()rt_malloc/rt_realloc/rt_freeNetwork Implementation:
src/system/rtthread/network.c⚙️ Configuration System
RT-Thread Config:
include/zenoh-pico/config_rtthread.hBuild Integration:
SConscript- SCons build script for RT-Thread projectsKconfig- Configuration options for RT-Thread menuconfigpackage.json- RT-Thread package descriptorPlatform Detection: Updated
include/zenoh-pico/config.handinclude/zenoh-pico/system/platform.h📚 Examples and Documentation
Example Programs:
examples/rtthread/z_pub.c- Publisher exampleexamples/rtthread/z_sub.c- Subscriber exampleexamples/rtthread/z_get.c- GET query exampleexamples/rtthread/z_put.c- PUT exampleexamples/rtthread/z_test.c- Basic functionality testDocumentation:
README_RTTHREAD.md- Comprehensive usage guideFeatures Implemented
✅ Core Functionality
✅ RT-Thread Integration
✅ Network Protocols
Testing
Basic Functionality Tests
Network Tests
Zenoh Protocol Tests
Compatibility
RT-Thread Versions
Network Stack
Memory Requirements
Performance Characteristics
Usage Example
Integration Instructions
Add to RT-Thread Project:
# Copy to RT-Thread packages directory cp -r zenoh-pico /path/to/rtthread/packages/iot/Configure Features:
scons --menuconfig # Navigate to: RT-Thread online packages -> IoT -> zenoh-picoBuild and Run:
scons # In RT-Thread MSH: zenoh_test, zenoh_pub, zenoh_subBreaking Changes
None. This is a new platform addition that doesn't affect existing platforms.
Checklist
Related Issues
This PR addresses the need for RT-Thread support in zenoh-pico, enabling zenoh communication on one of the most popular Chinese RTOS platforms used in IoT and embedded applications.
Future Enhancements