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

assert not working any more in 3.2 #11166

Open
1 task done
pschatzmann opened this issue Mar 23, 2025 · 9 comments
Open
1 task done

assert not working any more in 3.2 #11166

pschatzmann opened this issue Mar 23, 2025 · 9 comments
Assignees
Labels
bug 🐞 Inconsistencies or issues which will cause a problem for users or implementers. Priority: High 🗻 Issues with high priority which needs to be solved first.
Milestone

Comments

@pschatzmann
Copy link

pschatzmann commented Mar 23, 2025

Board

Any

Device Description

n/a

Hardware Configuration

n/a

Version

latest development Release Candidate (RC-X) and in the meantime also the release 3.2.0

IDE Name

Arduino

Operating System

Linux

Flash frequency

n/a

PSRAM enabled

no

Upload speed

n/a

Description

Up to and including R 3.1 using assert was giving the following type of error messages

assert failed: void setup() file_speeds.ino:100 (SD.begin(PIN_AUDIO_KIT_SD_CARD_CS))

Backtrace: 0x40082541:0x3ffb1f30 0x4008d919:0x3ffb1f50 0x40093afe:0x3ffb1f70 0x400d404b:0x3ffb20a0 0x400dbbbf:0x3ffb2270 0x4008e592:0x3ffb2290

Starting R 3.2 asserts are ignored

Sketch

Just add an assert(false); to the setup()

Debug Message

N/A

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@pschatzmann pschatzmann added the Status: Awaiting triage Issue is waiting for triage label Mar 23, 2025
@pschatzmann
Copy link
Author

pschatzmann commented Apr 5, 2025

Any progress ?
I think this is quite serious and I am surprised that in the meantime you also decided to released 3.2.0 with this error...

@me-no-dev
Copy link
Member

It took me a bit of searching :) Seems that -DNDEBUG is added by esp-matter by default and that disables assert. You can probably do your own macro that uses abort() instead, which works

@me-no-dev
Copy link
Member

cc: @SuGlider

@SuGlider SuGlider self-assigned this Apr 8, 2025
@SuGlider
Copy link
Collaborator

SuGlider commented Apr 8, 2025

I'll take a look, but if Matter Library disables it, it can be fixed by Lib Builder for the next release.

@SuGlider
Copy link
Collaborator

SuGlider commented Apr 9, 2025

@pschatzmann - I have found a work around that fixes this issue using Core 3.2.0 (or any 3.x).
Add a file called build_opt.h to your Arduino project.
In this file add a line with -UNDEBUG, save it, build and upload the project to the ESP32. assert() will work now.

This will undefine NDEBUG and retore assert() functionality.

@SuGlider SuGlider added bug 🐞 Inconsistencies or issues which will cause a problem for users or implementers. Priority: High 🗻 Issues with high priority which needs to be solved first. and removed Status: Awaiting triage Issue is waiting for triage labels Apr 9, 2025
@SuGlider SuGlider moved this from Todo to In Progress in Arduino ESP32 Core Project Roadmap Apr 9, 2025
@SuGlider SuGlider added this to the 3.2.1 milestone Apr 9, 2025
@pschatzmann
Copy link
Author

Thanks a lot for the work around: I confirm that this is working.

Looking forward for the final correction...

@me-no-dev
Copy link
Member

@SuGlider what worries me is that matter disables assert throughout our ESP-IDF precompiled libs. Can you check this with the Matter team please?

@SuGlider
Copy link
Collaborator

SuGlider commented Apr 9, 2025

@SuGlider what worries me is that matter disables assert throughout our ESP-IDF precompiled libs. Can you check this with the Matter team please?

Actually, when CHIP builds using release mode, it sets -DNDEBUG in order to avoid executing not necessary debugging code.
Arduino Lib Builder pick it up and includes it into the flags/defines file.

It doesn't affect other IDF components.
It only affects CHIP building process (there is a CHIP scriptBUILD.gn for creating CMakeLists.txt in CHIP before building it).

It doesn't affect esp-matter IDF code or any other IDF component.

@me-no-dev
Copy link
Member

it picks it up because the project files are compiled with this flag. If they are compiled with it, chances are that others are compiled also. We extract flags from the 3 empty files in the lib-builder main (c, cpp and S)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Inconsistencies or issues which will cause a problem for users or implementers. Priority: High 🗻 Issues with high priority which needs to be solved first.
Projects
Status: In Progress
Development

No branches or pull requests

3 participants