platform-espressif32 icon indicating copy to clipboard operation
platform-espressif32 copied to clipboard

Problem when compiling ESP32 ULP sources (framework Arduino)

Open fededim opened this issue 5 years ago • 28 comments

I have a problem when trying to compile on platformio this project for ESP32, framework Arduino, with ulp source code in assembly. From the error I receive it seems that the compiler does not understand it is an assembly file (I think it tries to compile it as C/C++ file, see attached log). I have also tried to add platform_packages = toolchain-esp32ulp to platform.ini, but the error persists. Can anybody give me some hint ? How does platform io understands which compiler (e.g. executable) to use according to source file extension ?

compilation output.txt

fededim avatar Apr 12 '20 15:04 fededim

Hi @fededim ! Try to change asm file extension from .s to uppercase .S

valeros avatar Apr 13 '20 08:04 valeros

Doesn't work, you closed the issue too early, please reopen it. I attach the verbose log, it seems that it uses the "xtensa-esp32-elf-gcc -x assembler-with-cpp tool" to compile the .S file but probably it's wrong.

verbose.txt

fededim avatar Apr 13 '20 08:04 fededim

Does it work if you compile it using unmodified Arduino IDE?

valeros avatar Apr 13 '20 09:04 valeros

On unmodified Arduino IDE it does not work, you must add tools and scripts to Arduino as reported in https://github.com/duff2013/ulptool

fededim avatar Apr 13 '20 10:04 fededim

Hi @fededim ! Any luck with this ? I've been facing the same problem

Guiartuzo avatar Jul 22 '20 12:07 Guiartuzo

No I had to switch to Arduino

fededim avatar Jul 22 '20 14:07 fededim

This was mentioned again in https://community.platformio.org/t/esp32-ulp-coprocessor-programming-in-arduino-framework/20821

maxgerhardt avatar Apr 19 '21 20:04 maxgerhardt

Hi, I see that on Arduino IDE this is possible, I don't know if this can help you in any way but here you can find the repo that enables this functionality.

https://github.com/duff2013/ulptool

javipelopi avatar Jun 21 '21 08:06 javipelopi

Any progress in this? This is quite essential for battery operated projects.

Nagymadar avatar Jun 27 '21 11:06 Nagymadar

+1 for using ULP with Arduino

Jason2866 avatar Oct 31 '21 10:10 Jason2866

+1

Shame this is not supported. Probably one of the biggest setbacks of using PIO. I use ULP in almost all of my projects.

nzagorec avatar Nov 19 '21 16:11 nzagorec

I think no one does this, although the ULP itself is almost as powerful as an AVR. :-/

Nagymadar avatar Nov 19 '21 19:11 Nagymadar

+1

codeleger avatar Feb 22 '22 11:02 codeleger

Hi folks, FYI I wrote a thin wrapper of ulptool for PlatformIO, though it's more like a workaround rather than solution. https://github.com/likeablob/ulptool-pio/tree/feat-pio-integration

likeablob avatar Mar 21 '22 11:03 likeablob

@likeablob A step forward finally. Thanks a lot! I started to try it right away. I am using platformio VS code on win10. It gives a script error in esp32ulp_build_recipe.py . Any idea?

> Executing task in folder ULP_arduino_test: C:\Users\usr\.platformio\penv\Scripts\platformio.exe run <

