Ah ok, I tested using the original code with "ls" instead "/bin/ls" and the result as similar to NuttX: didn't print anything.
I discovered the issue: ls is not a buildin program, you need to call a builtin program to get it working. I modified apps/examples/null to print an incentive message ! /**************************************************************************** * Name: null_main ****************************************************************************/ int main(int argc, char *argv[]) { printf("We did it, not because it is easy! But because we thought it was easy!\n"); return 0; } And modified hello to call this null application: int main(int argc, char *argv[]) { int ret; if (argc < 2) { static char * const args[2] = { "null", NULL }; ret = execv(args[0], args); if (ret < 0) { printf("Error: execv failed: %d\n", ret); } } } See the result: NuttShell (NSH) NuttX-12.3.0-RC0 nsh> ? help usage: help [-v] [<cmd>] . cd exit mount source uptime [ cp false mv test usleep ? cmp help printf time xd alias dirname hexdump pwd true unalias dd kill rm truncate basename dmesg ls rmdir uname break echo mkdir set umount cat exec mkrd sleep unset Builtin Apps: hello nsh null sh nsh> hello We did it, not because it is easy! But because we thought it was easy! nsh> Just used the DEBUG to find-out the issue, the debug binary loader said exactly what was the issue. BR, Alan On 10/12/23, MIGUEL ALEXANDRE WISINTAINER <tcpipc...@hotmail.com> wrote: > 1 hour ago, not 1 year agoπ > ________________________________ > De: MIGUEL ALEXANDRE WISINTAINER <tcpipc...@hotmail.com> > Enviado: quinta-feira, 12 de outubro de 2023 19:07 > Para: dev@nuttx.apache.org <dev@nuttx.apache.org> > Assunto: RE: execv obsolet ? > > yes, i already had done that 1 year ago > > ubuntu@DESKTOP-GRCNLV8:~$ nano hello_main.c > ubuntu@DESKTOP-GRCNLV8:~$ gcc hello_main.c -o hello_main > ubuntu@DESKTOP-GRCNLV8:~$ ./hello_main > Executing 1 /bin/ls > Espruino esp kitware-archive.sh.1 > nuttx mbed rust esp-adf > RIOT esp-va-sdk kitware-archive.sh.2 > tinygo thread-os freertos > a.out esp32_binary_merger lora-modem-abz-1.2.5 > tinygo_0.26.0_amd64.deb > blink go lora-modem-abz-1.2.5.zip > zephyr-sdk-0.15.0 embedded-os-beta-esp32c > cmake-3.21.1-Linux-x86_64.sh hello_main loramac-node > zephyr-sdk-0.15.0_linux-x86_64.tar.gz > drogue-device hello_main.c minicom.log > zephyr-sdk-0.15.1_linux-x86_64.tar.gz > embassy kitware-archive.sh mynewt > > On linux works > > On nuttx not...i tried the path to...but...the problem is where is the path > of ls > > "/ls" > > if (argc < 2) > { > static char * const args[2] = > { > "/bin/ls", > NULL > }; > printf("Executing 1 %s \n", args[0]); > execv(args[0], args); > } > > ________________________________ > De: Alan C. Assis <acas...@gmail.com> > Enviado: quinta-feira, 12 de outubro de 2023 18:48 > Para: dev@nuttx.apache.org <dev@nuttx.apache.org> > Assunto: Re: execv obsolet ? > > Hi Miguel, > > I suggest you to try first in the Linux. > > NuttX should give you the same result ;-) > > BR, > > Alan > > On 10/12/23, MIGUEL ALEXANDRE WISINTAINER <tcpipc...@hotmail.com> wrote: >> Now compiles π >> >> in theory should show the files got from ls on terminal ? >> >> Builtin Apps: >> i2c sh hello nsh >> nsh> hello >> nsh> >> >> ============= >> >> #include <nuttx/config.h> >> #include <stdio.h> >> #include <stdlib.h> >> #include <unistd.h> >> >> >> #ifdef CONFIG_BUILD_KERNEL >> int main(int argc, FAR char *argv[]) >> #else >> int hello_main(int argc, char *argv[]) >> #endif >> { >> >> if (argc < 2) >> { >> ββββββstatic char * const args[2] = >> ββββββ{ >> ββββββββββββ"ls", >> ββββββββββββNULL >> ββββββ}; >> >> ββββββexecv(args[0], args); >> } >> De: Xiang Xiao <xiaoxiang781...@gmail.com> >> Enviado: quinta-feira, 12 de outubro de 2023 18:08 >> Para: dev@nuttx.apache.org <dev@nuttx.apache.org> >> Assunto: Re: execv obsolet ? >> >> you need enable CONFIG_LIBC_EXECFUNCS: >> https://github.com/apache/nuttx/blob/master/libs/libc/unistd/lib_execv.c#L29 >> >> On Fri, Oct 13, 2023 at 1:59β―AM MIGUEL ALEXANDRE WISINTAINER < >> tcpipc...@hotmail.com> wrote: >> >>> #include <nuttx/config.h> >>> #include <stdio.h> >>> #include <stdlib.h> >>> #include <unistd.h> >>> >>> #ifdef CONFIG_BUILD_KERNEL >>> int main(int argc, FAR char *argv[]) >>> #else >>> int hello_main(int argc, char *argv[]) >>> #endif >>> { >>> >>> if (argc < 2) >>> { >>> static char * const args[2] = >>> { >>> "/bin/ls", >>> NULL >>> }; >>> >>> execv(args[0], args); >>> } >>> >>> else >>> { >>> int i; >>> >>> for (i = 1; i < argc; i++) >>> { >>> static char * const args[3] = >>> { >>> "/bin/ls", >>> NULL, >>> NULL >>> }; >>> args[1] = argv[i]; >>> execv(args[0], args); >>> } >>> } >>> return EXIT_SUCCESS; >>> } >>> >>> hello_main.c:(.text.hello_main+0xe): undefined reference to `execv' >>> xtensa-esp32-elf-ld: hello_main.c:(.text.hello_main+0x20): undefined >>> reference to `execv' >>> make[1]: *** [Makefile:173: nuttx] Error 1 >>> make: *** [tools/Unix.mk:537: nuttx] Error 2 >>> >> >