I do have several attempts of resizing JS variables after reboot to allow softdevice requirements to grow and shrink so both larger MTU and this would be possible only when one needs it, the setting could stick across reboots like current time does now. Latest attempt was via moving JsVars array to the beginning of data segment so its real beginning and size can be computed dynamically after initializing softdevice and using only the rest that remains free. That was the least invasive way with minimum changes.
Previous attempt was a bit more invasive and flexible - moving static data after stack so stack could grow down, softdevice grow up and js variables array stay between them. trouble with this one was determining size of static data so that data segment is placed right below end of ram and cpu stack below it. This is not possible to do in gcc linker file so two linking stages and dynamic generation of linker file would be needed.
However for multiple connections other changes are needed since single connection is hardcoded in couple of places (e.g. there are two variables named m_peripheral_conn_handle and m_central_conn_handle, that would need to be changed to array but there is more to it)
© Espruino, powered by microcosm.
Report a problem