We propose an explanation for the self-organization towards criticality observed in martensites during the cyclic process known as 'training'. The scale-free behavior originates from the interplay between the reversible phase transformation and the concurrent activity of lattice defects. The basis of the model is a continuous dynamical system on a rugged energy landscape, which in the quasi-static limit reduces to a sandpile automaton. We reproduce all the principal observations in thermally driven martensites, including power-law statistics, hysteresis shakedown, asymmetric signal shapes, and correlated disorder. PACS numbers: 62.20.Fe,64.60.My,81.30.Kf,89.75.Fb Experiments in martensites reveal intermittent behavior with power-law statistics [1,2,3,4], showing an intrinsic complexity comparable to that of turbulence, earthquakes, internet networks, and financial markets. Criticality is known to be an issue of great significance in contemporary science, giving a framework for understanding the emergence of complexity in a variety of natural systems [5,6]. Within materials science, criticality has been recognized in the last years as a key factor in crystal plasticity, brittle fracture and damage [7]. In the present paper we develop a model explaining why similar behavior is also observed in martensitic transformations.Reversible martensitic transformations involve a coordinated distortion of the crystal lattice and belong to the class of ferroelastic first-order phase changes with athermal character [8,9]. In such systems the macroscopic strain discontinuity typically splits into a set of bursts (avalanches) corresponding to transitions between neighboring metastable states. The individual avalanches can be detected through the measurement of the intermittent acoustic or calorimetric signals. The size distribution observed in shape-memory alloys (Cu-Al-Ni, Cu-ZnAl, Cu-Al-Mn, Ni-Mn-Ga) was shown to be scale free [1,2,3,4,9]. Despite the apparent similarity with driven ferromagnetic systems, where the scale-free Barkhausen noise has been known for a long time, the experiments on memory alloys show features not observed in magnets, and which are instead reminiscent of plastic shakedown. In particular, the critical character of the avalanches [2,3] and the smoothing of the hysteresis profile [3, 10] emerge only after multiple thermal cycling through the transition.The mechanism leading to training-induced critical behavior in martensites strongly resembles the phenomenology associated with self-organized criticality (SOC) [5]. The SOC paradigm in the form of a sandpile automaton has been applied to martensitic transformations in 11; which however, lacked a connection to the physics of martensitic transformations. A different set of models exploited the similarity between martensites and magnetics by interpreting both in an Ising-type framework, with zero temperature and quenched disorder [12]. In this context the power-law over a few decades of avalanche sizes is viewed as a sign of proximity of the system to a ...