"What the heck is the IDF?" I hear you saying. It is what Espressif now calls what they used to call the SDK. IDF stands for "IoT Development Framework". Fine, whatever is what I say. What it seems to be is a concoction brewed from Python 3, Cmake, and build-ninja along with their libraries and who knows what else.
For now I am just playing the game as they set it up. We will see if we can figure out how to use Makefiles and Fedora compilers at some point. They put everything in /home/tom/.espressif, including the C compiler. So they don't depend on you installing any packages in particular. I certainly didn't have to install any packages, but I am already working on all kinds of projects and have most things already (in fact my biggest worry was conflicts among versions).
cd /home/tom rm -rf .espressif cd /u1/Projects/RISCV/esp32c3 rm -rf *This should remove all traces of what I tried previously. I'll note in passing that the esp-idf uses "ninja-build", cmake, and python 3. They are trying to use all the cool new stuff. The proof is -- does it work? More particularly, does it work for me?
I am running a Fedora 35 linux system (just for the record). I am also doing my best to follow these "official instructions".
cd /u1/Projects/RISCV/esp32c3 git clone --recursive https://github.com/espressif/esp-idf.gitI'll note that the instructions tell you to clone this into /home/tom/esp, not some directory of your choosing like I do. I had no trouble cloning into a location of my choosing.
The clone takes a very long time as it clones first one package, then another. When it finally finishes, I do this:
cd esp-idf ./install.sh esp32c3They point out that this will only install tools for the RiscV based esp32c3. I see things like:
riscv32-esp-elf-gdb openocd-esp32-linux-amd64-0.11.0-esp32The install script took a really long time to run. It stalled near where it said:
Successfully installed pip-22.1.2 setuptools-62.4.0 Downloading https://dl.espressif.com/dl/esp-idf/espidf.constraints.v5.0.txt Destination: /home/tom/.espressif/espidf.constraints.v5.0.txt.tmp Done Installing Python packagesI went on a long (1 hour) bike ride angry and frustrated that there was some bug in the install script I was going to have to track down, but when I got home, it had finished and told me:
All done! You can now run: . ./export.shThey say if you want to install tools for all supported targets you should run "./install.sh all" -- which I may want to do when I get back to working with the Xtensa based esp32.
alias get_esp="source /u1/Projects/RISCV/esp32c3/esp-idf/export.sh"Now typing (in a new session) "get_esp" yields quite a few messages and has you ready to go.
cd /u1/Projects/RISCV/esp32c3 cp -r esp-idf/examples/get-started/hello_world . cd hello_world idf.py set-target esp32c3 idf.py menuconfig idf.py buildI just hit Escape to exit menuconfig (they say the defaults are fine for hello-world). The build seems to build almost 800 objects.
Note that in the following, I do not specify the port since and it seems to use /dev/ttyUSB0 just fine by default.
Now to flash the project
idf.py flashThe bright LED flashes several times
And to see console output, use one of the following. The second command combines the above flash command with starting the monitor and is just what I like.
idf.py monitor idf.py flash monitorTo exit the monitor, you use Control-]
ESP-ROM:esp32c3-api1-20210207 Build:Feb 7 2021 rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) Saved PC:0x403805aa 0x403805aa: esp_restart_noos_dig at /u1/Projects/RISCV/esp32c3/esp-idf/components/esp_system/esp_system.c:46 (discriminator 1) SPIWP:0xee mode:DIO, clock div:1 load:0x3fcd6108,len:0x196c load:0x403ce000,len:0x8f8 load:0x403cf600,len:0x2e28 entry 0x403ce000 I (35) boot: ESP-IDF v5.0-dev-3485-g20f5e180ee 2nd stage bootloader I (35) boot: compile time 20:48:42 I (35) boot: chip revision: 3 I (38) boot.esp32c3: SPI Speed : 80MHz I (43) boot.esp32c3: SPI Mode : DIO I (48) boot.esp32c3: SPI Flash Size : 2MB I (53) boot: Enabling RNG early entropy source... I (58) boot: Partition Table: I (62) boot: ## Label Usage Type ST Offset Length I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (84) boot: 2 factory factory app 00 00 00010000 00100000 I (91) boot: End of partition table I (95) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=07088h ( 28808) map I (108) esp_image: segment 1: paddr=000170b0 vaddr=3fc8a600 size=01480h ( 5248) load I (113) esp_image: segment 2: paddr=00018538 vaddr=40380000 size=07ae0h ( 31456) load I (127) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=137d4h ( 79828) map I (141) esp_image: segment 4: paddr=000337fc vaddr=40387ae0 size=02b00h ( 11008) load I (144) esp_image: segment 5: paddr=00036304 vaddr=50000010 size=00010h ( 16) load I (150) boot: Loaded app from partition at offset 0x10000 I (153) boot: Disabling RNG early entropy source... I (170) cpu_start: Pro cpu up. I (178) cpu_start: Pro cpu start user code I (178) cpu_start: cpu freq: 160000000 Hz I (179) cpu_start: Application information: I (181) cpu_start: Project name: hello_world I (187) cpu_start: App version: 1 I (191) cpu_start: Compile time: Jun 14 2022 20:48:35 I (197) cpu_start: ELF file SHA256: ae89ce6366d70dfb... I (203) cpu_start: ESP-IDF: v5.0-dev-3485-g20f5e180ee I (210) heap_init: Initializing. RAM available for dynamic allocation: I (217) heap_init: At 3FC8C8F0 len 00033710 (205 KiB): DRAM I (223) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM I (230) heap_init: At 50000020 len 00001FE0 (7 KiB): RTCRAM I (237) spi_flash: detected chip: generic I (241) spi_flash: flash io: dio W (245) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. I (258) sleep: Configure to isolate all GPIO pins in sleep state I (265) sleep: Enable automatic switching of GPIO sleep configuration I (272) cpu_start: Starting scheduler. Hello world! This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision 3, 2MB external flash Minimum free heap size: 327784 bytes Restarting in 10 seconds... Restarting in 9 seconds... Restarting in 8 seconds... Restarting in 7 seconds... Restarting in 6 seconds... Restarting in 5 seconds... Restarting in 4 seconds... Restarting in 3 seconds... Restarting in 2 seconds... Restarting in 1 seconds... Restarting in 0 seconds... Restarting now.
Tom's Computer Info / tom@mmto.org