Cyber-physical systems (CPS) are becoming more prevalent for the reliable execution
of critical tasks, e.g., in the aerospace and medical fields. The development of such
systems is challenging, due to the heterogeneity of the components ranging from sensors
and embedded controllers to cloud solutions. Model-driven approaches can provide a
high-level abstraction to combat the challenges. This paper proposes a model-driven
development approach supporting the precise modeling of CPS and the automatic derivation
of implementation from the resulting models. The approach introduces a composition
semantics tailored to heterogeneous architectures for the precise description of component
interactions. Automated code generators allow the execution of standalone software
components on real-time controllers and support the synthesis of standalone hardware
components, enabling both the derivation of embedded software and the description
of logical circuit behavior. Component interactions are supported by multiple communication
solutions generally used in critical, real-time embedded systems. The approach is
implemented in the Gamma framework and its applicability is demonstrated in two case
studies.