ulp code as an esp-idf project component not compiling
Posted: Fri Jan 17, 2020 1:25 am
I have adapted the ulp_i2c_bitbang code from the "esp-iot-solution" github directory. It compiles and runs when all the files are in the "main" directory of the project. When I create a separate component directory for the ulp associated files the project does not compile. The assembly (*.S) files are compiled and *.lst files are generated, the ulp_mag.h file is not generated. I get the following errors:
I can not find any circular dependency in my *.cpp or *.h files.
I suspect that I have a problem with the makefiles. I moved the "ulp makefile" into the component directory. Here is the makefile:
The directory structure is:
ulp3
.....main: main.cpp, component.mk
.....components
..........mag: component.mk, mag.cpp, mag.h
...............ulp: i2c.S, i2c_dev.S, stack.S
This is on a Windows 10 system with esp-idf 3.2
Any help appreciated
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:45: warning: overriding recipe for target 'ulp_mag'
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:29: warning: ignoring old recipe for target 'ulp_mag'
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:50: warning: overriding recipe for target 'ulp_mag'
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:45: warning: ignoring old recipe for target 'ulp_mag'
- /home/Andreas/esp/WM/ulp2/components/mag/component.mk:30: warning: overriding recipe for target 'ulp_mag'
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:50: warning: ignoring old recipe for target 'ulp_mag'
- /home/Andreas/esp/WM/ulp2/components/mag/component.mk:30: warning: overriding recipe for target '.elf'
- /home/Andreas/esp/esp-idf/components/ulp/component_ulp_common.mk:45: warning: ignoring old recipe for target '.elf'
- make[1]: Circular ulp_mag <- ulp_mag dependency dropped.
- make[1]: Circular ulp_mag <- ulp_mag dependency dropped.
- make[1]: Circular .elf <- ulp_mag dependency dropped.
- make[1]: Circular .elf <- ulp_mag dependency dropped.
- make[1]: Circular ulp_mag <- ulp_mag dependency dropped.
- make[1]: Circular /home/Andreas/esp/WM/ulp2/build/mag/ulp_mag <- ulp_mag dependency dropped.
- make[1]: Circular mag_ulp_mapgen_intermediate <- ulp_mag dependency dropped.
- make[1]: Circular .sym <- ulp_mag dependency dropped.
- make[1]: Circular .h <- .h dependency dropped.
- xtensa-esp32-elf-gcc -DESP_PLATFORM -D IDF_VER=\"v3.2-dirty\" -MMD -MP -DGCC_NOT_5_2_0=0 -DWITH_POSIX -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H -MT ulp_mag .common.ld -E -P -xc -o .common.ld -I /home/Andreas/esp/esp-idf/components/app_trace/include -I /home/Andreas/esp/esp-idf/components/app_update/include -I /home/Andreas/esp/esp-idf/components/asio/asio/asio/include -I /home/Andreas/esp/esp-idf/components/asio/port/include -I /home/Andreas/esp/esp-idf/components/bootloader_support/include -I /home/Andreas/esp/esp-idf/components/bt/include -I /home/Andreas/esp/esp-idf/components/coap/port/include -I /home/Andreas/esp/esp-idf/components/coap/port/include/coap -I /home/Andreas/esp/esp-idf/components/coap/libcoap/include -I /home/Andreas/esp/esp-idf/components/coap/libcoap/include/coap -I /home/Andreas/esp/esp-idf/components/console -I /home/Andreas/esp/esp-idf/components/driver/include -I /home/Andreas/esp/esp-idf/components/esp-tls -I /home/Andreas/esp/esp-idf/components/esp32/include -I /home/Andreas/esp/esp-idf/components/esp_adc_cal/include -I /home/Andreas/esp/esp-idf/components/esp_event/include -I /home/Andreas/esp/esp-idf/components/esp_http_client/include -I /home/Andreas/esp/esp-idf/components/esp_http_server/include -I /home/Andreas/esp/esp-idf/components/esp_https_ota/include -I /home/Andreas/esp/esp-idf/components/esp_ringbuf/include -I /home/Andreas/esp/esp-idf/components/ethernet/include -I /home/Andreas/esp/esp-idf/components/expat/expat/expat/lib -I /home/Andreas/esp/esp-idf/components/expat/port/include -I /home/Andreas/esp/esp-idf/components/fatfs/src -I /home/Andreas/esp/esp-idf/components/freemodbus/modbus/include -I /home/Andreas/esp/esp-idf/components/freemodbus/modbus_controller -I /home/Andreas/esp/esp-idf/components/freertos/include -I /home/Andreas/esp/esp-idf/components/heap/include -I /home/Andreas/esp/esp-idf/components/idf_test/include -I /home/Andreas/esp/esp-idf/components/jsmn/include -I /home/Andreas/esp/esp-idf/components/json/cJSON -I /home/Andreas/esp/esp-idf/components/libsodium/libsodium/src/libsodium/include -I /home/Andreas/esp/esp-idf/components/libsodium/port_include -I /home/Andreas/esp/esp-idf/components/log/include -I /home/Andreas/esp/esp-idf/components/lwip/include/apps -I /home/Andreas/esp/esp-idf/components/lwip/lwip/src/include -I /home/Andreas/esp/esp-idf/components/lwip/port/esp32/include -I /home/Andreas/esp/esp-idf/components/lwip/port/esp32/include/arch -I /home/Andreas/esp/esp-idf/components/lwip/include_compat -I /home/Andreas/esp/WM/ulp2/components/mag -I /home/Andreas/esp/WM/ulp2/main/include -I /home/Andreas/esp/esp-idf/components/mbedtls/port/include -I /home/Andreas/esp/esp-idf/components/mbedtls/mbedtls/include -I /home/Andreas/esp/esp-idf/components/mdns/include -I /home/Andreas/esp/esp-idf/components/micro-ecc/micro-ecc -I /home/Andreas/esp/esp-idf/components/mqtt/esp-mqtt/include -I /home/Andreas/esp/esp-idf/components/newlib/platform_include -I /home/Andreas/esp/esp-idf/components/newlib/include -I /home/Andreas/esp/esp-idf/components/nghttp/port/include -I /home/Andreas/esp/esp-idf/components/nghttp/nghttp2/lib/includes -I /home/Andreas/esp/esp-idf/components/nvs_flash/include -I /home/Andreas/esp/esp-idf/components/openssl/include -I /home/Andreas/esp/esp-idf/components/protobuf-c/protobuf-c -I /home/Andreas/esp/esp-idf/components/protocomm/include/common -I /home/Andreas/esp/esp-idf/components/protocomm/include/security -I /home/Andreas/esp/esp-idf/components/protocomm/include/transports -I /home/Andreas/esp/esp-idf/components/pthread/include -I /home/Andreas/esp/esp-idf/components/sdmmc/include -I /home/Andreas/esp/esp-idf/components/smartconfig_ack/include -I /home/Andreas/esp/esp-idf/components/soc/esp32/include -I /home/Andreas/esp/esp-idf/components/soc/include -I /home/Andreas/esp/esp-idf/components/spi_flash/include -I /home/Andreas/esp/esp-idf/components/spiffs/include -I /home/Andreas/esp/esp-idf/components/tcp_transport/include -I /home/Andreas/esp/esp-idf/components/tcpip_adapter/include -I /home/Andreas/esp/esp-idf/components/ulp/include -I /home/Andreas/esp/esp-idf/components/vfs/include -I /home/Andreas/esp/esp-idf/components/wear_levelling/include -I /home/Andreas/esp/esp-idf/components/wifi_provisioning/include -I /home/Andreas/esp/esp-idf/components/wpa_supplicant/include -I /home/Andreas/esp/esp-idf/components/wpa_supplicant/port/include -I /home/Andreas/esp/esp-idf/components/xtensa-debug-module/include -I /home/Andreas/esp/WM/ulp2/build/include -I/home/Andreas/esp/WM/ulp2/components/mag -D__ASSEMBLER__ /home/Andreas/esp/esp-idf/components/ulp/ld/esp32.ulp.ld
- make[1]: Entering directory '/home/Andreas/esp/WM/ulp2/build/libsodium'
- make[1]: Nothing to be done for 'build'.
- make[1]: Leaving directory '/home/Andreas/esp/WM/ulp2/build/libsodium'
- /usr/bin/make -C /home/Andreas/esp/WM/ulp2/build/main -f /home/Andreas/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/home/Andreas/esp/WM/ulp2/main/component.mk COMPONENT_NAME=main build
- xtensa-esp32-elf-gcc.exe: error: .common.ld: No such file or directory
- make[1]: Entering directory '/home/Andreas/esp/WM/ulp2/build/lwip'
- make[1]: Nothing to be done for 'build'.
- make[1]: Leaving directory '/home/Andreas/esp/WM/ulp2/build/lwip'
- make[1]: *** No rule to make target '.common.ld', needed by '.elf'. Stop.
- make[1]: Leaving directory '/home/Andreas/esp/WM/ulp2/build/mag'
- /usr/bin/make -C /home/Andreas/esp/WM/ulp2/build/mbedtls -f /home/Andreas/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/home/Andreas/esp/esp-idf/components/mbedtls/component.mk COMPONENT_NAME=mbedtls build
- make: *** [C:\msys32\home\Andreas\esp\esp-idf/make/project.mk:535: component-mag-build] Error 2
- make: *** Waiting for unfinished jobs....
I suspect that I have a problem with the makefiles. I moved the "ulp makefile" into the component directory. Here is the makefile:
- #
- # ULP support additions to component makefile.
- #
- # 1. ULP_APP_NAME must be unique (if multiple components use ULP)
- # Default value, override if necessary:
- ULP_APP_NAME ?= ulp_$(COMPONENT_NAME)
- #
- # 2. Specify all assembly source files here.
- # Files should be placed into a separate directory (in this case, ulp/),
- # which should not be added to COMPONENT_SRCDIRS.
- ULP_S_SOURCES = $(addprefix $(COMPONENT_PATH)/ulp/, \
- i2c_dev.S \
- i2c.S \
- stack.S \
- )
- #
- # 3. List all the component object files which include automatically
- # generated ULP export file, $(ULP_APP_NAME).h:
- #ULP_EXP_DEP_OBJECTS := main.o
- #ULP_EXP_DEP_OBJECTS := mag.o main.o
- ULP_EXP_DEP_OBJECTS := mag.o
- #ULP_EXP_DEP_OBJECTS := mag.o main.o ulp3.o
- #
- # 4. Include build rules for ULP program
- include $(IDF_PATH)/components/ulp/component_ulp_common.mk
- #
- # Link object files and generate map file
- $(ULP_ELF): $(ULP_OBJECTS) $(ULP_LD_SCRIPT)
- $(summary) ULP_LD $(patsubst $(PWD)/%,%,$(CURDIR))/$@
- $(ULP_LD) -o $@ -A elf32-esp32ulp -Map=$(ULP_MAP) -T $(ULP_LD_SCRIPT) $(ULP_OBJECTS)
- #
- # End of ULP support additions to component makefile.
- #
- #COMPONENT_ADD_INCLUDEDIRS := .
- #COMPONENT_SRCDIRS := .
ulp3
.....main: main.cpp, component.mk
.....components
..........mag: component.mk, mag.cpp, mag.h
...............ulp: i2c.S, i2c_dev.S, stack.S
This is on a Windows 10 system with esp-idf 3.2
Any help appreciated