Skip to content
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

Build a small release #1

Merged
merged 2 commits into from
Jun 30, 2024
Merged

Build a small release #1

merged 2 commits into from
Jun 30, 2024

Conversation

Jason2866
Copy link

@gojimmypi Release GH for building a small release zip

@gojimmypi
Copy link
Owner

@Jason2866 thank you so much!

Can you please help me understand what your change does & how it works?

@gojimmypi gojimmypi self-assigned this Jun 30, 2024
@Jason2866
Copy link
Author

Dont want to litter the closed issue...

Fork the IDF version you want to use. Do your changes. Add a valid package.json and version.txt in the root. Create a release.

@Jason2866 that sounds like an excellent plan! Thank you so much. I'll give that a try! :)

I don't like mbedtls at all. Would like to try wolfssl

I hear ya on the mbedTLS topic. It's clearly not a priority for them, but it is for wolfSSL.

I have a copy of the Espressif HTTP/S example here with the ESP-IDF updates on my wolfssl branch. It basically works, minus the "certificate bundle" feature that is specific the mbedTLS at this time. See also: https://www.wolfssl.com/forums/post7724.html

I do plan on resolving the certificate bundle topic, but for now I believe wolfSSL is otherwise working on my ESP-IDF fork with the esp-tls layer. Clearly it still needs a bit of cleanup and testing before creating a PR.

There are more wolfSSL examples here (not using the esp-tls layer): https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples

Could you ping me if your wolfssl implementation is ready to use?

Absolutely! Do you have a specific project in mind? Note that wolfSSL simply for the PlatformIO environment should be working just fine:

https://www.wolfssl.com/wolfssl-now-supported-on-platformio/

The issue I am working on is for those that really want to use the esp-tls layer. It's not something I would recommend, as it only adds a layer of complexity. But I understand how some might want it - particularly in an early evaluation stage to easily use either from the ESP-IDF.

If you'd like to take this for a test drive, let me know. I'd love to have your input.

Feel free to reach out to support@wolfssl.com as well.

Cheers

The project in mind is nearly always Tasmota. Tasmota is written in or with? Arduino.
Since the orig. espressif Arduino framework has become to bloated and fat we decided to fork and build our own variant. Since Arduino "sits" on top and is compiled with IDF it was necessary to change IDF settings to optimize for our needs. The biggest part here is/was mbedtls.
Tasmota was a small project done in Arduino and is now to big to move to IDF.
Arduino is not really the right platform anymore. We are fighting with limitations everywhere...
Since we do not need any ssl component from "core" (we use our own stripped down ssl/tls code in Tasmota) our interest is to remove as much as possible from mbedtls code everywhere without breaking the wifi functions.
Honestly trying WolfSSL instead of mbedtls is an idea if the footprint can be more lowered, as in the current approach of disabling as much as possible of mbedtls without breaking the wifi part.

@Jason2866
Copy link
Author

Jason2866 commented Jun 30, 2024

@Jason2866 thank you so much!

Can you please help me understand what your change does & how it works?

@gojimmypi It is easy :-) Enable GH Actions. Draft an release with a tag beginning with v*
GH Actions will build a zip and and will push it in release section of the repo

Before doing this add the version.txt and the package.json! Just merge PR #2 before. If you have done this, you can use the URL to the released zip in Platformio with platform_packages = framework-espidf @ <your URL to release zip>

@Jason2866
Copy link
Author

@gojimmypi Your current attempt is not working ;-) If you don't want to use my GH Actions zip releaser (I do understand, using stuff from Internet strangers ;-))
You have to fork this https://github.com/Jason2866/github-actions/tree/release_idf
and adopt it (or not).

@gojimmypi
Copy link
Owner

Your current attempt is not working

lol, indeed, just as I was scratching my head on the closer, but different error messages!

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
platform_packages =
    framework-espidf @ https://github.com/gojimmypi/esp-idf/archive/refs/tags/v5.4.1a.zip

If you don't want to use my GH Actions zip releaser (I do understand, using stuff from Internet strangers ;-))

embarrassingly, yes... as I don't fully understand what's going on... plus I didn't want remote wildcard dependencies.

You have to fork this

ok, I have the fork! :) Will my release_zips.yml work now?

@Jason2866 thank you so much for your help!

@Jason2866
Copy link
Author

Jason2866 commented Jun 30, 2024

@gojimmypi Your fork of the action just has the main branch. The used one is NOT branch main. For IDF release zips the branch https://github.com/Jason2866/github-actions/tree/release_idf is used

If you want no unnecessary SPAM actions. remove or rename all other *.yaml files in the IDF repo workflows folder

@Jason2866
Copy link
Author

A release is triggered here
image
Push on button "draft a new release"

Copy link

github-actions bot commented Jun 30, 2024

edit: removed irrelevant, auto-generated github action text.

@Jason2866
Copy link
Author

@gojimmypi Merge this PR and you are there :-)

@gojimmypi gojimmypi merged commit 789d810 into gojimmypi:wolfssl Jun 30, 2024
2 checks passed
@Jason2866 Jason2866 deleted the patch-1 branch June 30, 2024 16:25
@gojimmypi
Copy link
Owner

@Jason2866 thank you a LOT for all your help today. I seem to be really close. Definitely a bit of a learning curve here.

The releases seem to have been created.

But they cannot be used:

C:\workspace\wolfssl-gojimmypi\IDE\Espressif\ESP-IDF\examples\espidf-http-request>pio run
Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing https://github.com/gojimmypi/esp-idf/releases/download/untagged-e8887d38e991e8a6c27d/source-esp-idf-v5.4.1f.zip
PackageException: Got the unrecognized status code '404' when downloaded https://github.com/gojimmypi/esp-idf/releases/download/untagged-e8887d38e991e8a6c27d/source-esp-idf-v5.4.1f.zip

C:\workspace\wolfssl-gojimmypi\IDE\Espressif\ESP-IDF\examples\espidf-http-request>pio run
Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
----------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing https://github.com/gojimmypi/esp-idf/releases/download/untagged-e8887d38e991e8a6c27d/esp-idf-v5.4.1f.zip
PackageException: Got the unrecognized status code '404' when downloaded https://github.com/gojimmypi/esp-idf/releases/download/untagged-e8887d38e991e8a6c27d/esp-idf-v5.4.1f.zip

@Jason2866
Copy link
Author

Jason2866 commented Jun 30, 2024

@gojimmypi How do you tag? Something goes wrong here. Verified working is doing no tagging before. Just use the "draft a new release" button from github Web page. Enter the version tag here and hit the button "publish release"

No draft publish! The release needs to be visible for everyone.

@gojimmypi
Copy link
Owner

@Jason2866 I've been creating tags like this:

git tag -a v5.4.1f -m "Release version 5.4.1f"
git push origin v5.4.1f

My web page looks slightly different from yours:

image

I've manually created a release now

https://github.com/gojimmypi/esp-idf/releases/tag/v5.4.1f

I thought the GitHub actions did some things automatically for the releases?

@Jason2866
Copy link
Author

Jason2866 commented Jun 30, 2024

@gojimmypi Do NOT use or open an existing tag. Do not tag via Git. This will not work. You have to "draft a new release" and generate the tag there! You can enter the tag where you see "choose a tag" before choose the branch via "target". This will start the GH Actions zip release and the builded zip will be pushed in this tagged release. You can't use an existing tag. If you want to reuse you have to delete the release and the tag.

Edit: Probably there is a way to do via Git, never did it this way. I guess there is just a step missing...

EDIT2: There is no need to do a code change for doing a release (try).

@gojimmypi
Copy link
Owner

@Jason2866 , ok I see the "draft a new release". That's the same page when visiting

https://github.com/gojimmypi/esp-idf/releases

vs clicking the "create a new release":

image

I followed your instructions and pressed the "draft a new release" from https://github.com/gojimmypi/esp-idf/releases

Odd thing is: the zip files for the release are created almost immediately, even though the workflow is still running.

Eventually the workflow finishes, long after the release zip files are presented in the web UI:

Scanning the drive:
4103 folders, 21084 files, 335234110 bytes (320 MiB)
Creating archive: esp-idf-v5.4.1j.zip
Items to compress: 25187
Files read from disk: 21084
Archive size: 75284972 bytes (72 MiB)
Everything is Ok
Connecting to GitHub...
Doing a full recursive clone of https://github.com/gojimmypi/esp-idf.git (v5.4.1j) into esp-idf-v5.4.1j...
Zip needed files into esp-idf-v5.4.1j.zip...
Existing release found...
Attaching zipfile(s)...
Release URL is https://github.com/gojimmypi/esp-idf/releases/tag/v5.4.1j

And I see a different zip file is available upon completion!

image

And so this is my latest platform.ini file.

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
platform_packages = 
	framework-espidf @ https://github.com/gojimmypi/esp-idf/releases/download/v5.4.1k/esp-idf-v5.4.1k.zip
lib_deps = wolfssl/wolfssl@^5.7.0-rev.3d

Is doesn't work, but it is closer than ever! I think the issue is that there are binary toolchain versions different from the latest PlatformIO version. My release is based on the latest upstream master. Tool doesn't match supported version from list ['esp-13.2.0_20240530']. Full output from build in VS Code:

