Set __heap_end to current SP before entering thread mode to make the remaining RAM available as heap for module oneway_malloc.