Large deviations in equilibrium statistical mechanics: microcanonical entropy density and canonical free energy (section 5.1, 5.2).

Reference review: "The large deviation approach to statistical mechanics" by H. Touchette (Phys. Rep. 2009)