Resolving esp32dev dependencies...
Tool Manager: Installing https://github.com/gojimmypi/esp-idf/releases/download/v5.4.1k/esp-idf-v5.4.1k.zip
Downloading 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Tool Manager: framework-espidf@3.50400.0 has been installed!
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf @ 3.50400.0 (5.4.0) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-idf @ 1.0.1 
 - tool-mconf @ 1.4060000.20190628 (406.0.0) 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823 
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp-elf @ 13.2.0+20230928
Reading CMake configuration...
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.44.1.windows.1") 
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/workspace/wolfssl-gojimmypi/IDE/Espressif/ESP-IDF/examples/espidf-http-request/sdkconfig.esp32dev
Loading defaults file C:/workspace/wolfssl-gojimmypi/IDE/Espressif/ESP-IDF/examples/espidf-http-request/sdkconfig.defaults...

-- Compiler supported targets: xtensa-esp-elf
-- Configuring incomplete, errors occurred!
See also "C:/workspace/wolfssl-gojimmypi/IDE/Espressif/ESP-IDF/examples/espidf-http-request/.pio/build/esp32dev/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/gojimmypi/.platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):
  

  Tool doesn't match supported version from list ['esp-13.2.0_20240530']:
  C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe


  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  C:/Users/gojimmypi/.platformio/packages/framework-espidf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  C:/Users/gojimmypi/.platformio/packages/framework-espidf/tools/cmake/build.cmake:401 (include)
  C:/Users/gojimmypi/.platformio/packages/framework-espidf/tools/cmake/build.cmake:633 (__build_process_project_includes)
  C:/Users/gojimmypi/.platformio/packages/framework-espidf/tools/cmake/project.cmake:710 (idf_build_process)
  CMakeLists.txt:10 (project)



========================== [FAILED] Took 7.97 seconds ==========================

The message "fatal: not a git repository (or any of the parent directories): .git" is likely benign; I think I know where that's happening & easily remedied.

So I think I'll need to apply my changes to an ESP-IDF release v5.2 and try again. Open to suggestions otherwise if you have an idea.

In the meantime, thank you again! Please send me an email jim@wolfssl.com - I'll get you in touch with someone that can send you some cool wolfSSL swag in appreciation for all your help.

@Jason2866
Copy link
Author

This fatal: not a git repository (or any of the parent directories): .git is normal and is printed always. Does not break compile. The wording is badly choosen.
The reason for break is this

CMake Error at C:/Users/gojimmypi/.platformio/packages/framework-espidf/tools/cmake/tool_version_check.cmake:36 (message):
  

  Tool doesn't match supported version from list ['esp-13.2.0_20240530']:
  C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe

Will send you an email, Thx!

@Jason2866
Copy link
Author

Jason2866 commented Jun 30, 2024

@gojimmypi You can use the newer espressif toolchains from here https://github.com/espressif/crosstool-NG/releases matching to your platform with platform_packages too. I am happy i managed to convince espressif to add a Platformio compatible package.json ;-)

For example:

platform_packages = toolchain-xtensa-esp-elf @ https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-linux-gnu.tar.gz

@gojimmypi
Copy link
Owner

@Jason2866 got your email and thanks for the tips on toolchain! I'll follow up later today.

Cheers

@gojimmypi
Copy link
Owner

gojimmypi commented Jul 1, 2024

Hi @Jason2866 I've been working on a sample pio app. I am nearly there, with "only" a linker problem.

Your toolchain suggestion was nearly successful, but as presented I saw this error when the environment initializes:

Resolving esp32dev dependencies...
Tool Manager: Installing https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-linux-gnu.tar.gz
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Tool Manager: toolchain-xtensa-esp-elf@13.2.0-20240530 has been installed!
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
--------------------------------------------------------------------------------
Tool Manager: Installing https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-linux-gnu.tar.gz
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Tool Manager: toolchain-xtensa-esp-elf@13.2.0-20240530 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf @ 3.50400.0 (5.4.0) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-idf @ 1.0.1 
 - tool-mconf @ 1.4060000.20190628 (406.0.0) 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823 
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType:
  File "C:\Users\gojimmypi\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 612:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 279:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\gojimmypi\.platformio\platforms\espressif32\builder\main.py", line 368:
    target_elf = env.BuildProgram()
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Util\envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "C:\Users\gojimmypi\.platformio\penv\Lib\site-packages\platformio\builder\tools\piobuild.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Util\envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "C:\Users\gojimmypi\.platformio\penv\Lib\site-packages\platformio\builder\tools\piobuild.py", line 121:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Util\envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "C:\Users\gojimmypi\.platformio\penv\Lib\site-packages\platformio\builder\tools\piobuild.py", line 347:
    SConscript(env.GetFrameworkScript(name), exports="env")
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 676:
    return method(*args, **kw)
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 612:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\gojimmypi\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 279:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\gojimmypi\.platformio\platforms\espressif32\builder\frameworks\espidf.py", line 83:
    assert os.path.isdir(TOOLCHAIN_DIR)
  File "<frozen genericpath>", line 42:
    
========================= [FAILED] Took 14.22 seconds =========================

Using your idea though, I was able to get this working with my local copy of the same toolchain version using @ file:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
platform_packages =
    framework-espidf @ https://github.com/gojimmypi/esp-idf/releases/download/v5.4.1k/esp-idf-v5.4.1k.zip
    toolchain-xtensa-esp-elf @ file:///SysGCC//esp32-master//tools//xtensa-esp-elf//esp-13.2.0_20240530//xtensa-esp-elf
    ; toolchain-xtensa-esp-elf @ https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-linux-gnu.tar.gz
lib_deps = wolfssl/wolfssl@^5.7.0-rev.3d

It compiles to the end! Yay! But... (ya, no fun if it is too easy, eh?) ... but the linker fails at line 497 with a syntax error for this:

ASSERT_SECTIONS_GAP(.flash.appdesc, .flash.rodata)

Here's the full output:

C:\workspace\wolfssl-gojimmypi\IDE\Espressif\ESP-IDF\examples\espidf-http-request>pio run
Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf @ 3.50400.0 (5.4.0)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp-elf @ 13.2.0-20240530
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- wolfssl @ 5.7.0-rev.3d
Building in release mode
Linking .pio\build\esp32dev\firmware.elf
C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe:sections.ld:497: syntax error
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1
========================================================================= [FAILED] Took 8.03 seconds =========================================================================

I've fussed with various settings in pio run -t menuconfig without success.

This should be a good toolchain, something I've used quite a lot in Visual Studio with VisualGDB.

Have you seen anything like this? Any suggestions where to go from here?

Perhaps I'll be back-porting my changes to ESP-IDF v5.2 after all.

Thank you again for your help.

  • edit:

I was able to use the latest xtensa-esp-elf-13.2.0_20240530-x86_64-w64-mingw32.zip file, but seeing same error.

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
platform_packages =
    framework-espidf @ https://github.com/gojimmypi/esp-idf/releases/download/v5.4.1k/esp-idf-v5.4.1k.zip
    ;toolchain-xtensa-esp-elf @ file:///SysGCC//esp32-master//tools//xtensa-esp-elf//esp-13.2.0_20240530//xtensa-esp-elf
	toolchain-xtensa-esp-elf @ https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-w64-mingw32.zip
    ; toolchain-xtensa-esp-elf @ https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20240530/xtensa-esp-elf-13.2.0_20240530-x86_64-linux-gnu.tar.gz
lib_deps = wolfssl/wolfssl@^5.7.0-rev.3d

Error as before:

Archiving .pio\build\esp32dev\lib260\libwolfssl.a
Linking .pio\build\esp32dev\firmware.elf
C:/Users/gojimmypi/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe:sections.ld:497: syntax error
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

So the issue is not with the Sysprog's version of the toolchain.

  • edit(2)

I can confirm the very latest ESP-IDF master branch works with the Sysprogs toolchain in Visual Studio with another example:

image

So the problem is definitely specific to PlatformIO.

@Jason2866
Copy link
Author

Platformio build system is very different compared to native IDF.
Honestly i do not really understand fully how it works, especially the linking workflow.
The "magic" happens here https://github.com/platformio/platform-espressif32/blob/develop/builder/frameworks/espidf.py

@gojimmypi
Copy link
Owner

gojimmypi commented Jul 2, 2024

Hi @Jason2866

I've continued to attempt to get the latest Espressif ESP-IDF (unrelease v5.4 master branch) to work with PlatformIO without success. The closest I've been able to get is that linker error, mentioned above.

Just to prove I could create a custom ESP-IDF release, I created a new my_5_2 branch from the known-working Espressif v5.2 in this release and it works just fine like this:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
platform_packages =
    ; Successful v5.2+my02 custom release:
    framework-espidf @ https://github.com/gojimmypi/esp-idf/releases/download/v5.2.0+my02/esp-idf-v5.2.0+my02.zip

lib_deps = wolfssl/wolfssl@^5.7.0-rev.3d

I have my various attempts documented in my platformio.ini.

Did you ever try to get a latest master branch release working? I didn't see any on your https://github.com/Jason2866/esp-idf/releases

@Jason2866
Copy link
Author

Did you ever try to get a latest master branch release working? I didn't see any on your https://github.com/Jason2866/esp-idf/releases

Hi @gojimmypi
Tried and failed. One reason the newer toolchains used in branch master, Iirc there where more issues not related to the toolchain. Stopped because not having the needed toolchains in Platformio Registry is a mess to workaround.

@Jason2866
Copy link
Author

I am currently porting the espressif esp32 Arduino which is build with IDF 5.1.4 to a version which is based on IDF 5.2.2. Surprisingly not so many changes needed :-)
Expected more work because the toolchains changed from gcc 12.2 based to 13.2
So the question is why master fails so miserable? The toolchains are still gcc 13.2 (a newer build only) and should not make such a difference. My guess (did no investigation) espressif breaking changed the cmake / ninja build process in master. So it is no more working with the Platformio build way.

@gojimmypi
Copy link
Owner

gojimmypi commented Jul 12, 2024

Hi @Jason2866

I'm seeing this error for custom ESP-IDF builds... have you encountered anything like this?

Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed).

It seems to be only for a custom build, of any flavor, release version, even from a local install. (e.g. SysProgs). Same code, omit the platformio.ini platform_packages = framework-espidf @ ... and all is well with the exact same source code.

The error occurs at startup time in nvs_flash_init()

@Jason2866
Copy link
Author

@gojimmypi No, haven't had such an issue. Which IDF version? Example?

@gojimmypi
Copy link
Owner

Which IDF version? Example?

Nearly any ESP-IDF version in the 5.2.x series (master, .1 tag, .2 tag) from either my generated version of the locally installed, known working SysGCC/VisualGDB file system.

I've updated the example (nothing much of interest changed, but it's the very latest)

From C:\workspace\wolfssl-gojimmypi\IDE\Espressif\ESP-IDF\examples\espidf-http-request and using :

pio --version
PlatformIO Core, version 6.1.15

pio run --target upload --upload-port COM19

Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/toolchain-xtensa-esp-elf @ 13.2.0+20230928
Unpacking  [####################################]  100%
Tool Manager: toolchain-xtensa-esp-elf@13.2.0+20230928 has been installed!
Tool Manager: Installing espressif/tool-xtensa-esp-elf-gdb @ ~11.2.0
Unpacking  [####################################]  100%
Tool Manager: tool-xtensa-esp-elf-gdb@11.2.0+20230208 has been installed!
Tool Manager: Installing espressif/tool-riscv32-esp-elf-gdb @ ~11.2.0
Unpacking  [####################################]  100%
Tool Manager: tool-riscv32-esp-elf-gdb@11.2.0+20220823 has been installed!
Tool Manager: Installing https://github.com/gojimmypi/esp-idf/releases/download/v5.2.1d/esp-idf-v5.2.1d.zip
Unpacking  [####################################]  100%
Tool Manager: framework-espidf@3.504012.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf @ 3.504012.0 (50.40.12)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp-elf @ 13.2.0+20230928
Reading CMake configuration...
[... etc ...]

Then pio device monitor -p COM19

--- Terminal on COM19 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
r��[0m
I (39) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (76) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (91) boot: End of partition table
I (96) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=22654h (140884) map
I (152) esp_image: segment 1: paddr=0003267c vaddr=3ffb0000 size=04390h ( 17296) load
I (159) esp_image: segment 2: paddr=00036a14 vaddr=40080000 size=09604h ( 38404) load
I (174) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=9a05ch (630876) map
I (391) esp_image: segment 4: paddr=000da084 vaddr=40089604 size=0f5f8h ( 62968) load
I (428) boot: Loaded app from partition at offset 0x10000
I (428) boot: Disabling RNG early entropy source...
I (440) cpu_start: Multicore app
I (449) cpu_start: Pro cpu start user code
I (449) cpu_start: cpu freq: 160000000 Hz
I (449) cpu_start: Application information:
I (452) cpu_start: Project name:     http-request
I (458) cpu_start: App version:      wolfEntropy1-2244-g2975295a7-di
I (465) cpu_start: Compile time:     Jul 12 2024 12:04:55
I (471) cpu_start: ELF file SHA256:  0ae932258fa10235...
I (477) cpu_start: ESP-IDF:          5.2.1.2407012
I (482) cpu_start: Min chip rev:     v0.0
I (487) cpu_start: Max chip rev:     v3.99
I (492) cpu_start: Chip rev:         v1.0
I (497) heap_init: Initializing. RAM available for dynamic allocation:
I (504) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (510) heap_init: At 3FFB8998 len 00027668 (157 KiB): DRAM
I (516) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (522) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (529) heap_init: At 40098BFC len 00007404 (29 KiB): IRAM
I (537) spi_flash: detected chip: generic
I (540) spi_flash: flash io: dio
I (545) main_task: Started on CPU0
I (555) main_task: Calling app_main()
I (555) example: Flash init
Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed).

Core  0 register dump:
PC      : 0x4015fecc  PS      : 0x00060034  A0      : 0x80081596  A1      : 0x3ffbcf60
A2      : 0x3ffb001c  A3      : 0xffffffff  A4      : 0x00000000  A5      : 0x00060023
A6      : 0x00000001  A7      : 0x0000cdcd  A8      : 0x8008ebde  A9      : 0xb33fffff
A10     : 0x3ffb001c  A11     : 0xb33fffff  A12     : 0x0000cdcd  A13     : 0x3a6adacd
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x00000010  EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000


Backtrace: 0x4015fec9:0x3ffbcf60 0x40081593:0x3ffbcfa0 0x40088e4d:0x3ffbcfd0 0x4008a5ab:0x3ffbd000 0x40088af4:0x3ffbd030 0x40088d24:0x3ffbd060 0x40163039:0x3ffbd090 0x400fb789:0x3ffbd100 0x40163869:0x3ffbd140 0x40163a39:0x3ffbd200 0x40163bc1:0x3ffbd230 0x40163c67:0x3ffbd260 0x400fac30:0x3ffbd290 0x400f8ae9:0x3ffbd2c0 0x400f61ba:0x3ffbd2f0 0x400f61f1:0x3ffbd320 0x400d1f4e:0x3ffbd350 0x401688e4:0x3ffbd390 0x4008e90c:0x3ffbd3c0




ELF file SHA256: 0ae932258fa10235

CPU halted.

Remove the framework-espidf @ and the code works fine:

Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-espidf @ ~3.50201.0
Unpacking  [####################################]  100%
Tool Manager: framework-espidf@3.50201.240515 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf @ 3.50201.240515 (5.2.1)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp-elf @ 13.2.0+20230928
Reading CMake configuration...
Generating assembly for certificate bundle...
Warning! Flash memory size mismatch detected. Expected 4MB, found 8MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- wolfssl @ 5.7.0-rev.3d
Building in release mode
Compiling ...

code works just fine....

thanks a log @Jason2866 for taking a look.

@Jason2866
Copy link
Author

Jason2866 commented Jul 12, 2024

@gojimmypi i will have a look. Will probably have no time for this before Monday
Please try this one

platform_packages = framework-espidf @ https://github.com/Jason2866/esp-idf/releases/download/v5.2.2.240627/esp-idf-v5.2.2.zip

@Jason2866
Copy link
Author

@gojimmypi You have to apply the change mentioned in this issue platformio/platform-espressif32#1379 The patch is not backported in branch IDF 5.2 I have added and forgot about this.

@gojimmypi
Copy link
Owner

You have to apply the change mentioned in this issue platformio/platform-espressif32#1379 The patch is not backported in branch IDF 5.2 I have added and forgot about this.

Hi @Jason2866 and thank you SO MUCH for that tip. I'm fairly certain it would have taken me an unreasonable amount of time to find that.

There were several potential fixes mentioned, but the real one is the comment on editing ldgen/entity.py: specifically updating match_objs in tools/ldgen/ldgen/entity.py.

I have that applied in my 5.2.2 branch and YAY! have successfully created ESP-IDF 5.2.2 Release v5.2.2.20240714 that seems to work.

Not at all intuitive for a Cache disabled but cached memory region accessed error, but whew, glad this is resolved.

Please try this one ... Jason2866/ ... v5.2.2.240627

your release, (sans my wolfSSL updates) works great!! I had gone back to that yesterday after creating an unreasonable number of failing releases.

platform_packages = framework-espidf @ https://github.com/Jason2866/esp-idf/releases/download/v5.1.4.240702/esp-idf-v5.1.4.240702.zip

I assume each of the releases have their own quirks, eh? I tried to go back even further with this v5.1 release of yours:

https://github.com/Jason2866/esp-idf/releases/download/v5.1.4.240702/esp-idf-v5.1.4.240702.zip

and encountered this bizarre error (no worries, as I'm happy with the 5.2.2 for now):

Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/toolchain-xtensa-esp-elf @ 13.2.0+20230928
Unpacking  [####################################]  100%
Tool Manager: toolchain-xtensa-esp-elf@13.2.0+20230928 has been installed!
Tool Manager: Installing espressif/tool-xtensa-esp-elf-gdb @ ~11.2.0
Unpacking  [####################################]  100%
Tool Manager: tool-xtensa-esp-elf-gdb@11.2.0+20230208 has been installed!
Tool Manager: Installing espressif/tool-riscv32-esp-elf-gdb @ ~11.2.0
Unpacking  [####################################]  100%
Tool Manager: tool-riscv32-esp-elf-gdb@11.2.0+20220823 has been installed!
Tool Manager: Installing https://github.com/Jason2866/esp-idf/releases/download/v5.1.4.240702/esp-idf-v5.1.4.240702.zip
Unpacking  [####################################]  100%
Tool Manager: framework-espidf@3.50104.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf @ 3.50104.0 (5.1.4)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp-elf @ 13.2.0+20230928
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 4MB, found 8MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
Dependency Graph
|-- wolfssl @ 5.7.0-rev.3d
Building in release mode
Archiving .pio\build\esp32dev\esp-idf\mqtt\libmqtt.a
Compiling .pio\build\esp32dev\newlib\reent_init.c.o
Compiling .pio\build\esp32dev\newlib\newlib_init.c.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_cxx_api.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_item_hash_list.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_page.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_pagemanager.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_storage.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_handle_simple.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_handle_locked.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_partition.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_partition_lookup.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_partition_manager.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_types.cpp.o
Compiling .pio\build\esp32dev\nvs_flash\src\nvs_platform.cpp.o
Compiling .pio\build\esp32dev\perfmon\xtensa_perfmon_access.c.o
Compiling .pio\build\esp32dev\perfmon\xtensa_perfmon_apis.c.o
Compiling .pio\build\esp32dev\perfmon\xtensa_perfmon_masks.c.o
Compiling .pio\build\esp32dev\protobuf-c\protobuf-c\protobuf-c\protobuf-c.c.o
Compiling .pio\build\esp32dev\stdin_out.c.o
Compiling .pio\build\esp32dev\addr_from_stdin.c.o
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c: In function 'esp_reent_init':
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:29:6: error: 'struct _reent' has no member named '__sdidinit'
   29 |     r->__sdidinit = 1;
      |      ^~
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:30:6: error: 'struct _reent' has no member named '__sglue'
   30 |     r->__sglue._next = NULL;
      |      ^~
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:31:6: error: 'struct _reent' has no member named '__sglue'
   31 |     r->__sglue._niobs = 0;
      |      ^~
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:32:6: error: 'struct _reent' has no member named '__sglue'
   32 |     r->__sglue._iobs = NULL;
      |      ^~
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c: In function 'esp_reent_cleanup':
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:60:40: error: 'struct _reent' has no member named '__sglue'
   60 |     struct _glue* prev = &_GLOBAL_REENT->__sglue;
      |                                        ^~
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\reent_init.c:61:43: error: 'struct _reent' has no member named '__sglue'
   61 |     for (struct _glue* cur = _GLOBAL_REENT->__sglue._next; cur != NULL;) {
      |                                           ^~
*** [.pio\build\esp32dev\newlib\reent_init.c.o] Error 1
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\newlib_init.c: In function 'esp_newlib_init':
C:\Users\gojimmypi\.platformio\packages\framework-espidf\components\newlib\newlib_init.c:143:19: error: lvalue required as left operand of assignment
  143 |     _GLOBAL_REENT = &s_reent;
      |                   ^
*** [.pio\build\esp32dev\newlib\newlib_init.c.o] Error 1
================================================================= [FAILED] Took 124.65 seconds 

@Jason2866
Copy link
Author

Jason2866 commented Jul 13, 2024

The Platformio Platform espressif32 has to fit to the IDF version. The IDF 5.1.4 try from you fails since the not matching toolchain version is used. The package build is fine, you just used it with the not fitting Platform. You can see the needed dependencies in https://github.com/espressif/esp-idf/blob/release/v5.1/tools/tools.json for the current IDF version
An example for a working platform.json setup when IDF 5.1.x is used https://github.com/Jason2866/platform-espressif32/blob/Arduino/IDF5/platform.json
But not the only place to look. Magic happens here too https://github.com/Jason2866/platform-espressif32/blob/Arduino/IDF5/platform.py
and the real fun for IDF is here https://github.com/Jason2866/platform-espressif32/blob/Arduino/IDF5/builder/frameworks/espidf.py
Luckily using the newest version here works most of the time for older IDF versions too.

Here are the changes needed to support IDF > 5.2. Honestly I don't have a clue what to change and what is the reason for failing.

@gojimmypi
Copy link
Owner

Hi @Jason2866 -

Thank you again for all of your help. I've settled on the ESP-IDF v5.2.2 branch for now and I have this example that I'm working with to test using wolfSSL instead of mbedTLS in the esp-tls layer.

The example works for both PlatformIO pio run and idf.py, but for now still used a local copy of wolfSSL as a component.

I'm having difficulty using a PlatformIO component as an ESP-IDF component, since the PlatformIO installs as a library in .pio\libdeps\ and not the components directory. See platformio/platform-espressif32#1157 (comment)

Do you think it is possible for the ESP-IDF to "see" the local pio library? The idf_component_get_property appears to only work for components in the components directory (either local project or in ESP-IDF).

@Jason2866
Copy link
Author

Hello @gojimmypi
sorry I can't help here. IDF Platformio build way is not where I have a (real) knowledge.

@gojimmypi
Copy link
Owner

Understood, no worries. :)

@Jason2866
Copy link
Author

Jason2866 commented Jul 18, 2024

Mhh, maybe working if you upload the component you want to use to espressif registry
and load this component via the component YML file. The component manager is supported by Platformio IDF.
The same use as compiling Arduino as a component of IDF. There is no issue with components loaded via the component manager. See https://github.com/espressif/arduino-esp32/blob/master/idf_component.yml
and here is a successful compile run where the components are used.
https://github.com/pioarduino/platform-espressif32/actions/runs/9975313856/job/27564745184
https://github.com/pioarduino/platform-espressif32/tree/develop/examples/espidf-arduino-littlefs

@gojimmypi Edit: Just looked, you have already uploaded a wolfssl version to espressif registry.
So i see no reason why the way I described should not work. The components from registry are handled as the would be in folder components in IDF.
Not sure where exactly the YML file needs to be placed.

@gojimmypi
Copy link
Owner

use espressif registry and load this component via the component YML file

Yes! :) That's exactly the solution, thanks valeros : platformio/platform-espressif32#1157 (comment)

Not sure where exactly the YML file needs to be placed.

That's the less-than-ideal part: it needs to be done manually, and one needs to just know that the file is main/idf_component.yml and should contain something like this:

dependencies:
  wolfssl/wolfssl: "^5.7.1-preview2e"

The alternative is to use the idf.py if available:

idf.py add-dependency "wolfssl/wolfssl^5.7.0"

I still think I could persuade the pio to see the installed library as component source via the magic of cmake, but given the option of using the Managed Components, even if not quite as graceful as with idf.py ... that's good enough for me. For now, anyhow. :)

Thank you again for all your help and feedback. You've been awesome. Much appreciated. Cheers.

@Jason2866
Copy link
Author

Great, that you found a way to get it working.

@gojimmypi
Copy link
Owner

Hey @Jason2866 ! Just a heads up that I have improved esp-tls support for wolfSSL in wolfSSL/wolfssl#7936.

It still needs a custom ESP-IDF, but my https://github.com/gojimmypi/esp-idf/releases/tag/v5.2.2.20240904b seems to work well.

@Jason2866
Copy link
Author

Nice work @gojimmypi
Btw you can use branch IDF 5.3 now too. The linker issues are fixed. Probably branch master works too.

@gojimmypi
Copy link
Owner

Thanks @Jason2866 ! Your tips on making an ESP-IDF release have been very helpful. Good to know about v5.3. ESP-IDF PR is next on the agenda.

At the moment, I'm working on improving PlatformIO support for Certificate Bundles as mentioned in that PR. I'm having a dreadful time as the build process does not seem to process any of the file system scripts in the Espressif CMakeLists.txt files, such as a critical one to assemble the Certificate Bundle output file. Details, details! lol.

oh, btw - I sent you an email on Aug 18. Nothing critical but related to Tasmota. Let me know if you are interested.

Cheers

@gojimmypi
Copy link
Owner

@Jason2866 I have a sample 5.3.1 release, but it is >1.5GB instead of ~70MB. I supposed I could just edit the script, looks like it is including the GitHub files. Have you seen this before? Any idea why the same script has such a different outcome?

@Jason2866
Copy link
Author

@gojimmypi You are using the orig https://github.com/gojimmypi/esp-idf/blob/v5.3.1.20240925a/.github/workflows/release_zips.yml
to build the release. This script includes the whole github. In the small releases you used my modified GH script which only includes the needed files/folders.

@gojimmypi
Copy link
Owner

Hi @Jason2866 and thank you!

Yes, I had missed that step in my summarized instructions and forgot to look at the whole point of this PR from earlier this year.

I made that change and it seems to work great! The resultant size is much smaller. yay!

I've created my first ESP-IDF v5.3.1 release from my_531 branch with wolfSSL support in esp-tls here:

https://github.com/gojimmypi/esp-idf/releases/tag/v5.3.1.20240926b

The latest wolfSSL for that is in wolfSSL/wolfssl#7936 and should be included in the next release.

Let me know if you have a chance to take it for a test drive.

@gojimmypi
Copy link
Owner

For reference: this thread started at platformio/platform-espressif32#1398 and was moved here to not clutter up that closed issue.

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.

2 participants