Day: February 9, 2022

Compiling NuttX to RaspberryPi Pico

$ git clone https://github.com/raspberrypi/pico-sdk
$ sudo mv pico-sdk /opt/
$ cd /opt/pico-sdk/
$ git reset --hard 26653ea81e340
$ export PICO_SDK_PATH=/opt/pico-sdk
$ cd ~/nuttxspace/nuttx
$ ./tools/configure.sh raspberrypi-pico:usbnsh
$ make -j

After nuttx.uf2 is created, press and hold the BOOTSEL button of the board and connect the USB cable. A new virtual disk will appear on your computer. Just copy the nuttx.uf2 to it.

The board will reset and if you type dmesg on your computer you will see:

[ 2141.219090] cdc_acm 1-3:1.0: ttyACM0: USB ACM device
[ 2141.219118] usbcore: registered new interface driver cdc_acm
[ 2141.219120] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Use minicom or other serial console tool to open /dev/ttyACM0 at 115200 8n1 and press ENTER 3 times, you will see:

NuttShell (NSH) NuttX-10.2.0
nsh> ?
help usage: help [-v] []

. cd df free mkrd reboot test unset
[ cp echo help mount rm time usleep
? cmp env hexdump mv rmdir true xd
basename dirname exec kill printf set truncate
break date exit ls ps sleep uname
cat dd false mkdir pwd source umount

Builtin Apps:
getprime hello nsh ostest sh
nsh> uname -a
NuttX 10.2.0 cc8ab23550 Feb 9 2022 09:35:01 arm raspberrypi-pico
nsh> getprime
Set thread priority to 10
Set thread policy to SCHED_RR
Start thread #0
thread #0 started, looking for primes < 10000, doing 10 run(s) thread #0 finished, found 1230 primes, last one was 9973 Done getprime took 12810 msec nsh>