Component-based development of embedded systems has been suggested as a means to increase development efficiency by, for example, facilitating reuse. However, the specifics of the embedded systems domain also raise some particular difficulties when applying this approach. For example, when glue code is automatically produced from an architectural specification, a systematic approach where fully reusable code is generated for all entities in the system, can lead to unaffordable overhead in embedded systems with severe resource limitations and temporal constraints. If, on the other hand, highly optimized code is produced by taking advantage of the specific context in which each component is used, then the generated code is not reusable in other contexts, and the potential benefits of component-based development are not fully exploited. In this paper, we present a component-based framework that permits a more detailed trade-off between optimization and reusability, by automating the integration of components for which the software designer can specify the desired reuse potential. Depending on this specification, the integration code is either reused and adapted, or completely optimized.