Repository navigation
feat(jieli): AC792 audio board wiring, adapter contract tests, and the JIELI pin bump - #728
Closed
maidang-xing wants to merge 1 commit into
Closed
maidang-xing wants to merge 1 commit into
maidang-xing wants to merge 1 commit into
Conversation
Squashed from the 21-commit series so the PR carries a single commit. Platform registration and pinning: - register JIELI in platform_config.yaml and move the pin to each contract the tests below lock down - board definitions for AC7916A (wl82) and AC792N (wl83), with switch_demo defaulting to the AC791 board - AC79x audio and board peripheral support, handing the CMake audio adapter this board's mic routing Board/TKL layering: - make the board the only key path and drop the vendor key path from the platform entry - give your_chat_bot the gitignored license hook the other apps have Stack headroom, both found by crashing on AC792N: - wq_highpri / wq_system: 4096/5120 -> 10240/8192, matching switch_demo. wq_highpri runs the BLE netcfg completion chain and the default overflowed it, corrupting FreeRTOS list nodes. - tuya_app_main: 4096 -> 8192. The tuya_iot_yield() loop drives the mbedtls handshake, HTTP and MQTT from this thread, and the stock 4 KB overflowed during the iotdns TLS connect. Measured with a pre-connect SP probe: the chain has consumed 1504 B by the time mbedtls_ssl_handshake() is entered, leaving 2516 B of the 4 KB for the handshake itself, which is not enough (SP ran >=116 B past the stack floor). - ai_client: 4096 -> 8192. Getting a CA for rtc-ai1-*.tuyacn.com makes it run an iotdns TLS handshake on its own stack, which overflowed the same way. Tests: - adapter contract tests pinned to the refactored layout: TKL-only sources, the quiet ATT write callback, resident STA worker semantics, the board-only key path, the tkl_init audio bring-up and the posix-rendered TOOL_DIR - lock the AC792 audio adapter contracts and pin the VAD capture feeder's cross-callback accumulation
maidang-xing
force-pushed
the
codex/tuya-ai-hold-chain
branch
from
October 8, 2026 03:43
47aee56 to
18808a1
Compare
Contributor
Author
|
Superseded by #730, which carries the same work squashed onto This PR was based on |
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.
Companion to tuya/TuyaOpen-JieLi#11. Depends on that PR merging first — the pin below points at a commit on that PR's branch, so a build of this branch before #11 merges will fail to resolve the platform commit.
What this carries
boards/JIELI/AC792N_Develop_Board/audio_config.h— records which onboard microphone is captured and why (ADC1 over ADC0, measured), and that the two microphones cannot be opened together because the vendor ADC asserts on the second one.boards/JIELI/AC792N_Develop_Board/CMakeLists.txt— exportsJIELI_BOARD_AUDIO_CONFIGso the CMake adapter target compiles the audio sources against this board's mic-routing macros, matching what the staged vendor Makefile already does. Without it the wl83 leg does not build at all.tests/platform/test_jieli_tkl_audio_output.py— regression tests pinning the playback volume path (the vendor state switch, the 0-100 DAC level scale, the Q14 digital-gain curve and its ordering after channel start) and the capture path (the ADC 0-19 gain scale, which is a different range from the DAC's and must not be "aligned" to it).platform/platform_config.yaml— JIELI pin moves fromec4c6cceto8e5fdf3d, the head of the platform branch.The pin move exposed stale platform contracts — they are repointed here
Moving the pin past the TKL adapter refactor turned 35 of this repo's source-contract tests red. Those tests read platform source files as text and assert on their shape, and the refactor moved the code they were written against — so they had been stale all along, latent only because the pin had not moved.
They are repointed, not weakened; each assertion now pins the mechanism that replaced the one it described:
tkl_audio.c;jieli_build.pyintotools/jieli_build/;tuyaos_switch_app_main.ctotuyaos/entry/jieli_app_entry.c;os_q_*API to the local ring buffer that replaced it (chosen because the two SDKs disagree onos_q_post_to_back()'s message semantics andos_q_pend()'s timeout encoding);board.cpatching to the board adkey config and TDL registration that replaced it;tkl_jieli_chip_mac.cintotkl_wifi.c/tkl_bluetooth.c.One test was dropped rather than repointed:
test_jieli_uart_hello.pyasserted a bring-up banner that the refactor deleted fromtuyaos_app_main.c, and readexamples/get-started/jieli_uart_hello, which has never been committed to this branch (it lives onfeat/jieli-7916-uart). It had failed since before the pin move. It should come back with the example that gives it meaning.Verification
switch_demoon wl83 and wl82,output_speakeron wl83 —BUILD SUCCESS, zero undefined references).Note
The two audio fixes themselves (playback audibility, capture gain) are diagnosed and documented in tuya/TuyaOpen-JieLi#11, where the adapter code lives.
test_jieli_config.pynow pins the platform registry commit SHA literally, so it needs a one-line update on every future pin move. That is deliberate — the drift guard is what caught this one.Added since first opened
The pin moved again, to
7d24da28— the platform branch now also carries the board/TKL/app layer separation (see tuya/TuyaOpen-JieLi#11), which had not been pushed when this PR first went up. The registry drift guard intest_jieli_config.pymoved with it.your_chat_botgains the gitignored-license hook the other apps have.switch_demoand friends keep real credentials in a gitignoredtuya_config_secrets.hthattuya_config.hpulls in via#if __has_include; this app had none, so its tracked header was the only place to put a license. Same hook added, placeholders guarded, plus a tracked.exampletemplate.A crash fix, and an honest caveat about it.
your_chat_botcrashed and rebooted ~0.47 s into startup on AC792N, at the instantwq_highpristarted. A controlled A/B — same app, same board, firmware built from the pre-change platform commit — crashed identically, so the defect predates the layer separation. The evidence points at the work-queue stacks:switch_democarriesCONFIG_STACK_SIZE_MSG_QUEUE=10240/CONFIG_STACK_SIZE_WORK_QUEUE=8192with a comment recording that the 4096 default overflowedwq_highpriand corrupted FreeRTOS list nodes;your_chat_botcarried neither. Confirmed on hardware. Flashed, and the app now passes the old crash point and runs on:reset_netcfg's timer starts,netmgr [wifi] register start,tuya_iot_init successat 1.391 s (the old crash was at 0.472 s), and it is still alive at 11.95 s with no reboot in the capture. Note commita05dfaea's body still carries the pre-verification caveat; it is superseded by this, and the history is left unrewritten rather than force-pushed.One test repointed.
test_full_stack_audio_provider_is_registered_before_tkl_initpinned a call that the layer separation moved intotkl_init(); it had been failing unnoticed because no step between those commits ran the suite. Now pins the new location at equal strength.Outer repo suite: 83 passed, 10 subtests passed. Platform suite: 40 passed, 4 subtests passed.