Energy consumption is an important performance parameter for portable and wireless embedded systems. However, energy consumption must be carefully balanced with real-time responsiveness in hard real-time systems. We present an optimal offline dynamic voltage scaling (DVS) scheme for dynamic power management in such systems. A generalized network flow model for the uniprocessor DVS problem is developed and solved optimally using an efficient network flow algorithm. The proposed method outperforms existing DVS schemes for several popular embedded processors where the number of processor speeds is limited to a few values. The GNF model provides theoretical lower bounds on energy consumption using DVS in hard real-time systems.