Pigweed
C/C++ API Reference
|
Macros | |
#define | PW_MUST_PLACE_SIZE(isection, isize) _PW_MUST_PLACE_SIZE(isection, isize, __section_place_, __COUNTER__) |
#define PW_MUST_PLACE_SIZE | ( | isection, | |
isize | |||
) | _PW_MUST_PLACE_SIZE(isection, isize, __section_place_, __COUNTER__) |
PW_MUST_PLACE_SIZE is a macro intended for use in linker scripts to ensure inputs are an expected size.
This is helpful for shared memory placements between multiple cores.
Imagine the following code is consumed while linking for 2 separate cores:
This works but is fragile as it will silently break if the size of .bss.shared_memory changes on a single core. This may occur if compiler or other parameters are changed on one core and not the other.
If the wildcard match results in a different size from what was specified PW_MUST_PLACE_SIZE will generate an error.
This could be because you had a typo, the path changed, the symbols changed in size (either because the symbol was changed or compilation settings were changed), symbols were dropped due to linker section garbage collection. In the latter case, you can choose to add KEEP()
around your input to prevent garbage collection.