Problem linking Blink example

ButchAnton
Posts: 2
Joined: Tue Nov 08, 2016 10:24 pm

Problem linking Blink example

Postby ButchAnton » Tue Nov 08, 2016 10:29 pm

Folks:

I just got an ESP32 Thing from Sparkfun and am trying to get the Blink example to work (Mac running El Capitan). I followed the directions on their hookup guide for downloading and installing support for the ESP32 into the Arduino IDE. I set the board, port, speed, etc. and copy/pasta'ed their blink example (only changes the pin number (5) and the delay (500)). However, when it tries to link, I get the following error:

Code: Select all

Linking everything together...
"/Users/butch/Documents/Arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc" "-L/Users/butch/Documents/Arduino/hardware/espressif/esp32/tools/sdk/lib" "-L/Users/butch/Documents/Arduino/hardware/espressif/esp32/tools/sdk/ld" -nostdlib -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority  -Wl,--start-group "/var/folders/7g/mzjkvdxn5jb7dj9wty16tl_mxyly6b/T/arduino_build_686070/sketch/Blink.ino.cpp.o" "/var/folders/7g/mzjkvdxn5jb7dj9wty16tl_mxyly6b/T/arduino_build_686070/arduino.ar" -lgcc -lc -lm -lhal -lcore -lnet80211 -lphy -lrtc -lpp -lwpa -lsmartconfig -lbtdm_app -lbt -ldriver -lesp32 -lcrypto -lexpat -lfreertos -ljson -llog -llwip -lmbedtls -lnghttp -lnvs_flash -lspi_flash -ltcpip_adapter -lnewlib -lvfs -Wl,--end-group -o "/var/folders/7g/mzjkvdxn5jb7dj9wty16tl_mxyly6b/T/arduino_build_686070/Blink.ino.elf"
"python" "/Users/butch/Documents/Arduino/hardware/espressif/esp32/tools/esptool.py" --chip esp32 elf2image --flash_mode "dio" --flash_freq "80m" -o "/var/folders/7g/mzjkvdxn5jb7dj9wty16tl_mxyly6b/T/arduino_build_686070/Blink.ino.bin" "/var/folders/7g/mzjkvdxn5jb7dj9wty16tl_mxyly6b/T/arduino_build_686070/Blink.ino.elf"
Traceback (most recent call last):
  File "/Users/butch/Documents/Arduino/hardware/espressif/esp32/tools/esptool.py", line 25, in <module>
    import serial
ImportError: No module named serial
exit status 1
Error compiling for board ESP32 Dev Module.
(full output at https://gist.github.com/ButchAnton/068e ... cf25627b2c)

I've tried five different versions of the Arduino IDE with similar results. I've also dropped into the python REPL and was able to import serial, so that shouldn't be an issue.

Any ideas?

Thanks!

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Problem linking Blink example

Postby ESP_igrr » Tue Nov 08, 2016 11:58 pm

It may be the case that 'python' you run in console is not the same 'python' which is run by Arduino IDE.
I think i had something similar in the past, when my PATH variable was updated in ~/.profile with some /opt paths being added in front of other paths. Arduino IDE's environment is not affected by your profile or bashrc scripts, which may cause this difference.

Try checking python version which is run from Arduino IDE, by modifying esptool command in boards.txt. Add something like '--version' instead of the real 'esptool.py' command and check the output, then compare with what you get in your shell.

ButchAnton
Posts: 2
Joined: Tue Nov 08, 2016 10:24 pm

Re: Problem linking Blink example

Postby ButchAnton » Wed Nov 09, 2016 6:45 pm

In dorking around with platform.txt (boards.txt doesn't seem to define the link phase), I rewrote the following rule:
recipe.objcopy.hex.pattern
In doing this, I was able to determine that my path wasn't being inherited and instead was being set to
PATH=/usr/bin:/bin:/usr/sbin:/sbin
This means that it is picking up the system version of python in /usr/bin, which is 2.7.10. It also means that it is picking up the system version of the python libraries, which don't include pyserial.

Noting this, I then ran
/usr/bin/easy_install pyserial
which installed the pyserial library into the default system location.

Now things compile. So far.

However, this is not ideal. How can I get the tool chain to pick up my path instead of using the neutered one above?

Further, is it normal to have to reset the dev board after it has been flashed in order to get it to run the sketch? That's what I had to do in order to get the blink sketch to run.

Thanks for all your help!

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Problem linking Blink example

Postby ESP_igrr » Thu Nov 10, 2016 2:15 am

I don't know an easy way to make an OS X application pick up your shell path if you set it in ~/.profile. I suppose installing pyserial as a library for the bundled python distribution is the easiest way.

Regarding having to reset the board, yes, this is the way it has to work. I think auto-reset after upload is something that esptool.py can implement at some point, but it's not there yet.

Who is online

Users browsing this forum: No registered users and 116 guests