创建了4个线程运行都是OK的,但是创建第5个线程之后,最后一个线程返回创建失败。
有人知道是哪里被限制住了吗?
芯片资源
SRAM:64K
FLASH:256K
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_I2C1_Init();
MX_I2C2_Init();
MX_ADC1_Init();
MX_USART1_UART_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
MX_USART1_UART_DMA_Enable();
MX_USART3_UART_Init();
MX_USART3_UART_DMA_Enable();
/* 初始化EventRecorder并开启 */
//#ifdef RTE_Compiler_EventRecorder
// EventRecorderInitialize(EventRecordAll, 1U);
// EventRecorderStart();
//#endif
// Init_Led_Thread();
Init_BqInteractive_Thread();
Init_RunMode_Thread();
Init_ADC_Thread();
Init_Server_Thread();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
rt_thread_mdelay(1000);
LED_TOG();
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
每个线程创建参数都是一样的,如下:
/**
Server_thread_entry,/*线程入口函数*/
RT_NULL,/*线程入口函数参数*/
512, /*线程栈大小*/
3 , /*线程优先级*/
20); /*线程时间片*/
rt_thread_startup (Server_thread);
return 0;
}
return -1;
这里修改试了一下,可行,你们是修改这里吗?
@HunsenYao 是这里