diff options
| author | sakumisu <[email protected]> | 2026-11-24 22:20:54 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-11-25 21:13:07 +0800 |
| commit | 87276ca5efd6538c87cc70d01a484379e4ea6ad2 (patch) | |
| tree | 1200c3885e93b46d2de46c0b293e952dba987edb /tests | |
| parent | 5a38fd508ba43d2e406c00cd658858bb80909c30 (diff) | |
update: set enum thread to the lower prio than app prio
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bouffalolab/inc/usb_config.h | 2 | ||||
| -rw-r--r-- | tests/hpmicro/inc/usb_config.h | 2 | ||||
| -rw-r--r-- | tests/hpmicro/src/main.c | 36 |
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/bouffalolab/inc/usb_config.h b/tests/bouffalolab/inc/usb_config.h index 01ea6360..d8d00151 100644 --- a/tests/bouffalolab/inc/usb_config.h +++ b/tests/bouffalolab/inc/usb_config.h @@ -167,7 +167,7 @@ #define CONFIG_USBHOST_DEV_NAMELEN 16 #ifndef CONFIG_USBHOST_PSC_PRIO -#define CONFIG_USBHOST_PSC_PRIO 0 +#define CONFIG_USBHOST_PSC_PRIO 29 #endif #ifndef CONFIG_USBHOST_PSC_STACKSIZE #define CONFIG_USBHOST_PSC_STACKSIZE 2048 diff --git a/tests/hpmicro/inc/usb_config.h b/tests/hpmicro/inc/usb_config.h index e59a9954..2a93ea1d 100644 --- a/tests/hpmicro/inc/usb_config.h +++ b/tests/hpmicro/inc/usb_config.h @@ -183,7 +183,7 @@ #define CONFIG_USBHOST_DEV_NAMELEN 16 #ifndef CONFIG_USBHOST_PSC_PRIO -#define CONFIG_USBHOST_PSC_PRIO 0 +#define CONFIG_USBHOST_PSC_PRIO 29 #endif #ifndef CONFIG_USBHOST_PSC_STACKSIZE #define CONFIG_USBHOST_PSC_STACKSIZE 2048 diff --git a/tests/hpmicro/src/main.c b/tests/hpmicro/src/main.c index 81930599..b259856f 100644 --- a/tests/hpmicro/src/main.c +++ b/tests/hpmicro/src/main.c @@ -286,3 +286,39 @@ int usbh_uac_volume(int argc, char **argv) CSH_CMD_EXPORT(usbh_uac_volume, usbh_uac_volume); #endif + +int stack(int argc, const char **argv) +{ + (void)argv; + if (argc != 1) { + printf("Usage: stack\n"); + return -1; + } + + UBaseType_t capacity = uxTaskGetNumberOfTasks() + 4U; + TaskStatus_t *tasks = pvPortMalloc(capacity * sizeof(*tasks)); + if (!tasks) { + printf("Failed to allocate task snapshot\n"); + return -1; + } + + UBaseType_t count = uxTaskGetSystemState(tasks, capacity, NULL); + if (!count) { + vPortFree(tasks); + printf("Task list changed; run stack again\n"); + return -1; + } + + printf("%-16s %5s %14s\n", "Task", "Prio", "Min free bytes"); + for (UBaseType_t i = 0; i < count; i++) { + if (tasks[i].eCurrentState == eDeleted || !tasks[i].pcTaskName) { + continue; + } + size_t free_bytes = (size_t)tasks[i].usStackHighWaterMark * sizeof(StackType_t); + printf("%-16.16s %5lu %14lu\n", tasks[i].pcTaskName, + (unsigned long)tasks[i].uxCurrentPriority, (unsigned long)free_bytes); + } + vPortFree(tasks); + return 0; +} +CSH_CMD_EXPORT(stack, show minimum free stack bytes for each task); |
