libmaple's linker script will always define `_lm_heap_end`

; however, on most boards, its value is the initial stack pointer (so the heap and stack overlap).

Probably the right thing to do is put it somewhere below the stack, so there's a minimum guaranteed stack size. Then, as long as you don't use too much stack, you could use `_lm_heap_end`

safely to build a getFreeMemory() type function.

Would you care to prepare a patch? See support/ld/common.inc:

```
/*
* Heap: Linker scripts may choose a custom heap by overriding
* _lm_heap_start and _lm_heap_end. Otherwise, the heap is in
* internal SRAM, beginning after .bss, and growing towards
* the stack.
*
* I'm shoving these here naively; there's probably a cleaner way
* to go about this. [mbolivar]
*/
_lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end;
_lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init;
```