duff2013 / ulptool

Program the esp32 ULP coprocessor in Arduino
275 stars 69 forks source link

Fix python3 and arduino2x and esp32sdk2x #92

Open mhier opened 6 months ago

derrickoswald commented 1 week ago

The define constant CONFIG_ULP_COPROC_RESERVE_MEM probably needs to be changed to CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM and also also in src/include/ulptool/ulptool.h lines 29-35:


  if (load_addr_bytes > CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM) {
    return ESP_ERR_INVALID_ARG;
  }

  if (load_addr_bytes + program_size_bytes > CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM) {
    return ESP_ERR_INVALID_SIZE;
  }
mhier commented 1 week ago

A constant with "ESP32S3" in its name seems to be device specific. What points you in the direction that this needs to be changed? Do you face an error message?

derrickoswald commented 1 week ago

@mhier In my (linux) Arduino IDE installation, with the Arduino Nano ESP32 board, I see only these constants (except for the ulptool directory):

~/.arduino15 $ grep --recursive _COPROC_RESERVE_MEM *
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/sdkconfig:CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=1024
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/qio_opi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/qio_qspi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/dio_qspi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/opi_qspi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/dio_opi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0
packages/arduino/hardware/esp32/2.0.17/tools/sdk/esp32s3/opi_opi/include/sdkconfig.h:#define CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM 0

So, it doesn't match what is encoded in the ulptool unless the constant is changed.

mhier commented 1 week ago

Ok, thanks. We need to find a way to use the right constant depending on the variant of the ESP32. I don't have an ESP32S3, hence changing the constant to CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM would make it fail for me...

derrickoswald commented 2 days ago

@mhier When I manually install the Espressif Arduino ESP32 development environment for linux from docs.espressif.com, the esp32s3 configuration uses the expected constant, but the esp32s2 configuration has the extended name syntax:

~/Arduino$ grep --recursive ULP_COPROC_RESERVE_MEM
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/sdkconfig:CONFIG_ULP_COPROC_RESERVE_MEM=512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/qio_opi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/qio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/dio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/opi_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/dio_opi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s3/opi_opi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/sdkconfig:CONFIG_ULP_COPROC_RESERVE_MEM=512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/sdkconfig:CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM=512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/qio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/qio_qspi/include/sdkconfig.h:#define CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM CONFIG_ULP_COPROC_RESERVE_MEM
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/dio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32s2/dio_qspi/include/sdkconfig.h:#define CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM CONFIG_ULP_COPROC_RESERVE_MEM
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/sdkconfig:CONFIG_ULP_COPROC_RESERVE_MEM=512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/sdkconfig:CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/qio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/qio_qspi/include/sdkconfig.h:#define CONFIG_ESP32_ULP_COPROC_RESERVE_MEM CONFIG_ULP_COPROC_RESERVE_MEM
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/dio_qspi/include/sdkconfig.h:#define CONFIG_ULP_COPROC_RESERVE_MEM 512
hardware/espressif/esp32/tools/esp32-arduino-libs/esp32/dio_qspi/include/sdkconfig.h:#define CONFIG_ESP32_ULP_COPROC_RESERVE_MEM CONFIG_ULP_COPROC_RESERVE_MEM

So, I think the errant naming scheme is old (version 2.0.17) and Espressif have reconsidered how much that broke everybody's scripts. I assume the esp32s2 tree will revert (eventually) to the original constant names.