Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vsnprintf with length of 80 chars for format hardfaults the board #92

Closed
@janjongboom

Description

@janjongboom

This sketch hardfaults the board on v1.3.0 of this Arduino Core on the Arduino Nano 33 BLE Sense:

void printf_wrapper(const char *format, ...) {
    static char print_buf[2048] = { 0 };

    va_list args;
    va_start(args, format);
    int r = vsnprintf(print_buf, 2048, format, args);
    va_end(args);

    if (r > 0) {
        Serial.write(print_buf);
    }
}

void setup() {
  // put your setup code here, to run once:
  delay(5000);
}

void loop() {
  // put your main code here, to run repeatedly:

  printf_wrapper("hello world\n");
  printf_wrapper("hello this is a long text with 40 chars\n");
  printf_wrapper("hello this is a long text with 80 chars hello this is a long text with 80 chars\n");

  delay(1000);

}

This works fine on the 1.1.6 core.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions