In the past, dynamic voltage and frequency scaling (DVFS) has been widely used for power and energy optimization in embedded system design. As thermal issues become increasingly prominent, we propose design-time thermal optimization techniques for embedded systems. By carefully planning DVFS at design time, our techniques proactively optimize system thermal profile, prevent run-time thermal emergencies, minimize cooling costs, and optimize system performance. To the best of our knowledge, this is the first work addressing embedded system design-time thermal optimization using DVFS. We formulate minimization of application peak temperature in the presence of real-time constraints as a nonlinear programming problem. This provides a powerful framework for system designers to determine a proper thermal solution and provide a lower bound on the minimum temperature achievable by DVFS. Furthermore, we examine the differences between optimal energy solutions and optimal peak temperature solutions. Experimental results indicate that optimizing energy consumption can lead to unnecessarily high temperature. Finally, we propose a thermal-constrained energy optimization procedure to minimize system energy consumption under a constraint on peak temperature.