The VS1005g manual states that the PWRBTN turns off the power if held low for 5.6 seconds and that this feature can be turned off by software. I can't find any references on how to do this (I can read its state).

Where did you read this? Because I don't think that it's accurate. It doesn't turn off the power, it causes a reset. And actually, each HIGH state WILL cause a reset after a few seconds, unless disabled, regardless of whether the power button is held high or not. So that functionality needs hand-holding by software (in the power button interrupt and another timer interrupt) and as such is not very practical; I think other methods are more practical.

Here and there in the kernel you can see this line: PERIP(ANA_CF1) |= ANA_CF1_BTNDIS; //Disable power button reset
That line causes the automatic power button reset NOT to be taken.

Oh dear, I must have looked at the ANA_CF1 bits table 20 times and didn't see that line immediately below.

I rehashed the power off example but turned all the regulators off since this is a battery powered system. I haven't had a chance to see if this really turns stuff off.

Thank you for pointing it out.

void powerOff(void)
/* This code abstracted from PowerOff example, viewtopic.php?f=13&t=1752.
* Turn off the PWM, disable the OS, turn off regulators,
* Parameters: none
* External References:
* PWM_FRAMELEN, PWM_PULSELEN: PWM may or may not be used. It is used during startup and is probably left on
* so it needs to be shut down.
* REGU_CF: Regulator control register. Turn off all the features we can find.
* Returned values: never gets out of here.
*/
{

vs1005g.h lists three routines: PowerShutDownFlash, PowerOff, and RealPowerOff. PowerOff appears in the VSOS documentation though it's not explained. Do these do anything in addition to the regulator power off? Which one should I call, if any?

After shutting down the regulators, as in code below, pulling PWRBTN high doesn't seem to restart things. Pulling XRESET low gets things started again which suggests that the loop at the end is still executing even after a few minutes. VHIGH is still at 3.7 volts. Is this a problem?

After shutting down the regulators, as in code below, pulling PWRBTN high doesn't seem to restart things ... which suggests that the loop at the end is still executing even after a few minutes. VHIGH is still at 3.7 volts. Is this a problem?

Do you think there might be leakage from VHIGH (or from ANY other power source, such as an I/O pin, classic example is UART RX pin feeding 3.3V) to any of the power rails? Or even to any pin on the device, since practically all pins are connected to some power rail via the protection structure (diode with reverse polarity)?

Any external voltage source on any pin may potentially leak to any voltage rail through one or more diodes in reverse polarity, preventing the core from being shut down.

Does anything come to mind?

Hmm, there's a bit in CF_CTRL that disables internal brown-out reset. Can you check what value it is and if flipping it causes any change in functionality? Here's a helpful code snippet:

Finally, be very careful what you write in CF_CTRL. Don't touch any of the other bits, that might be dangerous and for that reason we don't even put that register into the header files, inviting people to poke around with it.