ESP32: Linux build help

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
cversek
Posts: 13
Joined: Sat Jan 07, 2017 4:45 am

ESP32: Linux build help

Post by cversek » Mon Feb 27, 2017 4:55 am

Hi, I've been able to build the ESP32 micropython firmware by following this Adafruit guide which uses an Ubuntu 14.01 Vagrant virtual machine. However, when I try to follow the same steps on my native Ubuntu 15.10 system, I run into some frustrating linker errors, always crashing at this step (clipped result of `make V=1`):

Code: Select all

LINK build/bootloader.elf
xtensa-esp32-elf-gcc  -nostdlib -L/home/cversek/esp/esp-idf//lib -L/home/cversek/esp/esp-idf//ld -u call_user_start_cpu0 -Wl,--gc-sections -static -Wl,-EL -Wl,-Map=build/bootloader.map -Wl,--cref -T /home/cversek/esp/esp-idf//components/bootloader/src/main/esp32.bootloader.ld -T /home/cversek/esp/esp-idf//components/bootloader/src/main/esp32.bootloader.rom.ld -T /home/cversek/esp/esp-idf//components/esp32/ld/esp32.rom.ld -o build/bootloader.elf  -Wl,--start-group build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/bootloader_flash.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/bootloader_random.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/secure_boot_signatures.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/secure_boot.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/esp_image_format.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/flash_encrypt.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader_support/src/flash_partitions.o build/bootloader//home/cversek/esp/esp-idf//components/log/log.o build/bootloader//home/cversek/esp/esp-idf//components/spi_flash/spi_flash_rom_patch.o build/bootloader//home/cversek/esp/esp-idf//components/micro-ecc/micro-ecc/uECC.o build/bootloader//home/cversek/esp/esp-idf//components/bootloader/src/main/bootloader_start.o -L/home/cversek/esp/esp-idf//components/esp32/lib -lrtc -L/home/cversek/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/ -lgcc -Wl,--end-group
build/bootloader//home/cversek/esp/esp-idf//components/bootloader/src/main/bootloader_start.o:(.literal.bootloader_main+0x74): undefined reference to `rtc_set_cpu_freq'
build/bootloader//home/cversek/esp/esp-idf//components/bootloader/src/main/bootloader_start.o: In function `bootloader_main':
bootloader_start.c:(.text.bootloader_main+0x6): undefined reference to `rtc_set_cpu_freq'
bootloader_start.c:(.text.bootloader_main+0xf): undefined reference to `rtc_set_cpu_freq'
collect2: error: ld returned 1 exit status
Makefile:645: recipe for target 'build/bootloader.elf' failed
make: *** [build/bootloader.elf] Error 1
Here is the contents of the `makefile`:

Code: Select all

ESPIDF = $(HOME)/esp/esp-idf/
PORT = /dev/ttyUSB0
FLASH_MODE = dio
FLASH_SIZE = 16MB
#CROSS_COMPILE = xtensa-esp32-elf-

include Makefile
And here is some toolkit version info:

Code: Select all

$ xtensa-esp32-elf-gcc -v
Using built-in specs.
COLLECT_GCC=xtensa-esp32-elf-gcc
COLLECT_LTO_WRAPPER=/home/cversek/esp/xtensa-esp32-elf/bin/../libexec/gcc/xtensa-esp32-elf/5.2.0/lto-wrapper
Target: xtensa-esp32-elf
Configured with: /home/ivan/e/crosstool-NG/.build/src/gcc-5.2.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf --prefix=/home/ivan/e/crosstool-NG/builds/xtensa-esp32-elf --with-local-prefix=/home/ivan/e/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-sysroot=/home/ivan/e/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-61-gab8375a' --disable-__cxa_atexit --enable-cxx-flags='-fno-exceptions -fno-rtti' --with-gmp=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpfr=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpc=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-isl=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-cloog=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-libelf=/home/ivan/e/crosstool-NG/.build/xtensa-esp32-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-nls --disable-multilib --enable-languages=c,c++ --disable-libstdcxx-verbose
Thread model: single
gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 
Any help or commiseration would be appreciated!

cversek
Posts: 13
Joined: Sat Jan 07, 2017 4:45 am

Re: ESP32: Linux build help

Post by cversek » Tue Feb 28, 2017 6:20 am

Eventually, I worked this out. So this was a fork of micropython-esp32 that I made and there was something screwy about how the toolchain was interacting with it. So starting again from the original repo, I was able to get things working after reverting `esp-idf/` to the commit starting with 13dfb55.

Post Reply