Terminal value problem for a generalized fractional ordinary differential equation