代码运行错误,望大家指点
Posted: Wed Aug 04, 2021 8:22 am
下列代码运行出现如下错误
100Task 1 is running
***ERROR*** A stack overflow in task Task 1 has been detected.
void vTask1( void *pvParameters )
{
const char *pcTaskName = "Task 1 is running\r\n";
volatile unsigned long ul;
int num_nn = 100;
//num_nn++;
//printf("%c", num_nn );
/* 和大多数任务一样,该任务处于一个死循环中。 */
for( ;; ){
/* Print out the name of this task. */
//printf("%d/r/n", num_nn );
printf("%d", num_nn );
printf("%s", pcTaskName );
/* 延迟,以产生一个周期 */
vTaskDelay(200 / portTICK_PERIOD_MS);
}
}
如果代码中改为
uint8_t num_nn=100;
printf("%c", num_nn );
或者将printf("%d", num_nn ); 写在TASK1之外
则不会出现运行错误。
100Task 1 is running
***ERROR*** A stack overflow in task Task 1 has been detected.
void vTask1( void *pvParameters )
{
const char *pcTaskName = "Task 1 is running\r\n";
volatile unsigned long ul;
int num_nn = 100;
//num_nn++;
//printf("%c", num_nn );
/* 和大多数任务一样,该任务处于一个死循环中。 */
for( ;; ){
/* Print out the name of this task. */
//printf("%d/r/n", num_nn );
printf("%d", num_nn );
printf("%s", pcTaskName );
/* 延迟,以产生一个周期 */
vTaskDelay(200 / portTICK_PERIOD_MS);
}
}
如果代码中改为
uint8_t num_nn=100;
printf("%c", num_nn );
或者将printf("%d", num_nn ); 写在TASK1之外
则不会出现运行错误。