In this laboratory you will learn how to build and upload the NuttX OS on your ESP32 Sparrow boards. They use the WROVER modules, so we'll need to specify this when we build the OS binaries.
You can go ahead to section [Run as sudo].
If running on Windows, you must configure a Linux virtual machine through which to access the USB ports of the host. For this you can use the SO virtual machine - a light Ubuntu 20.04 image that comes only with a CLI - or download the latest official image of any other Linux distributions.
If available to you, you can use the VMware Workstation 16 pro which is the easiest to configure - just don't forget to add the USB controller to the VM.
If you do not have access to VMWare, please download VirtualBox. In order to ssh to your virtual machine, please do the following steps:
To connect the USB device to the VM instead of the host, head to the upper bar and select Devices > USB Devices > the UART controller .
Currently, the WSL subsystem does not provide native support for USB devices and you must use an open-source tool. Please refer to this for further details.
Running as non-root will require a few extra commands for configuration.
Refer to this if you decide to continue as non-root.
Follow the steps below in order to get your Linux machine properly configured:
apt-get update apt-get upgrade -y apt-get install -y bison flex gettext texinfo libncurses5-dev libncursesw5-dev gperf automake libtool pkg-config build-essential gperf genromfs libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev libexpat-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux chrony libusb-dev libusb-1.0.0-dev kconfig-frontends python3-pip
curl https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz | tar -xf mkdir /opt/xtensa mv xtensa-esp32-elf/ /opt/xtensa/ echo "export PATH=\$PATH:/opt/xtensa/xtensa-esp32-elf/bin" >> ~/.bashrc source ~/.bashrc
mkdir ~/nuttxspace && cd ~/nuttxspace git clone https://github.com/apache/nuttx.git nuttx git clone https://github.com/apache/nuttx-apps.git apps
mkdir esp-bins curl -L "https://github.com/espressif/esp-nuttx-bootloader/releases/download/latest/bootloader-esp32.bin" -o esp-bins/bootloader-esp32.bin curl -L "https://github.com/espressif/esp-nuttx-bootloader/releases/download/latest/partition-table-esp32.bin" -o esp-bins/partition-table-esp32.bin
While this step is not necessary for the ESP32 Sparrow boards, please be aware that if you're compiling for a different hardware board, depending on the board version, you might be required to press down the `BOOT` button when flashing the memory - this puts the board in a download state instead of the default boot state. The button must be pressed down only when the connection is being established, as depicted below:
pip3 install esptool pip3 install pyserial cd ~/nuttxspace/nuttx ./tools/configure.sh esp32-wrover-kit:nsh
Continue compiling and uploading:
make EXTRAFLAGS="-DESP32_IGNORE_CHIP_REVISION_CHECK" -j<num_cores> esptool.py erase_flash make flash ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=115200 ESPTOOL_BINDIR=../esp-bins picocom /dev/ttyUSB0 -b 115200
Flashing the board could be also done by using
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 write_flash 0x1000 ../esp-bins/bootloader-esp32.bin 0x8000 ../esp-bins/partition-table-esp32.bin 0x10000 nuttx.bin
If the parameters are correct, you should see a log similar to the one below:
Finally, the boot log should look like this: