Safe Implementation of Mixed-Criticality Applications in Multicore Platforms: A Model-Based Design Approach