ULP example in 4.0 IDF fails to build

jsam589
Posts: 74
Joined: Sat Aug 17, 2019 9:31 pm

ULP example in 4.0 IDF fails to build

Postby jsam589 » Thu Apr 09, 2020 3:05 am

I am trying to start using ULP in my program. I have stable IDF v4.0. I tried to build the simple ULP example but it seems to be failing to build the auto-generated header file. This is on Windows 10 host. Is this a known issue? Could it be permissions? My command window is not running as Administrator (that has never been a problem before). Thanks for any tips.

Code: Select all

ota_work_1\demo_rel_05\ulp>idf.py build
Checking Python dependencies...
Python requirements from C:\Util\ESP_VERS\4_0_stable\esp-idf\requirements.txt are satisfied.
Executing action: all (aliases: build)
Running ninja in directory c:\users\jsam\ota_work_1\demo_rel_05\ulp\build
Executing "ninja all"...
[1/14] Performing build step for 'bootloader'
ninja: no work to do.

[2/12] Performing build step for 'ulp_main'
[1/1] Generating ulp_main.ld, ulp_main.h
[3/8] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/ulp_example_main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/ulp_example_main.c.obj
C:\Util\ESP_VERS\4_0_stable\tools\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -Iconfig -Iesp-idf/main/ulp_main -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/newlib/platform_include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/freertos/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/heap/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/log/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/soc/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/soc/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_rom/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_common/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/xtensa/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/xtensa/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/driver/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_ringbuf/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_event/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/tcpip_adapter/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/lwip/include/apps -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/lwip/include/apps/sntp -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/lwip/lwip/src/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/lwip/port/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/lwip/port/esp32/include/arch -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/vfs/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_wifi/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_wifi/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/esp_eth/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/efuse/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/efuse/esp32/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/app_trace/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/nvs_flash/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/spi_flash/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/mbedtls/port/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/mbedtls/mbedtls/include -IC:/Util/ESP_VERS/4_0_stable/esp-idf/components/ulp/include -mlongcalls -Wno-frame-address   -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.0\" -DGCC_NOT_5_2_0 -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/ulp_example_main.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\ulp_example_main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/ulp_example_main.c.obj   -c ../main/ulp_example_main.c
../main/ulp_example_main.c:20:10: fatal error: ulp_main.h: No such file or directory
 #include "ulp_main.h"
          ^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

C:\Users\jsam\ota_work_1\demo_rel_05\ulp

jsam589
Posts: 74
Joined: Sat Aug 17, 2019 9:31 pm

Re: ULP example in 4.0 IDF fails to build

Postby jsam589 » Thu Apr 09, 2020 5:45 pm

WORKAROUND found:

The ULP build seems to work smoothly on Linux but not Windows. The root of the problem on Windows seems to be that, by default, .py scripts do not have a default application associated, which would be <somepath>\python.exe.

Although idf.py runs without typing "python idf.py", one line in the ULP build process does not (perhaps it has a separate environment):
<IDF path>\esp-idf\components\ulp\esp32ulp_mapgen.py -s ulp_main.sym -o ulp_main

The esp32ulp_mapgen.py script does not run and the ulp .ld and .h files are not created. Thus, overall build fails.

So, if a .py association is not already in place, this is the one-time workaround I found. It uses Windows commands "assoc" and "ftype" from a command window running as Administrator:

Code: Select all

C:\> assoc .py=Python
C:\> ftype Python="%IDF_TOOLS_PATH%\python_env\idf4.0_py3.7_env\Scripts\python.exe" "%1" %*
(Note: might be necessary to change ftype each time change IDF path)

Who is online

Users browsing this forum: Bing [Bot] and 182 guests