Skip to content

Amend for espressif32@~5.2.0 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: feat-pio-integration
Choose a base branch
from

Conversation

xtrinch
Copy link

@xtrinch xtrinch commented Oct 30, 2022

I managed to fix all the paths and make it compile on espressif32 5.2.0 for esp32 (if a custom sdkconfig is used, also esp32s2 compiles)

I also tested the ADC example on a Lolin32 and it works great!

Copy link
Owner

@likeablob likeablob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xtrinch
Sry for the late reply and big thank you for your PR.

Overall LGTM but I left some comments. Could you please check them?

@@ -10,7 +10,7 @@
},
"[python]": {
"editor.wordBasedSuggestions": true,
"editor.formatOnSave": true,
// "editor.formatOnSave": true,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you turn it back on? Or remove it if you have a specific issue on auto-formatting.

board = esp32dev
framework = arduino
monitor_speed = 115200

lib_deps =
https://github.com/likeablob/ulptool-pio#pio/0.1.0
https://github.com/xtrinch/ulptool-pio
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a chicken-egg problem 🐣 . Let me fix all the lib_deps references before the next version bump.

@@ -0,0 +1,653 @@
// copied from /home/xtrinch/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/dio_qspi/include/sdkconfig.h
Copy link
Owner

@likeablob likeablob Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some more information about the version used here? (I guess it can be deduced from the platform version.)

Also it would be great if you put some notes on why we need this modified sdkconfig.h, let's say, at ulpcc-adc-s2/README.md or somewhere around.

; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32@~5.1.1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use espressif32@~5.2.0 here? At least compilation with pio run finished successfully on my end.

$ grep espressif examples/ulp*/platformio.ini
examples/ulp-counter/platformio.ini:platform = espressif32@~5.2.0
examples/ulpcc-adc-s2/platformio.ini:platform = espressif32@~5.1.1
examples/ulpcc-adc/platformio.ini:platform = espressif32@~5.2.0
examples/ulpcc-counter-s2/platformio.ini:platform = espressif32@~5.2.0
examples/ulpcc-counter/platformio.ini:platform = espressif32@~5.2.0

framework_dir = platform.get_package_dir("framework-arduinoespressif32")
toolchain_ulp_dir = platform.get_package_dir("toolchain-esp32ulp")
toolchain_xtensa_dir = platform.get_package_dir("toolchain-xtensa32")
toolchain_ulp_dir = platform.get_package_dir("toolchain-%sulp" % (mcu))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure why but for the -s2 variants, get_package_dir returns None and I had to install toolchain-esp32s2ulp manually by pio pkg install -t toolchain-esp32s2ulp.
Outdated framework-espidf probably?

$ pio pkg  list
Resolving esp32dev dependencies...
Platform espressif32 @ 5.1.1 (required: espressif32 @ ~5.1.1)
├── framework-arduinoespressif32 @ 3.20004.0 (required: platformio/framework-arduinoespressif32 @ ~3.20004.0)
├── tool-esptoolpy @ 1.30300.0 (required: platformio/tool-esptoolpy @ ~1.30300.0)
├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3)
└── toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch3)

Libraries
└── ulptool-pio @ 0.1.0+sha.cb6f38f (required: git+https://github.com/xtrinch/ulptool-pio)

$ pio run
...
FileNotFoundError: [Errno 2] No such file or directory: 'None/bin/esp32s2ulp-elf-as'
*** Error 1
*** [.pio/build/esp32dev/firmware.elf] Exception : An error returned by ulptool.

$ pio pkg install -t toolchain-esp32s2ulp

$ pio pkg list
Resolving esp32dev dependencies...
Platform espressif32 @ 5.1.1 (required: espressif32 @ ~5.1.1)
├── framework-arduinoespressif32 @ 3.20004.0 (required: platformio/framework-arduinoespressif32 @ ~3.20004.0)
├── tool-esptoolpy @ 1.30300.0 (required: platformio/tool-esptoolpy @ ~1.30300.0)
├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── toolchain-esp32s2ulp @ 1.22851.191205 (required: platformio/toolchain-esp32s2ulp @ ^1.22851.191205)
├── toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3)
└── toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch3)

Libraries
└── ulptool-pio @ 0.1.0+sha.cb6f38f (required: git+https://github.com/xtrinch/ulptool-pio)

Let me check later with a fresh installation but may be we have to explicitly specify additional packages with platform_packages.

@@ -90,6 +90,8 @@ def main(argv):
PATHS['ulptool'] = args.t
PATHS['ucompiler'] = args.u
PATHS['xcompiler'] = args.x
global MCU
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move global MCU to the top of the function definition? (Just for aesthetic reason.)

MCU = "esp32" # ...

def main(argv):
  global MCU

  parser = argparse.ArgumentParser()
  ...

@@ -266,7 +268,7 @@ def build_ulp(PATHS, ulp_sfiles, board_options, has_s_file):
console_string += cmd[0] + '\r'

## Check if sdkconfig.h md5 hash has changed indicating the file has changed
sdk_hash = md5(os.path.join(PATHS['core'] , 'tools', 'sdk', 'include', 'config', 'sdkconfig.h'))
sdk_hash = md5(os.path.join(PATHS['core'] , 'tools', 'sdk', MCU, 'dio_qspi', 'include', 'sdkconfig.h'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(FWIF, it seems there are other variants such as qio_qspi or dout_qspi.

$ ls ~/.platformio/packages/framework-arduinoespressif32@3.20004.0/tools/sdk/esp32/
bin  dio_qspi  dout_qspi  include  ld  lib  qio_qspi  qout_qspi  sdkconfig

@@ -3,7 +3,6 @@
/* This simplifies what the following headers pull in */
#define __ASSEMBLER__

#include "soc/rtc_cntl_reg.h"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it from the upstream change? (Sry for my laziness!)

@maxgerhardt
Copy link

maxgerhardt commented Jan 21, 2023

I fixed up errors occuring in later platform-espressif32 versions in #4, together with improvments on how macros and includes are being passed, since it was hopelessly overflowing the CMD_MAX_LENGTH restriction of Windows.

We also need CI here to automatically verify all examples against a certain platform version to stop regression errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants