Skip to content

Commit ecde690

Browse files
committed
Change data tag to __fstr__ for better filtering in linker script.
2 parents f9d078b + 16d9faa commit ecde690

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

map.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ The macro in the first example above produces a structure like this::
101101
constexpr const struct {
102102
ObjectBase object;
103103
MapPair<int, String> data[2];
104-
} fstr_data_intmap PROGMEM = {
104+
} __fstr__intmap PROGMEM = {
105105
{16},
106106
{35, &content1},
107107
{180, &content2},
108108
};
109-
const Map<int, String>& intmap = fstr_data_intmap.object.as<Map<int, String>>();
109+
const Map<int, String>& intmap = __fstr__intmap.object.as<Map<int, String>>();
110110

111111
Note: ``FSTR::`` namespace qualifier omitted for clarity.
112112

src/include/FlashString/Array.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
constexpr const struct { \
7070
FSTR::ObjectBase object; \
7171
ElementType data[sizeof((const ElementType[]){__VA_ARGS__}) / sizeof(ElementType)]; \
72-
} FSTR_PACKED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
72+
} FSTR_PACKED FSTR_ALIGNED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
7373
FSTR_CHECK_STRUCT(name);
7474

7575
/**
@@ -82,7 +82,7 @@
8282
* printf("arr[0] = %f, %u elements, buffer is %u bytes\n", arr[0], fsArray.length(), sizeof(arr));
8383
*/
8484
#define LOAD_FSTR_ARRAY(name, array) \
85-
decltype(array)[0] name[(array).size()] __attribute__((aligned(4))); \
85+
decltype(array)[0] name[(array).size()] FSTR_ALIGNED; \
8686
memcpy_aligned(name, (array).data(), (array).size());
8787

8888
/**

src/include/FlashString/Map.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
constexpr const struct { \
116116
FSTR::ObjectBase object; \
117117
FSTR::MapPair<KeyType, ContentType> data[size]; \
118-
} FSTR_PACKED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
118+
} FSTR_PACKED FSTR_ALIGNED name PROGMEM = {{sizeof(name.data)}, {__VA_ARGS__}}; \
119119
FSTR_CHECK_STRUCT(name);
120120

121121
namespace FSTR

src/include/FlashString/Object.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/**
4747
* @brief Provide internal name for generated flash string structures
4848
*/
49-
#define FSTR_DATA_NAME(name) fstr_data_##name
49+
#define FSTR_DATA_NAME(name) __fstr__##name
5050

5151
/**
5252
* @brief Given an Object& reference, return a pointer to the actual object

src/include/FlashString/String.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ typedef const __FlashStringHelper* flash_string_t;
4242
*/
4343
#define FS_PTR(str) \
4444
(__extension__({ \
45-
static DEFINE_FSTR_DATA(struc, str); \
46-
asm("" : : ""(struc)); \
47-
static_cast<const FSTR::String*>(&struc.object); \
45+
static DEFINE_FSTR_DATA(__fstr__, str); \
46+
static_cast<const FSTR::String*>(&__fstr__.object); \
4847
}))
4948

5049
/**

src/include/FlashString/config.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
#include <FakePgmSpace.h>
2525

2626
#define FSTR_INLINE __attribute__((always_inline)) inline
27-
#define FSTR_PACKED __attribute__((packed)) __attribute__((aligned(4)))
27+
#define FSTR_ALIGNED __attribute__((aligned(4)))
28+
#define FSTR_PACKED __attribute__((packed))

vector.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ The above example generates a structure like this::
7070
const struct {
7171
ObjectBase object;
7272
String* entries[4];
73-
} fstr_data_myTable PROGMEM = {
73+
} __fstr__myTable PROGMEM = {
7474
{16},
7575
&str1,
7676
&str2,
7777
nullptr,
7878
&str3,
7979
};
80-
const Vector<String>& myTable PROGMEM = fstr_data_myTable.as<Vector<String>>();
80+
const Vector<String>& myTable PROGMEM = __fstr__myTable.as<Vector<String>>();
8181

8282
Note: ``FSTR::`` namespace qualifier omitted for clarity.
8383

0 commit comments

Comments
 (0)