Add configurable application entry point

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5070 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-08-30 20:13:50 +00:00
parent 0a5cb6db67
commit 19dbcea073
3 changed files with 21 additions and 14 deletions

View File

@ -3066,7 +3066,7 @@ Builtin Apps:
<p>
<code><b>apps/examples/hello</code></b>.
The main routine for apps/examples/hello can be found in <code>apps/examples/hello/main.c</code>.
When <code>CONFIG_EXAMPLES_HELLO_BUILTIN</code> is defined, this main routine simplifies to:
The main routine is:
</p>
<ul><pre>
int hello_main(int argc, char *argv[])
@ -3165,10 +3165,8 @@ STACKSIZE = 2048
</p>
<ul><pre>
.context:
ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y)
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
@touch $@
endif
</pre></ul>
</ol>
@ -3189,7 +3187,7 @@ endif
CONFIG_BUILTIN_APP_START=&lt;application name&gt;
</pre></ul>
<p>
that application will be invoked immediately after system starts instead of the normal, default <code>user_start()</code> entry point.
that application will be invoked immediately after system starts instead of the default <code>CONFIG_USER_ENTRYPOINT</code>() entry point.
Note that <code>&lt;application name&gt;</code> must be provided just as it would have been on the NSH command line.
For example, <code>hello</code> would result in <code>hello_main()</code> being started at power-up.
</p>
@ -3276,8 +3274,8 @@ CONFIGURED_APPS += examples/hello
<p>
You replace the sample code at <code>apps/examples/nsh/nsh_main.c</code> with whatever start-up logic that you want.
NSH is a library at <code>apps/nshlib</code>.
<code>apps.examplex/nsh</code> is just a tiny, example start-up function (<code>user_start()</code>) that that runs immediately and illustrates how to start NSH
If you want something else to run immediately then you can write your write your own custom <code>user_start()</code> function and then start other tasks from your custom <code>user_start()</code>.
<code>apps.examplex/nsh</code> is just a tiny, example start-up function (<code>CONFIG_USER_ENTRYPOINT</code>()) that that runs immediately and illustrates how to start NSH
If you want something else to run immediately then you can write your write your own custom <code>CONFIG_USER_ENTRYPOINT</code>() function and then start other tasks from your custom <code>CONFIG_USER_ENTRYPOINT</code>().
</p>
<li>
<p>

View File

@ -4085,6 +4085,14 @@ build
<code>CONFIG_SCHED_ONEXIT_MAX</code>: By default if <code>CONFIG_SCHED_ONEXIT</code> is selected, only a single <code>on_exit()</code> function is supported.
That number can be increased by defined this setting to the number that you require.
</li>
<li>
<code>CONFIG_USER_ENTRYPOINT</code>: The name of the entry point for user
applications.
For the example applications this is of the form <code>app_main</code>
where <code>app</code> is the application name.
If not defined, <code>CONFIG_USER_ENTRYPOINT</code> defaults to
<code>user_start</code>.
</li>
</ul>
<p>
@ -5792,13 +5800,14 @@ build
<li>
<code>CONFIG_IDLETHREAD_STACKSIZE</code>: The size of the initial stack.
This is the thread that (1) performs the initial boot of the system up
to the point where user_start() is spawned, and (2) there after is the
IDLE thread that executes only when there is no other thread ready to
run.
to the point where <code>CONFIG_USER_ENTRYPOINT</code>() is spawned,
and (2) there after is the IDLE thread that executes only when there
is no other thread ready to run.
</li>
<li>
<code>CONFIG_USERMAIN_STACKSIZE</code>: The size of the stack to allocate
for the main user thread that begins at the user_start() entry point.
for the main user thread that begins at the <code>CONFIG_USER_ENTRYPOINT</code>()
entry point.
</li>
<li>
<code>CONFIG_PTHREAD_STACK_MIN</code>: Minimum pthread stack size

View File

@ -150,7 +150,7 @@
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="left"><code>user_start: Registering USB serial driver</code></td>
<td align="left"><code>usbserial_main: Registering USB serial driver</code></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
@ -158,7 +158,7 @@
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="left"><code>user_start: Successfully registered the serial driver</code></td>
<td align="left"><code>usbserial_main: Successfully registered the serial driver</code></td>
</tr>
<tr>
<td align="center">1</td>
@ -170,11 +170,11 @@
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="left"><code>user_start: ERROR: Failed to open /dev/ttyUSB0 for reading: 107</code></td>
<td align="left"><code>usbserial_main: ERROR: Failed to open /dev/ttyUSB0 for reading: 107</code></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="left"><code>user_start: Not connected. Wait and try again.</code></td>
<td align="left"><code>usbserial_main: Not connected. Wait and try again.</code></td>
</tr>
<tr>
<td align="center">3</td>