Institutions, firms and environment in a framework of innovation