The assessment of the safety and the reliability for embedded systems is mainly performed early in the design cycle, at system level. The objective is to detect the potential failures which could lead to an undesirable event. Given the increasing critical aspect of the functions executed by the software in automotive and aeronautics, it becomes necessary to perform safety analysis at lower level of the design cycle such as at implementation stage. But, software models at this stage are complex and heterogeneous so the analysis are often manually realized. As the software models are also very large (thousands of basic software components), the analysis is labor-intensive and error-prone so it is not obvious to obtain relevant results. Therefore, the analysis on software models at implementation stage is often neglected. This paper proposes an efficient safety analysis based on the generation of fault trees and failure modes and effects analysis (FMEA) to assist and induce the engineers to perform the analysis on software models at implementation stage. Our analysis takes into account the respective behavior of each used software components by introducing specific failure propagation rules. Also, special filters are introduced to find the exact paths leading to the studied undesirable events. Furthermore, these rules of propagation and filtering are characterized and summarized in semi-automated procedures and are implemented in a toolchain to facilitate the fulfillment of our safety analysis. This toolchain is intended to be used with the integrated development environment Matlab/Simulink and an extended library dedicated to rapid-prototyping development of electronic control unit. To illustrate the effectiveness of our methodology, a practical case study based on a vehicle accelerator system is presented.