esp-idf: ulp_s_sources is not working as expected in CMakeList.txt (IDFGH-2635)

Environment

  • Development Kit: Any [ESP32-Wrover-Kit|ESP32-DevKitC|ESP32-PICO-Kit|ESP32-LyraT|ESP32-LyraTD-MSC|none]
  • Kit version (for WroverKit/PicoKit/DevKitC): Any [v1|v2|v3|v4]
  • Module or chip used: Any [ESP32-WROOM-32|ESP32-WROOM-32D|ESP32-WROOM-32U|ESP32-WROVER|ESP32-WROVER-I|ESP32-WROVER-B|ESP32-WROVER-IB|ESP32-SOLO-1|ESP32-PICO-D4|ESP32]
  • IDF version (run git describe --tags to find it): v4.0-rc
  • Build System: CMake idf.py
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0
  • Operating System: Windows
  • (Windows only) environment type: ESP Command Prompt.
  • Using an IDE?: No
  • Power Supply: External 3.3V

Problem Description

I’m migrating to CMake a project that I used to run in 3.x from IDF. After solving all compilation issues so far, I’m now facing one that seems to me is a ESP-IDF issue. I’m trying to add multiple .S files into the CMakeList.txt, in the “set(ulp_s_sources” area and seems to only add the first file, which in this case is “ulp/BatteryCharger.S”

#
# ULP support additions to component CMakeLists.txt.
#
# 1. The ULP app name must be unique (if multiple components use ULP).
set(ulp_app_name ulp_${COMPONENT_NAME})
#
# 2. Specify all assembly source files.
#    Files should be placed into a separate directory (in this case, ulp/),
#    which should not be added to COMPONENT_SRCS.
set(ulp_s_sources ulp/BatteryCharger.S ulp/BatteryGauge.S ulp/HallSensor.S ulp/i2c.S ulp/i2c_BMI160.S ulp/i2c_LC709203F.S ulp/main.S ulp/stack.S)
#
# 3. List all the component source files which include automatically
#    generated ULP export file, ${ulp_app_name}.h:
set(ulp_exp_dep_srcs "main.c")
#
# 4. Call function to build ULP binary and embed in project using the argument
#    values above.
ulp_embed_binary(${ulp_app_name} ${ulp_s_sources} ${ulp_exp_dep_srcs})`

I noticed it because after compiling it (either clean or dirty), the ulp_main.h file generated have only variables declared extern from “ulp/BatteryCharger.S” and not also from the others files.

Expected Behavior

To generate “ulp_main.h” with all the variables inside the files listed in “set(ulp_s_sources”

Actual Behavior

Just generating “ulp_main.h” with variables from the first file listed which makes my compilation to fail because is not able to find variables I have in main from the other .S files.

Steps to reproduce

  1. Create a project that makes use of ULP
  2. Make sure your project uses at least 2 assembly files with global variables each.
  3. List them inside CMakeList.txt in main folder.
  4. Compile and look for “ulp_main.h” inside “yourprojectname\build\esp-idf\main\ulp_main\ulp_main.h”

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Replacing set(ulp_s_sources "ulp/i2c.S" "ulp/i2c-adc.S" "ulp/i2c-util.S" "ulp/main.S" "ulp/stack.S" "ulp/adc.S") with set(ulp_s_sources "ulp/i2c.S ulp/i2c-adc.S ulp/i2c-util.S ulp/main.S ulp/stack.S ulp/adc.S") seems to help.

Essentially, all ulp files need to be declared within the two quotes.