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 >> >