So I added a (momentary) button to pin 28 and to ground (remember to connect AGND and DGND too).
And in my main() I added this code:
// Configure and initialize button
Switch button1;
button1.Init(hardware.GetPin(28), 10);
// Loop forever
for(;;)
{
// Reset to upload
button1.Debounce();
if (button1.Pressed())
{
RebootToBootloader();
}
// wait 1 ms
System::Delay(1);
}