This paper presents a modeling and optimization framework to minimize the energy consumption of a fully electric powertrain by optimizing its design and control strategies whilst explicitly accounting for the thermal behavior of the Electric Motor (EM). Specifically, we first derive convex models of the powertrain components, including the battery, the EM, the transmission and a Lumped Parameter Thermal Network (LPTN) capturing the thermal dynamics of the EM. Second, we frame the optimal control problem in time domain, and devise a two-step algorithm to accelerate convergence and efficiently solve the resulting convex problem via nonlinear programming. Subsequently, we present a case study for a compact family car, optimize its transmission...