AUnit  1.7.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
Macros
Flash.h File Reference

Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them. More...

#include <avr/pgmspace.h>
Include dependency graph for Flash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AUNIT_FPSTR(pstr)   reinterpret_cast<const __FlashStringHelper *>(pstr)
 The FPSTR() macro is defined on ESP8266 and ESP32, but not on other platforms (e.g. More...
 
#define AUNIT_F(x)   F(x)
 
#define SERIAL_PORT_MONITOR   Serial
 

Detailed Description

Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them.

On AVR, flash strings are fully supported through the F() and PSTR() macros, and the (const __FlashStringHelper*) pointer. However, the useful FPSTR() macro is not defined.

Seeeduino SAMD core has a broken implementation of FPSTR(). This file clobbers that implementation.

Adafruit's SAMD core fixes the broken FPSTR(), so we don't have to do anything.

Arduino's SAMD core breaks backwards compatibility after version >= 1.8.10. AUnit does not support the ArduinoCore-API, so Arduino-branded SAMD boards are explicitly blacklisted.

STM32duino seems to have forked from Teensyduino, so it too has F() and PSTR(), but no FPSTR() macro.

The ESP8266 platform used to have flash strings which were buggy and brittle, and often failed with obscure errors messages, see for example, https://github.com/esp8266/Arduino/issues/3369. This bug was fixed in Dec 2018, so the ESP8266 is fully supported.

The ESP32 had a broken implementation of FPSTR() (https://github.com/espressif/arduino-esp32/issues/1371), but the bug was fixed in ESP32 Core 1.0.3 around Sept 2019. ESP32 is fully supported.

On Teensy-ARM, flash strings are not supported, but F(), PSTR() and (const __FlashStringHelper*) are defined. The useful FPSTR() macro is not defined.

The megaAVR had a broken implementation of the F() macro (does not return a const __FlashStringHelper*), but returns a (const char*)). But more importantly, megaAVR uses the ArrduinoCore-api which is blacklisted by AUnit, so the megaAVR (e.g. Nano Every) is not supported.

Definition in file Flash.h.

Macro Definition Documentation

◆ AUNIT_FPSTR

#define AUNIT_FPSTR (   pstr)    reinterpret_cast<const __FlashStringHelper *>(pstr)

The FPSTR() macro is defined on ESP8266 and ESP32, but not on other platforms (e.g.

AVR, SAMD, Teensyduino, and STM32duino). We define our own version to make this work on the various platforms.

Definition at line 77 of file Flash.h.