Working with ESP Arduino 2.0.2

Create the project for your target board as normal and follow https://github.com/platformio/platform-espressif32/issues/619#issuecomment-1061971705.

Thank you for the reply!

Sorry for all the newbie questions, but I really do appreciate the help.

The last post on that issue points to instructions at https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-platformio

I’ve tried those, but I get an error when linking. Any pointers on what I’m doing wrong would be greatly appreciated!

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.3.1+sha.3784198) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 0.0.0+sha.d977359
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa-esp32 8.4.0+2021r1
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\arduino-esp32\src\main.cpp.o
Generating partitions .pio\build\arduino-esp32\partitions.bin
Archiving .pio\build\arduino-esp32\libFrameworkArduinoVariant.a
Compiling .pio\build\arduino-esp32\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\FirmwareMSC.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\HWCDC.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\IPv6Address.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\Print.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\USB.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\USBMSC.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\WString.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\base64.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-i2c-slave.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-misc.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-psram.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-rmt.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-timer.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-tinyusb.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-touch.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\esp32-hal-uart.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\firmware_msc_fat.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\main.cpp.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\arduino-esp32\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\arduino-esp32\libFrameworkArduino.a
Linking .pio\build\arduino-esp32\firmware.elf
xtensa-esp32-elf-g++: error: Project.map: No such file or directory
*** [.pio\build\arduino-esp32\firmware.elf] Error 1
==================================================================================================================================== [FAILED] Took 21.85 seconds

What happens when you use platform = https://github.com/Jason2866/platform-espressif32.git?

I get the the same error on linking :frowning:

You might have found a bug here. The Arduino-ESP32 linker script wants to do

Can you please use the project task Advanced → Verbose Build and copy the last failing command in full?

Thanks for the quick reply!

I think I’ve grabbed the output from the Verbose Build correctly here, but the command line is pretty long:

> Executing task: C:\Users\Tom Hayko\.platformio\penv\Scripts\platformio.exe run --verbose --environment arduino-esp32 <

