A Design Framework for Dynamic Embedded Systems with Security Constraints