Introduction
The official NuttX documentation seems to be incomplete. Therefore I listed here the steps I did to get NuttX working under Ubuntu 18.04.
Prerequisites
sudo apt install \
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
KConfig frontend
Clone the tools repository:
git clone https://bitbucket.org/nuttx/tools.git
Build KConfig frontend:
cd tools/kconfig-frontends
./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
make
sudo make install
sudo echo 'include /usr/local/lib' >> /etc/ld.so.conf
sudo ldconfig
Toolchain
Follow the first 4 steps in https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
Then, run the following to add ESP32 toolchain to PATH
get_idf
Get NuttX
mkdir nuttx
cd nuttx
git clone https://github.com/apache/incubator-nuttx.git nuttx
git clone https://github.com/apache/incubator-nuttx-apps apps
Initialize Configuration
List pre-existing configurations:
./tools/configure.sh -L | less
Choose a configuration:
./tools/configure.sh -l esp32-devkitc:nsh
make menuconfig
Build NuttX
make
Flash to ESP32
esptool.py --chip esp32 elf2image --flash_mode dio --flash_size 4MB -o ./nuttx.bin nuttx
wget -O bootloader.bin https://github.com/saramonteiro/esp32_binaries_nuttx/blob/main/bootloader.bin?raw=true
wget -O partitions.bin https://github.com/saramonteiro/esp32_binaries_nuttx/blob/main/partitions.bin?raw=true
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 write_flash 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 nuttx.bin
Access NuttShell
minicom /dev/ttyUSB0 -b 115200
References
- https://nuttx.apache.org/docs/latest/quickstart/index.html
- https://blog.csdn.net/u010947832/article/details/111572602
- https://medium.com/the-esp-journal/getting-started-with-esp32-and-nuttx-fd3e1a3d182c
- https://medium.com/the-esp-journal/blink-led-on-esp32-with-rtos-nuttx-d33c7dc62156
- https://www.youtube.com/playlist?list=PLd73yQk5Fd8JEsVD-lhwYRQKVu6glfDa8
Comments