Discussion:
Auto launch built-in command
(too old to reply)
mdannhardt@gmail.com [nuttx]
2018-01-09 20:09:44 UTC
Permalink
I have a built-in command that I wrote and have tested as working. I would like to have this built-in command automatically run after nuttx boots. Is there a way to launch the program from an init shell script or similar?


Thanks,
Mike


PS - I am pretty sure I asked this question here once and got back a couple of responses but I can not find them with Yahoo search or even looking at my messages so I apologize for repeating.
spudarnia@yahoo.com [nuttx]
2018-01-09 21:31:12 UTC
Permalink
You probably want an NSH start-up script. This is pretty well documented in the NSH user manual:

http://nuttx.org/Documentation/NuttShell.html

specifically:

http://nuttx.org/Documentation/NuttShell.html#startupscript
http://nuttx.org/Documentation/NuttShell.html#custonshlib
http://nuttx.org/Documentation/NuttShell.html#custinit
spudarnia@yahoo.com [nuttx]
2018-01-09 23:07:23 UTC
Permalink
Some real world examples:

Some real examples:

$ ls configs/*/include/*rom*.h
configs/sama5d4-ek/include/nsh_romfsimg.h configs/sim/include/nsh_romfsimg.h configs/stm32l476vg-disco/include/nsh_romfsimg.h

$ ls configs/*/include/*template*
configs/sama5d4-ek/include/rcS.template configs/stm32l476vg-disco/include/rcS.template

$ ls configs/sim/include/
board.h etc.tar.gz nsh_romfsimg.h README.txt

That last README.txt file might also have some information of interest to you.

Greg
spudarnia@yahoo.com [nuttx]
2018-01-09 23:18:27 UTC
Permalink
I suppose that the very simplest thing you could to would be to just all task_create() in your board bringup or board_app_initialize() logic. That is very simple but less flexible.
mdannhardt@gmail.com [nuttx]
2018-01-10 12:15:11 UTC
Permalink
Greg,

Thank you very much for your detailed responses. I think I've got it working now based on one of your responses, I've replaced the nuttx shell with my built-in user space application. This is working great thus far.


Next I need to figure out how to access GPIO from this user space application. I'm assuming that I can use the GPIO driver for this. If you've got a hint there I'd appreciated it! If I can't figure it out I probably make another post soon with the specific topic.


Kind Regards,
Mike


PS - If anyone knows why I can not see all my Yahoo posts using the Groups's "Action->My Messages" I'd sure like to know. "Action->My Messages" only displays a few of my posts from Jul 2017. Weird.
mdannhardt@gmail.com [nuttx]
2018-01-10 13:09:29 UTC
Permalink
Apparent success. Simply using the gpio driver calls such as gpio_direction_out() and gpio_set_value() from the user space program allow it to turn on/off the LEDs. Thanks again Greg.
Mike
Alan Carvalho de Assis acassis@gmail.com [nuttx]
2018-01-10 15:44:01 UTC
Permalink
Hi Mike,

Calling gpio functions directly violates the kernel/userspace layer.
It will work on FLAT mode, but will not work on Protected and Kernel
mode.

I explained how to use it on my video tutorial #011:



BR,

Alan
Post by ***@gmail.com [nuttx]
Apparent success. Simply using the gpio driver calls such as
gpio_direction_out() and gpio_set_value() from the user space program allow
it to turn on/off the LEDs. Thanks again Greg.
Mike
Loading...