Processing arduino-esp32 (platform: https://github.com/Jason2866/platform-espressif32.git; board: esp32dev; framework: arduino; platform_packages: framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------FILESYSTEM  spiffs
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (2.0.3+sha.2026c63) (git+https://github.com/Jason2866/platform-espressif32.git) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 0.0.0+sha.d977359 (git+https://github.com/espressif/arduino-esp32#master)
 - tool-esptoolpy 1.30201.220126 (3.2.1, https://github.com/tasmota/esptool/releases/download/v3.2.1/esptool-3.2.1.zip)
 - tool-mklittlefs 1.203.210628 (2.3)
 - tool-mkspiffs 2.230.0 (2.30)
 - toolchain-xtensa-esp32 8.4.0+2021r2-patch2
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
xtensa-esp32-elf-g++ -o .pio\build\arduino-esp32\firmware.elf -mlongcalls -Wno-frame-address -Wl,--cref -Wl,--gc-sections -fno-rtti -fno-lto -Wl,--wrap=longjmp -Wl,--undefined=uxTopUsedPriority -T esp32.rom.redefined.ld -T memory.ld -T sections.ld -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.peripherals.ld -u ld_include_hli_vectors_bt -u _Z5setupv -u _Z4loopv -u esp_app_desc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u pthread_include_pthread_rwlock_impl -u ld_include_highint_hdl -u start_app -u start_app_other_cores -u __ubsan_include -u __assert_func -u vfs_include_syscalls_impl -u app_main -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u newlib_include_assert_impl -u __cxa_guard_dummy -Wl,-Map="C:\Users\Tom Hayko\Documents\PlatformIO\Projects\Test "Project\.pio\build\arduino-esp32\Test Project.map"" .pio\build\arduino-esp32\src\main.cpp.o -L.pio\build\arduino-esp32 "-LC:\Users\Tom Hayko\.platformio\packages\framework-arduinoespressif32@src-e36c2260a49b9bf6768237494cebb35d\tools\sdk\esp32\lib" "-LC:\Users\Tom Hayko\.platformio\packages\framework-arduinoespressif32@src-e36c2260a49b9bf6768237494cebb35d\tools\sdk\esp32\ld" -Wl,--start-group .pio\build\arduino-esp32\libFrameworkArduinoVariant.a .pio\build\arduino-esp32\libFrameworkArduino.a -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lasio -lbt -lcbor -lunity -lcmock -lcoap -lnghttp -lesp-tls -lesp_adc_cal 
-lesp_hid -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lesp_lcd -lprotobuf-c -lprotocomm -lmdns -lesp_local_ctrl -lsdmmc -lesp_serial_slave_link -lesp_websocket_client -lexpat -lwear_levelling -lfatfs -lfreemodbus -ljsmn -ljson -llibsodium -lmqtt -lopenssl -lperfmon -lspiffs -lulp -lwifi_provisioning -lbutton -ljson_parser -ljson_generator -lesp_schedule -lesp_rainmaker -lqrcode -lws2812_led -lesp-dsp -lesp32-camera -lesp_littlefs -lfb_gfx -lasio -lcbor -lcmock -lunity -lcoap -lesp_lcd -lesp_local_ctrl -lesp_websocket_client -lexpat -lfreemodbus -ljsmn -llibsodium -lperfmon -lesp_adc_cal -lesp_hid -lfatfs -lwear_levelling -lopenssl -lspiffs -lesp_rainmaker -lmqtt -lwifi_provisioning -lprotocomm -lbt -lbtdm_app -lprotobuf-c -lmdns -ljson -ljson_parser -ljson_generator -lesp_schedule -lqrcode -lcat_face_detect -lhuman_face_detect -lcolor_detect -lmfn -ldl -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy -lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link 
-lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls -lapp_update -lbootloader_support -lspi_flash -lnvs_flash -lpthread -lesp_gdbstub -lespcoredump -lesp_phy 
-lesp_system -lesp_rom -lhal -lvfs -lesp_eth -ltcpip_adapter -lesp_netif -lesp_event -lwpa_supplicant -lesp_wifi -lconsole -llwip -llog -lheap -lsoc -lesp_hw_support -lxtensa -lesp_common -lesp_timer -lfreertos -lnewlib -lcxx -lapp_trace -lnghttp -lesp-tls -ltcp_transport -lesp_http_client -lesp_http_server -lesp_https_ota -lsdmmc -lesp_serial_slave_link -lulp -lmbedtls -lmbedcrypto -lmbedx509 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lpp -lsmartconfig -lwapi -lphy -lrtc -lesp_phy -lphy -lrtc -lesp_phy -lphy -lrtc -lxt_hal -lm -lnewlib -lstdc++ -lpthread -lgcc -lcxx -lapp_trace -lgcov -lapp_trace -lgcov -lc -Wl,--end-group
xtensa-esp32-elf-g++: error: Project.map: No such file or directory
*** [.pio\build\arduino-esp32\firmware.elf] Error 1
============================================================================================================================ [FAILED] Took 6.60 seconds ============================================================================================================================

Hm yes this is the problem. The SCons build system does some auto-escaping here that the build script does not anticipate. (I assume there is no literal " in your project folder’s name)

Two possibilites:

  • Move the project in a path without spaces and retry.
  • Go to C:\Users\Tom Hayko\.platformio\packages\framework-arduinoespressif32 (there might be multiple such folders in different versions), find the tools/platformio-build-esp32.py file and replace
    '-Wl,-Map="%s"' % join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))

with

    '-Wl,-Map', join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))

I tried moving the project to path without spaces (“C:\Projects”) and still got the same error.

I also tried updating the tools/platformio-build-esp32.py as suggested, and I still got the same error. There were two, one under the path

framework-arduinoespressif32@src-e36c2260a49b9bf6768237494cebb35d

and another under

framework-arduinoespressif32@src-afacabbe58d012c05a6ee24950dc6ba1