Processing esp32dev (board: esp32dev; platform: espressif32; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > 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 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 64 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ulptool-pio> 0.1.0+sha.7c5dd85
Building in release mode
cb([".pio\build\esp32dev\firmware.elf"], [".pio\build\esp32dev\src\ulp_counter.cpp.o"])
Running ulptool
C:\Users\usr\.platformio\penv\Scripts\python.exe D:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio/src/esp32ulp_build_recipe.py -ID:\arduino\ULP_arduino_test\ulp -ID:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\include\ulptool -ID:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\ulpcc\include -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\config -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_trace -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_update -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\asio -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bootloader_support -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bt -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\coap -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\console -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\efuse -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-tls -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32 -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_adc_cal -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_event -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_client -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_server -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_ota -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_server -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_ringbuf -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_websocket_client -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\espcoredump -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ethernet -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\expat -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fatfs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freemodbus -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\heap -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\idf_test -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\jsmn -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\json -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\libsodium -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\log -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\lwip -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mbedtls -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mdns -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\micro-ecc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mqtt -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\newlib -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nghttp -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nvs_flash -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\openssl -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protobuf-c -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protocomm -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\pthread -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\sdmmc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\smartconfig_ack -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\soc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spi_flash -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spiffs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcp_transport -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcpip_adapter -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ulp -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\unity -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\vfs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wear_levelling -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wifi_provisioning -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wpa_supplicant -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\xtensa-debug-module -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32-camera -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fb_gfx -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\cores\esp32 -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\variants\esp32 
-b D:\arduino\ULP_arduino_test -p C:\Users\usr\.platformio\packages\framework-arduinoespressif32 -u C:\Users\usr\.platformio\packages\toolchain-esp32ulp/bin -x C:\Users\usr\.platformio\packages\toolchain-xtensa32/bin -t D:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio/src/ --DARDUINO_ESP32_DEV --DARDUINO=10805 --DARDUINO_ARCH_ESP32 --DARDUINO_VARIANT=\"esp32\" --DARDUINO_BOARD=\"Espressif\ ESP32\ Dev\ Module\"
Traceback (most recent call last):
  File "D:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\esp32ulp_build_recipe.py", line 562, in <module>
    main(sys.argv[1:])
  File "D:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\esp32ulp_build_recipe.py", line 107, in main
    build_ulp(PATHS, ulp_files, board_options, True)
  File "D:\arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\esp32ulp_build_recipe.py", line 151, in build_ulp
    error_string = cmd[0] + '\r' + err
TypeError: can only concatenate str (not "bytes") to str
*** Error 1
*** [.pio\build\esp32dev\firmware.elf] Exception : An error returned by ulptool.
Traceback (most recent call last):
  File "C:\Users\usr\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Action.py", line 1279, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "C:\Users\usr\.platformio\lib\ulptool-pio\post_extra_script_ulptool.py", line 59, in cb
    run_ulptool()
  File "C:\Users\usr\.platformio\lib\ulptool-pio\post_extra_script_ulptool.py", line 54, in run_ulptool
    raise Exception("An error returned by ulptool.")
Exception: An error returned by ulptool.
============================================================================================= [FAILED] Took 1.57 seconds =============================================================================================
The terminal process "C:\Users\usr\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Nagymadar avatar Mar 21 '22 13:03 Nagymadar

File "D:\arduino\ULP_arduino_test.pio\libdeps\esp32dev\ulptool-pio\src\esp32ulp_build_recipe.py", line 151, in build_ulp error_string = cmd[0] + '\r' + err

Try replacing err with err.decode('utf-8'). In any case it seems to be going in the error path.

maxgerhardt avatar Mar 21 '22 14:03 maxgerhardt

Thanks! Did that. Now:


> Executing task in folder ULP_arduino_test: C:\Users\usr\.platformio\penv\Scripts\platformio.exe run <

Processing esp32dev (board: esp32dev; platform: espressif32; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > 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 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 64 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ulptool-pio> 0.1.0+sha.7c5dd85
Building in release mode
cb([".pio\build\esp32dev\firmware.elf"], [".pio\build\esp32dev\src\ulp_counter.cpp.o"])
Running ulptool
C:\Users\usr\.platformio\penv\Scripts\python.exe D:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio/src/esp32ulp_build_recipe.py -ID:\0Arduino\PrototypeTests\ULP_arduino_test\ulp -ID:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\include\ulptool -ID:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\ulpcc\include -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\config -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_trace -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_update -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\asio -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bootloader_support -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bt -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\coap -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\console -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\efuse -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-tls -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32 -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_adc_cal -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_event -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_client -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_server -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_ota -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_server -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_ringbuf -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_websocket_client -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\espcoredump -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ethernet -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\expat -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fatfs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freemodbus -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\heap -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\idf_test -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\jsmn -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\json -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\libsodium -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\log -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\lwip -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mbedtls -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mdns -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\micro-ecc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mqtt -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\newlib -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nghttp -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nvs_flash -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\openssl -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protobuf-c -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protocomm -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\pthread -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\sdmmc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\smartconfig_ack -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\soc -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spi_flash -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spiffs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcp_transport -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcpip_adapter -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ulp -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\unity -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\vfs -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wear_levelling -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wifi_provisioning -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wpa_supplicant -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\xtensa-debug-module -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32-camera -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fb_gfx -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\cores\esp32 -IC:\Users\usr\.platformio\packages\framework-arduinoespressif32\variants\esp32 
-b D:\0Arduino\PrototypeTests\ULP_arduino_test -p C:\Users\usr\.platformio\packages\framework-arduinoespressif32 -u C:\Users\usr\.platformio\packages\toolchain-esp32ulp/bin -x C:\Users\usr\.platformio\packages\toolchain-xtensa32/bin -t D:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio/src/ --DARDUINO_ESP32_DEV --DARDUINO=10805 --DARDUINO_ARCH_ESP32 --DARDUINO_VARIANT=\"esp32\" --DARDUINO_BOARD=\"Espressif\ ESP32\ Dev\ Module\"
C:\Users\usr\.platformio\packages\toolchain-xtensa32/bin\xtensa-esp32-elf-gcc -DESP_PLATFORM -MMD -MP -DWITH_POSIX -DMBEDTLS_CONFIG_FILE=mbedtls\esp_config.h -DHAVE_CONFIG_H -MT ulp_main.common.ld -E -P -xc 
-o ulp_main.common.ld -I D:\0Arduino\PrototypeTests\ULP_arduino_test\ulp -I D:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\include\ulptool -I D:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\src\ulpcc\include -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\config -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_trace -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\app_update -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\asio -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bootloader_support -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\bt -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\coap -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\console -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\efuse -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-tls -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32 -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_adc_cal -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_event -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_client -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_http_server -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_ota -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_https_server -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_ringbuf -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp_websocket_client -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\espcoredump -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ethernet -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\expat -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fatfs -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freemodbus -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\heap -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\idf_test -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\jsmn -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\json -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\libsodium -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\log -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\lwip -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mbedtls -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mdns -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\micro-ecc -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\mqtt -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\newlib -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nghttp -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\nvs_flash -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\openssl -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protobuf-c -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\protocomm -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\pthread -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\sdmmc -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\smartconfig_ack -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\soc -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spi_flash -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\spiffs -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcp_transport -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\tcpip_adapter -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\ulp -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\unity -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\vfs -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wear_levelling -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wifi_provisioning -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\wpa_supplicant -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\xtensa-debug-module -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp32-camera -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\esp-face -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\fb_gfx -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\cores\esp32 -I C:\Users\usr\.platformio\packages\framework-arduinoespressif32\variants\esp32 -DARDUINO_ESP32_DEV -DARDUINO=10805 -DARDUINO_ARCH_ESP32 -DARDUINO_VARIANT="esp32" -DARDUINO_BOARD="Espressif\ -I D:\0Arduino\PrototypeTests\ULP_arduino_test\ulp -D__ASSEMBLER__ D:\0Arduino\PrototypeTests\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio/src/ld\esp32.ulp.ld
<command-line>:0:15: warning: missing terminating " character


*** Error 1
*** [.pio\build\esp32dev\firmware.elf] Exception : An error returned by ulptool.
Traceback (most recent call last):
  File "C:\Users\usr\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Action.py", line 1279, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
  File "C:\Users\usr\.platformio\lib\ulptool-pio\post_extra_script_ulptool.py", line 59, in cb
    run_ulptool()
  File "C:\Users\usr\.platformio\lib\ulptool-pio\post_extra_script_ulptool.py", line 54, in run_ulptool
    raise Exception("An error returned by ulptool.")
Exception: An error returned by ulptool.
============================================================================================= [FAILED] Took 1.73 seconds =============================================================================================
The terminal process "C:\Users\usr\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Nagymadar avatar Mar 21 '22 14:03 Nagymadar

:0:15: warning: missing terminating " character

Is your username containing a space by any chance? There may be path escaping / quoting problems here.

maxgerhardt avatar Mar 21 '22 14:03 maxgerhardt

Is your username containing a space by any chance? There may be path escaping / quoting problems here.

No. Only standard chars and '-' char. Example: C:\Users\xxx-yyy\ ...

Nagymadar avatar Mar 21 '22 14:03 Nagymadar

The project definitely works for me, see log at https://pastebin.com/dNurdNg4. I've tried this on Linux though, not Windows. And followed the README to build twice. (first run ends in src/ulp_counter.cpp:6:22: fatal error: ulp_main.h: No such file or directory).

maxgerhardt avatar Mar 21 '22 14:03 maxgerhardt

Thanks @maxgerhardt. Anyone tried on windows and VS code? Any tips?

Nagymadar avatar Mar 21 '22 14:03 Nagymadar

The command invocations are really long though, maybe dangerously close to Windows's eternal legacy problem of a maximum of 8192 bytes of max commandline length. (https://mcuoneclipse.com/2015/03/29/solving-the-8192-character-command-line-limit-on-windows/). On the other hand, the script does all (subprocess) invocations with shell=False, so maybe this does not apply. Or it's something to do with the - character. Maybe @likeablob has more ideas.

maxgerhardt avatar Mar 21 '22 14:03 maxgerhardt

Tested it with a simple username. Same error.

In the provided examples, in platformio.ini I had to change the paths of pre/post scripts due to an error:

warning: Ignoring missing SConscript 'D:\D:\Arduino\ULP_arduino_test\.pio\libdeps\esp32dev\ulptool-pio\post_extra_script_ulptool.py'

Changed platformio.ini from:

extra_scripts =
  pre:/$PROJECT_LIBDEPS_DIR/$PIOENV/ulptool-pio/pre_extra_script_ulptool.py
  post:/$PROJECT_LIBDEPS_DIR/$PIOENV/ulptool-pio/post_extra_script_ulptool.py

To:

extra_scripts =
  pre:c:\Users\admin\.platformio\lib\ulptool-pio\pre_extra_script_ulptool.py
  post:c:\Users\admin\.platformio\lib\ulptool-pio\post_extra_script_ulptool.py

Can this be the source of the problem?

Nagymadar avatar Mar 21 '22 16:03 Nagymadar

The $PROJECT_LIBDEPS_DIR is already interpreted by PlatformIO, you don't need to replace is. Although the starting / would be wrong on a Windows systems, maybe remove that. (pre:/ -> pre:). But after all, that can't have an effect on the subprocess invocation that is happening deep in the script. If the extra_scripts were wrong, it wouldn't even be calling that script.

maxgerhardt avatar Mar 21 '22 16:03 maxgerhardt

I do not have Arduino IDE installed, only VS code platformio. Therefore I installed ulptool here:

c:\Users\admin.platformio\packages\framework-arduinoespressif32\tools\ulptool\

Is this a problem?

As I do not have Arduino IDE installed, I am not sure where should platform.local.txt file go?

Nagymadar avatar Mar 21 '22 17:03 Nagymadar

The library correctly references toolchain-esp32ulp as a package (c:\Users\<user>\.platformio\packages\toolchain-esp32ulp), there is no need to install anything extra. The platform.loca.txt is also not processed by PlatformIO and not needed.

maxgerhardt avatar Mar 21 '22 18:03 maxgerhardt

@maxgerhardt @Nagymadar Hi, sry for the late reply, and I should have mentioned that I haven't tested it on Windows. (I'm on Ubuntu.) As @maxgerhardt suggested, the root cause probably is in the python script itself. From the traceback, it seems a py2-py3 compatibility thing to me.

BTW, I've just enabled GitHub Issues for the repo. https://github.com/likeablob/ulptool-pio/issues Could you open a new issue there? @Nagymadar

likeablob avatar Mar 22 '22 16:03 likeablob

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 20:07 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 08 '22 22:09 stale[bot]

Just ran into this limitation.

Thanks to @likeablob for posting the wrapper but it is only a band-aid.

Aside from the problem other people had where files had moved and directory structures changed, we hit a problem where because the ulp build seems to be done last the generated header file does not exist during the sketch build, then the build fails and the header doesn't get generated.

The work-around is to comment out all references to the ulp generated file and variables until you have a successful build without them.

dajtxx avatar Dec 20 '22 05:12 dajtxx