Maintain state of GPIO pin across reboot
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. State holding capacitor.

Wire up a spare GPIO as shown. On reset read the state of the capacitor and set the output appropriately. This will give you a short-term 1-bit memory.

//Pseudo code to go early in boot sequence.
pinPullup(pin) = false;        //Turn off the pull-up.
pinMode(pin) = input;          //Set the pin to input mode, if required.
pdState = pinRead(pin);        //Read the input to get the power-down state.
pinMode(pin) = output;         //Configure as output.
pinWrite(pin) = pdState;       //Restore the power-down state.


You may wish to swap the order of the last two lines (depending on micro) to avoid a momentary blip.

Note that in this configuration the pin can't be used for anything else.