Anything else I can try?

And yes, you are correct, I do not have a literal " in the project folder’s name.

I can definitely reproduce your error though…

C:\Users\Max\temp\Test Project With Spaces>pio run
[..]
Linking .pio\build\esp32dev\firmware.elf
xtensa-esp32-elf-g++: error: Project: No such file or directory
xtensa-esp32-elf-g++: error: With: No such file or directory
xtensa-esp32-elf-g++: error: Spaces.map: No such file or directory
*** [.pio\build\esp32dev\firmware.elf] Error 1
================[FAILED] Took 102.29 seconds ================

For me it generates the command

-Wl,-Map=“C:\Users\Max\temp\Test Project With “Spaces\.pio\build\esp32dev\Test Project With Spaces.map””

And when I do my suggested fix…

-Wl,-Map C:\Users\Max\temp\Test Project With “Spaces\.pio\build\esp32dev\Test Project With Spaces.map”

Sadly it still does the wrong output :frowning:

Most interestingly PlatformIO seems to split my PROJECT_BUILD_DIR in two halves

  'PROJECT_BUILD_DIR': 'C:\\Users\\Max\\temp\\Test Project With '
                       'Spaces\\.pio\\build',
  'PROJECT_CONFIG': 'C:\\Users\\Max\\temp\\Test Project With '
                    'Spaces\\platformio.ini',

I will have to investigate this more.

1 Like

Please change line 27 in the builder script to

from os.path import abspath, isdir, isfile, join, basename, relpath

and then the previously discussed line (145) to

        '-Wl,-Map="%s"' %  relpath(join(env.subst("$PROJECT_BUILD_DIR"), env.subst("$PIOENV") , basename(env.subst("${PROJECT_DIR}.map")))).replace(" ", "_")

Does it work now?

1 Like

That seems to work now!

Thanks.

I did a clean build as well.

One small thing, the second changed line was at line 115 in my copy of platformio-build-esp32.py

So just to summarize in one place. my platformio.ini now looks like this:

[env:arduino-esp32]
platform = https://github.com/Jason2866/platform-espressif32.git
board = esp32dev
framework = arduino
platform_packages = 
	framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master

And I modified my platformio-build-esp32.py to change line 27 to

from os.path import abspath, isdir, isfile, join, basename, relpath

and also in the same file, changed the line

'-Wl,-Map="%s"' % join("$BUILD_DIR", basename(env.subst("${PROJECT_DIR}.map")))

to

'-Wl,-Map="%s"' % relpath(join(env.subst("$PROJECT_BUILD_DIR"), env.subst("$PIOENV") , basename(env.subst("${PROJECT_DIR}.map")))).replace(" ", "_")

That worked? Not

this here?

Max, sorrry, that was my error. The second change worked. I’ve edited my previous post to reflect this now.

Thank you so much for your help!

1 Like

I’ve noticed several posts recently with PIO not liking spaces in the Project name. Looks like you found a way to fix the builder. Nice job.

Issues

are now open in respect to this.

I made a Platformio setup for the Official release core 2.0.3-rc1 from yesterday. The fix from @maxgerhardt is included.
You need just this

platform = https://github.com/Jason2866/platform-espressif32/releases/download/v2.0.3-rc1/platform-espressif32-2.0.3-rc1.zip

All the best wishes and hopes to the Platformio crew in Ukraine!!

3 Likes

I’m trying to get some of my projects running using the latest ESP Arduino version (2.0.*) and came across this discussion. I followed it up until Jason’s last reply. I’ve downloaded the zip file and looked at it but I have no idea what I’m suppose to do with it. I have modified my platformio.ini file and successfully updated to using v2.0.3 but I was wanting to use Jasons. update so I don’t have to modify the platformio-build-esp32.py. Thanks in advance for your help

You’re not supposed to download it, you’re supposed pu to the link as the platform = ... value in your project’s platformio.ini. Nothing else should be needed to upgrade to 2.0.3.

Thanks Max, I have it working now