Add wolfIP Ethernet port for RealTek RTL8735B (AmebaPro2)#141
Draft
dgarske wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new wolfIP Ethernet port/example for the RealTek RTL8735B (AmebaPro2) FreeRTOS SDK environment, including SDK build wiring, a DHCP+TCP echo demo, and an optional wolfSSL TLS client demo. Also introduces a WOLFIP_NO_SYS_HEADERS switch in wolfip.h to avoid conflicts with foreign <sys/socket.h> shims in some RTOS SDKs.
Changes:
- Add
WOLFIP_NO_SYS_HEADERSto bypass system socket header probing and rely on wolfIP’s internal POSIX-type fallbacks. - Introduce
src/port/rtl8735b/with MAC/PHY glue (poll/send), example app, and documentation. - Add RTL8735B SDK integration CMake and a build/flash/run helper script; optionally pulls in wolfSSL sources for the TLS demo.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfip.h | Adds WOLFIP_NO_SYS_HEADERS opt-out to avoid conflicting RTOS socket headers. |
| src/port/rtl8735b/wolfip_rtl8735b.h | Declares RTL8735B Ethernet init/link/maintain API for the port. |
| src/port/rtl8735b/wolfip_rtl8735b.c | Implements the vendor HAL adapter (poll/send), TRNG-backed wolfIP_getrandom, and MAC init wiring. |
| src/port/rtl8735b/wolfip_eth.cmake | SDK build integration; optionally pulls in wolfSSL and the TLS client demo. |
| src/port/rtl8735b/wolfip_cycle.sh | Automates configure/build/flash/log tail for the SDK demo workflow. |
| src/port/rtl8735b/user_settings.h | wolfSSL user settings for the RTL8735B TLS-client demo build. |
| src/port/rtl8735b/tls_client.h | Declares the demo TLS client API. |
| src/port/rtl8735b/tls_client.c | Implements the demo TLS client state machine using wolfIP sockets + wolfSSL I/O glue. |
| src/port/rtl8735b/README.md | Port/demo documentation and run instructions for milestone 1/2. |
| src/port/rtl8735b/main.c | FreeRTOS single-task demo: link/DHCP wait, TCP echo server, optional TLS client. |
| src/port/rtl8735b/config.h | wolfIP stack configuration for the RTL8735B demo build (MTU, sockets, DHCP, static fallback). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+163
to
+191
| /* DMA packet buffers from the vendor DMA-capable heap. */ | ||
| tx_pkt_buf = (uint8_t *)pvPortMallocExt(RTL8735B_TX_DESC_NO * ETH_PKT_BUF_SIZE, 1); | ||
| rx_pkt_buf = (uint8_t *)pvPortMallocExt(RTL8735B_RX_DESC_NO * ETH_PKT_BUF_SIZE, 1); | ||
| if (tx_pkt_buf == NULL || rx_pkt_buf == NULL) | ||
| return -2; | ||
|
|
||
| memset(tx_desc, 0, RTL8735B_TX_DESC_NO * ETH_TX_DESC_SIZE); | ||
| memset(rx_desc, 0, RTL8735B_RX_DESC_NO * ETH_RX_DESC_SIZE); | ||
| memset(tx_pkt_buf, 0, RTL8735B_TX_DESC_NO * ETH_PKT_BUF_SIZE); | ||
| memset(rx_pkt_buf, 0, RTL8735B_RX_DESC_NO * ETH_PKT_BUF_SIZE); | ||
|
|
||
| /* MAC: caller-supplied, else efuse, else locally-administered. */ | ||
| if (mac == NULL) { | ||
| ethernet_address((char *)local_mac); | ||
| if ((local_mac[0] | local_mac[1] | local_mac[2] | | ||
| local_mac[3] | local_mac[4] | local_mac[5]) == 0) { | ||
| local_mac[0] = 0x02; local_mac[1] = 0xE0; local_mac[2] = 0x4C; | ||
| local_mac[3] = 0x87; local_mac[4] = 0x35; local_mac[5] = 0xB0; | ||
| } | ||
| mac = local_mac; | ||
| } | ||
|
|
||
| /* Hook link events, wire rings/buffers/MAC into the HAL, then start. */ | ||
| ethernet_irq_hook(rtl8735b_eth_irq); | ||
| ethernet_set_descnum(RTL8735B_TX_DESC_NO, RTL8735B_RX_DESC_NO); | ||
| ethernet_trx_pre_setting(tx_desc, rx_desc, tx_pkt_buf, rx_pkt_buf); | ||
| ethernet_set_address((char *)mac); | ||
| if (ethernet_init() != 0) | ||
| return -3; |
Comment on lines
+79
to
+83
| memset(&client, 0, sizeof(client)); | ||
| client.stack = stack; | ||
| client.debug_cb = debug; | ||
| client.fd = -1; | ||
| client.state = TLS_CLIENT_STATE_IDLE; |
Comment on lines
+136
to
+137
| /* Try to parse as IP address first */ | ||
| client.server_ip = atoip4(host); |
Comment on lines
+36
to
+37
| L="/tmp/uart-monitor/latest/$LABEL.log" | ||
| FLASH="$HOME/.claude/skills/amebapro2-flash/amebapro2_flash.sh" |
Comment on lines
+13
to
+17
| # Env overrides (defaults shown): | ||
| # WOLFIP_ROOT=~/GitHub/wolfip WOLFSSL_ROOT=~/GitHub/wolfssl | ||
| # SDK=~/GitHub/ameba-rtos-pro2 | ||
| # ASDK_BIN=~/ameba-pro2-workspace/asdk/asdk-10.3.0/linux/newlib/bin | ||
| # LABEL=GENERIC_UART_ttyUSB5 WATCH_SECS=40 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
src/port/rtl8735b/: a wolfIP Ethernet port for the RTL8735B (AmebaPro2) EVB over the vendor FreeRTOS SDK mbed Ethernet HAL (native MAC + integrated FEPHY, no lwIP).poll/senddriver glue; whole stack in one FreeRTOS task.-DWOLFIP_ENABLE_TLS=ON).wolfip_eth.cmakeSDK integration +wolfip_cycle.shhelper.Also adds a
WOLFIP_NO_SYS_HEADERSopt-out inwolfip.h.Hardware-verified: DHCP lease, TCP echo, and a full TLS 1.3 handshake.