Allow non-aligned PSTR() by s-hadinger · Pull Request #7275 · esp8266/Arduino (original) (raw)
PSTR()
are by default aligned to 32-bits boundaries, whereas normal string are not. I understand the speed benefit, but it consumes some additional Flash, which is around 1.7KB for Tasmota.
This change allows to override this default behavior and allow non-aligned PSTR() with #define PSTR_ALIGN 1
.
There is no change if you don't explicitly set this flag as compile option -DPSTR_ALIGN=1
.
Currently the only way in Tasmota to achieve the same result is to override the entire PSTR()
macro with:
-DPSTR\(s\)=\(__extension__\(\{static\ const\ char\ __c\[\]\ __attribute__\(\(__aligned__\(1\)\)\)\ __attribute__\(\(section\(\ \"\\\\\".irom0.pstr.\"\ __FILE__\ \".\"\ __STRINGIZE\(__LINE__\)\ \".\"\ \ __STRINGIZE\(__COUNTER__\)\ \"\\\\\"\,\ \\\\\"aSM\\\\\"\,\ \@progbits\,\ 1\ \#\"\)\)\)\ =\ \(s\)\;\ \&__c\[0\]\;\}\)\