Skip to content

cannot print assert information #353

@jerabaul29

Description

@jerabaul29

I am using the core v1 in its latest version. I cannot use the core v2 for my application, due to the problems mentioned in #347 and #349 .

I am trying to get some asserts to display some information when hitting a false condition. I try to follow the "usual" arduino way:

#define __ASSERT_USE_STDERR

#include <assert.h>

void setup() {                
    // initialize serial communication at 9600 bits per second.
    Serial.begin(115200);  
    Serial.println();
    Serial.println(F("hello"));
    delay(10);
    assert(false);
    Serial.println(F("this should not appear"));
}

void loop(){
}

void __assert(const char *__func, const char *__file, int __lineno, const char *__sexp) {
    Serial.println(F("----- assert information -----"));
    Serial.println(__func);
    Serial.println(__file);
    Serial.println(__lineno, DEC);
    Serial.println(__sexp);
    Serial.flush();
    delay(100);
    abort();
}

This aborts correctly (i.e. this should not appear is not printed), but I do not get any of the assert informations as described in __assert.

  • any idea how to / is it possible to get this to work already now?
  • if not, is it something you can make possible? :) .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions