RT-Thread / RT-Thread/rt-thread
[Bug] 给sdio的默认栈是否过小
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
RT-Thread Version
master
Affected area
Device drivers
Hardware/BSP vendor
HPMicro
Architecture
RISC-V
Board and hardware details
hpm63
Develop Toolchain
GCC
Describe the bug
默认的和idle相同的栈大小是不是有点太小了,在idle配成512时候,sdio挂网卡直接爆栈了。不知道其他情况会不会直接爆。
Other additional context
AI的分析:
当前链路是:
上下文 工作
━━━━━━━━━━━━━━━━━
SDXC 硬件 ISR 读取状态、屏蔽 DAT1、释放 host->sdio_irq_sem
─────────────────
sdio_irq 线程 加总线锁,通过 CMD52 读取 CCCR INT_PENDING,分发 function-1 回调,再使能 DAT1
─────────────────
ESP-Hosted 回调 只释放 port irq_sem
─────────────────
sdio_read 线程 读取 ESP 中断状态及实际数据
栈大的原因不是业务复杂,而是 CMD52 穿过了整套通用驱动调用链:
sdio_irq_thread
-> sdio_io_readb
-> sdio_io_rw_direct
-> mmcsd_send_cmd
-> mmcsd_send_request
-> hpm_sdmmc_request
-> hpm_sdmmc_transfer
-> hpm_sdmmc_transfer_interrupt_driven
-> rt_event_recv
仅编译器可见的函数栈帧就超过 624B。其中 hpm_sdmmc_request() 自己占 192B,因为栈上同时放了:
sdxc_adma_config_t
sdxc_xfer_t
sdxc_command_t
sdxc_data_t
再加锁、事件等待、线程入口和内核调用,实测就是 988B。当前还是 -O0,栈占用也会偏大。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SDIO IRQ thread and the HPMicro hpm_sdmmc_request() path described in the issue, then trace where the default SDIO thread stack is configured. Reproduce on the hpm63 board with GCC and idle configured to 512, measure stack use during SDIO network activity, and confirm that the default is large enough without causing overflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100