The operation of groups of heavy-duty vehicles at a short inter-vehicular distance, known as platoon, allows one to lower the overall aerodynamic drag and, therefore, to reduce fuel consumption and greenhouse gas emissions. However, due to the large mass and limited engine power of trucks, slopes have a significant impact on the feasible and optimal speed profiles that each vehicle can and should follow. Maintaining a short inter-vehicular distance, as required by platooning, without coordination between vehicles can often result in inefficient or even unfeasible trajectories. In this paper, we propose a two-layer control architecture for heavy-duty vehicle platooning aimed to safely and fuel-efficiently coordinate the vehicles in the platoon. Here, the layers are responsible for the inclusion of preview information on road topography and the real-time control of the vehicles, respectively. Within this architecture, dynamic programming is used to compute the fuel-optimal speed profile for the entire platoon and a distributed model predictive control framework is developed for the real-time control of the vehicles. The effectiveness of the proposed controller is analyzed by means of simulations of several realistic scenarios that suggest a possible fuel saving of up to 12% for follower vehicles compared with the use of standard platoon controllers.