Martensitic tents and tunnels, two innovative thin film structures in shape memory alloys (SMA) grown on backing-etched substrates, exhibit excellent mechanical performance. However their formations are not arbitrary, and a good understanding of the formations and evolutions of their microstructure is important. In this paper, we study the formations and evolutions of martensitic tents and tunnels in SMA thin films by combining a crystallographic compatibility analysis and a phase field model, which is developed to account for substrate constraint. Martensite-martensite and austenite-martensite interfaces in tents and tunnels have been identified via crystallographic compatibility analysis, and visualized by phase field simulations. Their evolutions as formations and degenerations under cyclic thermal loading and their orientations have also been captured by phase field simulations. The results indicate that a tent with four patches of martensites can generate below transformation temperature if the backing-etched portion is a square with four sides constrained and orientated by 45∘ from the standard configuration, while a tunnel with only one martensitic variant in the backing-etched region can form by releasing the constraint to two parallel sides. Comparing with tents, tunnels exhibit larger actuation strain, which may benefit in applications. It is also found that tents and tunnels gradually degenerate back to austenite upon heating. Due to higher elastic energy, tents degenerate from its center, while tunnels degenerate from its sides. These results agree well with experimental observations [Science 307, 53 (2005)]. The methodology can be applied to analyze and simulate other special SMA thin film structures.