Day: March 4, 2021

Using FIFO on NuttX to send data from your board to computer

There is easy way to send the data, produced by your application on your board, directly to your computer using a simple command line tool:

nsh> mkfifo /dev/fifo
nsh> myapp > /dev/fifo &
nsh> netcat 192.168.0.15 10123 /dev/fifo

Before running the above commands in your board, you need first run on your computer:

$ nc -l 10123

Using QEMU with GDB to debug NuttX

This is a nice feature if you want to use QEMU to debug a NuttX board and learn more about its initialization.

Configure NuttX to use the stellaris lm3s6965-ek board with qemu-flat config:

$ ./tools/configure.sh lm3s6965-ek:qemu-flat

Compile it:

$ make
Run QEMU with the generated "nuttx" ELF file:

$ qemu-system-arm -net nic,model=stellaris -net user,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:10021-10.0.2.15:21 -M lm3s6965evb -kernel nuttx -nographic -s -S
$ arm-none-eabi-gdb -i=mi -ix=./tools/nuttx-gdbinit nuttx
(gdb) target extended-remote:1234
(gdb) c

You can connect to board using telnet:

$ telnet localhost 10023
Trying 127.0.0.1…
Connected to localhost.
Escape character is '^]'.

NuttShell (NSH) NuttX-10.0.1
nsh>

Note: 10.0.2.15 is the internal IP of the emulated lm3s6965evb ethernet on QEMU. The hostfwd command just forward the access to the localhost port 10023 to 23 (telnet) of the emulated board. Same to port 10021 and 21 (ftp).

Note 2: You can exit QEMU pressing: Ctrl A + x

Source: https://github.com/apache/incubator-nuttx/pull/2899