Although smart cards are everywere, scientific papers dealing with theirs software architecture are few. This paper proposes a software design framework for smartcards, that can mitigate software design costs over system design. The concept of hardware-dependent software is introduced, principles and design patterns focusing on reuse and extendability are presented and addressed to this engineering domain. A small card operating system is assembled using the framework components. Finally, a prototype validates the concepts.