For squeezing erlang in KiB sized RAM, the AtomVM project is probably a better fit.

https://github.com/atomvm/AtomVM