Merged
Conversation
Add ESP32-S3 (Xtensa LX7) WiFi blob libraries from esp-wifi and platform-specific files: - esp32s3/esp32s3.go: clock init, MAC read, PHY/WiFi isolation - esp32s3/esp_phy_adapter.c: PHY calibration and register save/restore - esp32s3/isr.c: interrupt vectoring for WiFi MAC - radio_esp32s3.go: hardware init, ISR handler, per-target constants - blobs/libs/esp32s3/: prebuilt WiFi/BT/PHY libraries Remove .vscode/settings.json from version control.
Adapt shared radio, ISR, netif, and OSI code for both targets: - radio.c: conditional phy_get_romfunc_addr (C3 only), manual wifi_init_config for Xtensa OR-offset workaround, WDT disable for both C3 (RISC-V registers) and S3 (Xtensa registers) - radio.go: extract wifiISRHandler to per-target files, add arena pool init from Go heap, schedOnce with ROM pointer save/restore - radio_esp32c3.go: direct ISR call, per-target arena pool size - espradio.h: add espradio_arena_init declaration - isr.c: support both RISC-V and Xtensa interrupt dispatch - netif.c: ROM pointer save/restore, function table relocation - osi.c: extended OSI function table for S3 blob compatibility - examples/scan: minor adjustment for dual-target testing
Replace the static BSS arena with a proper allocator inside a pool that Go allocates at startup (kept alive by a package-level variable so the GC won't collect it). The WiFi blob stores pointers in ROM BSS which is outside the GC's scan range, so individual malloc'd objects get collected. A single large pool kept reachable from Go avoids this. Features: - First-fit free-list with block splitting - O(1) coalescing on free via boundary tags (header + footer) - 8-byte aligned, min block 24 bytes - realloc via alloc+memcpy+free with correct old-size tracking - espradio_arena_stats walks all blocks for usage reporting - __wrap_malloc/free/calloc/realloc on S3 route blob calls through arena - Pool size: 32KB on C3 (limited DRAM), 80KB on S3
Add tools/patch_xtensa_literals.go to fix two Xtensa ELF relocation issues that cause LLD to mislink WiFi blob .a libraries: 1. Propagate R_XTENSA_ASM_EXPAND addends to paired R_XTENSA_32 literal pool entries (LLD ignores ASM_EXPAND relocations) 2. Move in-place addends into RELA r_addend fields for section- relative R_XTENSA_32 relocations (Xtensa GCC stores addends in-place; LLD expects them in r_addend per RELA convention) Usage: go run tools/patch_xtensa_literals.go [-n] blobs/libs/esp32s3/*.a Update Makefile with update-s3-blobs target.
Signed-off-by: deadprogram <ron@hybridgroup.com>
|
What is the origin of those blobs? I always shudder when I see binary libraries checked into github. |
Signed-off-by: deadprogram <ron@hybridgroup.com>
…omething happening Signed-off-by: deadprogram <ron@hybridgroup.com>
Member
Author
I thought that was in the README, but it is https://github.com/esp-rs/esp-wifi-sys |
Signed-off-by: deadprogram <ron@hybridgroup.com>
Member
Author
|
Now merging, thanks everyone who helped with testing! |
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.
This PR is to add support for the ESP32-S3 processor.
It required some changes to TinyGo from PR tinygo-org/tinygo#5283 which have been merged.
Works!