Skip to content

Commit 0d536de

Browse files
authored
After fixing
1 parent ff5c4e1 commit 0d536de

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

nshtask_main.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
1-
// From ChatGPT, doesn't compile
1+
// How to create a NuttX Task for NSH Shell
22
#include <nuttx/sched.h>
3-
#include <nuttx/nsh.h>
4-
5-
int nsh_main(int argc, char *argv[]);
6-
7-
int nsh_task(int argc, char *argv[])
8-
{
9-
nsh_main(argc, argv);
10-
return 0;
11-
}
3+
#include <stdio.h>
4+
#include "nshlib/nshlib.h"
125

136
int main(int argc, char *argv[])
147
{
158
pid_t pid = task_create(
169
"nsh", // Task Name
1710
100, // Task Priority
18-
2048, // Task Stack Size
19-
nsh_task, // Task Function
20-
(FAR char * const *)argv // Task Arguments
11+
CONFIG_DEFAULT_TASK_STACKSIZE, // Task Stack Size
12+
nsh_consolemain, // Task Function
13+
NULL // Task Arguments
2114
);
2215
if (pid < 0) {
2316
printf("Error creating task\n");
24-
} else {
25-
task_start(pid);
2617
}
2718
return 0;
2819
}

0 commit comments

Comments
 (0)