well, works using /bin/i2c Like the Unix nsh> help help usage: help [-v] [<cmd>]
. cp exit mkrd set unset [ cmp false mount sleep uptime ? dirname fdinfo mv source usleep alias dd free pidof test xd unalias df help printf time basename dmesg hexdump ps true break echo kill pwd truncate cat env ls rm uname cd exec mkdir rmdir umount Builtin Apps: i2c sh hello nsh nsh> nsh> hello Executing 1 /bin/i2c Usage: i2c <cmd> [arguments] Where <cmd> is one of: Show help : ? List buses : bus List devices : dev [OPTIONS] <first> <last> Read register : get [OPTIONS] [<repetitions>] Dump register : dump [OPTIONS] [<num bytes>] Show help : help nsh> Write register: set [OPTIONS] <value> [<repetitions>] Verify access : verf [OPTIONS] [<value>] [<repetitions>] Where common "sticky" OPTIONS include: [-a addr] is the I2C device address (hex). Default: 03 Current: 03 [-b bus] is the I2C bus number (decimal). Default: 0 Current: 0 [-w width] is the data width (8 or 16 decimal). Default: 8 Current: 8 [-s|n], send/don't send start between command and data. Default: -n Current: -n [-i|j], Auto increment|don't increment regaddr on repetitions. Default: NO Current: NO [-f freq] I2C frequency. Default: 400000 Current: 400000 Special non-sticky options: [-r regaddr] is the I2C device register index (hex). Default: not used/sent NOTES: o An environment variable like $PATH may be used for any argument. o Arguments are "sticky". For example, once the I2C address is specified, that address will be re-used until it is changed. WARNING: o The I2C dev command may have bad side effects on your I2C devices. Use only at your own risk. nsh> ________________________________ De: Gregory Nutt <spudan...@gmail.com> Enviado: quinta-feira, 12 de outubro de 2023 20:51 Para: dev@nuttx.apache.org <dev@nuttx.apache.org> Assunto: Re: execv obsolet ? On 10/12/2023 2:31 PM, MIGUEL ALEXANDRE WISINTAINER wrote: > I can run (execv) i2c from hello 🙂 > > works!!!!! > > Now Gustavo can you this TIP to make work the PCA/PCF GPIO extender 🙂 > > Thanks!!!!!!!!!!!!!!!!! > > nsh> hello > Executing 1 /bin/i2c > Usage: i2c <cmd> [arguments] > Where <cmd> is one of: There are several confusing things here. /bin/i2c is the I2C tool, obviously. How did it get into /bin? Are you using binfs? binfs will allow you to mount a "fake" file system that exposes the so-called "built-in tasks" as executable files of a file system. execv() and friends will only work on executable files. More typically, executable files would be ELF modules in a real file system in FLASH or on and SD card but binfs fakes a compatible environment. ls, one the other hand is not a built-in task. It is not a task at all and can't be executed from execv(). It is an NSH command that can be executed only from the command line. Even if you have binfs, it should not exist under /bin.