So I've spent months trying to perfect my Bela:Soundfont program (and unifying my codebase to also run as a PC Juce application for testing) and it's almost there....

I'm wondering whether it's possible to stop a running program from a switch (through a digital pin I suppose) and restart it from another one ? At the moment my Bela is plugged into my PC and I can restart the program if it crashes - it does occasionally due to some racing conditions which I'm fixing. Assuming it'll be set free from my laptop (USB powered) then I'd still like to opportunity to recover if it falls over (without restarting the whole board which takes some time).

I can steal the hardware and port scanning from somebody else's hard work - but I'm stuck on interacting with the compiler / IDE from the real world ?

    Hmmm... If the program crashes while it's set to run on boot, it will restart within less than a second. The only problem here is that if it crashes "too quickly", then systemd, which manages the service, may decide that the service is faulty and therefore suspend it. I am not sure what "too quickly" means exactly, and whether that applies to your case, but the documentation for systemd and/or systemctl may provide more hints.
    It seems that the above behaviour may be enough for your purposes, however here is some more:

    adrianmcroft possible to stop a running program from a switch

    This is possible. The Bela Button on the cape will stop the running program if it's pressed briefly (and potentially it will restart immediately). If it is held pressed for more than 2seconds, it will gracefully shutdown the board. Both behaviours are overridable and the button is remotable.

      giuliomoro Thanks for the (as usual) excellent reply. I'll do some research on your comments and hints ; even though I've fixed most of my bugs and sloppy coding I'd still like a rip-cord just in case.

      I've only scratched the surface of Bela (and was naïvely happy for a while), now I'll make systemd my starting point.

      Many thanks